<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>Windows program does not know length of data. I would like to use some kind of standard method and use exact method on Windows to decrypt.</div><div><br></div><div>I think my problem is really that I do not know what "padding" is used by default. I have found below function. However, there is no detailed explanation about it in here: <a href="https://www.openssl.org/docs/man1.0.2/crypto/EVP_CIPHER_CTX_set_padding.html">https://www.openssl.org/docs/man1.0.2/crypto/EVP_CIPHER_CTX_set_padding.html</a></div><div>int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding);<br></div><div><br></div><div>I wanted to learn what values can "padding" parameter be. I understand I can set it to zero ( 0 ) for disabling padding. This is not what I want because my plain text length is not confirmed  to be multiply of 16 bytes.<br></div><div><br></div><div>I can use PKCS#7 to decrypt on Windows so I would like to encrypt using that padding. Just do not know what value to pass in above function now.</div><div><br></div><div>Thanks & regards,</div><div>Ertan Küçükoğlu</div><div><br></div><div><br></div><div><br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Michael Wojcik <<a href="mailto:Michael.Wojcik@microfocus.com">Michael.Wojcik@microfocus.com</a>>, 28 Ara 2018 Cum, 21:16 tarihinde şunu yazdı:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> From: openssl-users [mailto:<a href="mailto:openssl-users-bounces@openssl.org" target="_blank">openssl-users-bounces@openssl.org</a>] On Behalf Of Ertan Küçükoglu<br>
> Sent: Thursday, December 27, 2018 16:03<br>
<br>
> A- I tried to directly decrypt (no padding applied) and I get my plain text plus<br>
> some additional invisible characters at the end. I am told it maybe a "padding"<br>
> issue, my problem, during decryption.<br>
<br>
How does the Windows program know how long the decrypted data is?<br>
<br>
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.<br>
<br>
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.<br>
<br>
--<br>
Michael Wojcik<br>
Distinguished Engineer, Micro Focus<br>
<br>
<br>
-- <br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</blockquote></div>