And, you should note, that ElMessageEncryptor uses CMS (Cryptography Messages Syntax) for message encryption, which means that it will add some additional payload to resulting file, according to CMS standart (RFC 3852).
The same about TElPGPWriter (this uses OpenPGP specification, RFC 4880).

And only TElSymmetricCrypto performs raw encryption and decryption without additional payload (except data padding, when using CBC/ECB cipher modes).

I finally found what I was doing wrong. It is a combination of msOUT.Size and placing the position of the pointer to the beginning of the stream before starting the decryption. Below is the example code which might be of interest for other users as well.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.