Avoid infinite loop when flushing an empty bundle.
Add test to validate AES encryption.