[openssl-users] Decrypting an OpenSSL encrypt AES256-CBC data

Michael Wojcik Michael.Wojcik at microfocus.com
Fri Dec 28 18:16:20 UTC 2018

> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of Ertan Küçükoglu
> Sent: Thursday, December 27, 2018 16:03

> A- I tried to directly decrypt (no padding applied) and I get my plain text plus
> some additional invisible characters at the end. I am told it maybe a "padding"
> issue, my problem, during decryption.

How does the Windows program know how long the decrypted data is?

It sounds to me like the problem is simply that your Windows code is decrypting the data correctly, then reading past it into garbage left at the end of the buffer.

If the messages are of fixed length, only use that many bytes from the decryption output. If they're of variable length, then the sender will have to tell the receiver how long they are. There are many ways of doing that; you haven't told us enough about your protocol to know which would be appropriate in your case.

Michael Wojcik
Distinguished Engineer, Micro Focus

More information about the openssl-users mailing list