Hi again,

>  Hi,****
>
> ** **
>
> Thanks for your reply.****
>
> ** **
>
> I am aware of CipherFinal() but I wonder why CipherUpdate() writes
> anything into the final buffer at all if the buffer size is a multiple of
> the padding size.
>
>
>
It looks a bit strange. The CipherUpdate() should implement a symmetric
block cipher. Thus, the CipherUpdate() should write anything into the final
buffer if the buffer size is multiple of the block size. If don't, the
CipherFinal() will encrypt the exceeding bytes.


> Additionally CipherFinal() fails if I call it afterwards.
>
>
>
Consider that I'm only a beginner OpenSSL user, anyway, I suggest to use
the EVP_EncryptUpdate() and the EVP_EncryptFinal_ex(), they worked fine for
me.

>
>

>
> ** **
>
> The documentation says “as a result the amount of data written may be
> anything from zero bytes to (inl + cipher_block_size - 1)”. From that I
> take it that usually the final buffer should only contain data of the size
> “cipher_block_size – 1” which is not the case with the described behaviour.
> ****
>
> ** **
>
> Cheers****
>
> Nico****
>
> **
>
>
>
Cheers

Andrea

>
>  ------------------------------
>
> *Von:* [email protected] [mailto:
> [email protected]] *Im Auftrag von *Andrea Saracino
> *Gesendet:* Freitag, 2. Dezember 2011 00:31
> *An:* [email protected]
> *Betreff:* Re: Decrypted buffer padding****
>
> ** **
>
> Hi, ****
>
> after you use the EVP_CipherUpdate(), you have to call the
> EVP_CipherFinal() to encrypt the remaining bytes. Refer to the
> documentation to see how to correctly pass the parameters:
> http://www.openssl.org/docs/crypto/EVP_EncryptInit.html. The same goes
> for the decryption. ****
>
>  ****
>
> I hope this help.****
>
>  ****
>
> Cheers.****
>
>  ****
>
> Andrea****
>
> Il giorno 01 dicembre 2011 12:31, Nico Flink <[email protected]> ha scritto:
> ****
>
> Hello,****
>
>  ****
>
> I am trying to decrypt a buffer whose size is a multiple of the padding
> size (n * 16 bytes). But instead of getting the whole buffer as a result
> from EVP_CipherUpdate() I only get “InSize – PaddingSize” decrypted bytes.
> I get this behaviour with padding enabled and disabled. Is this the correct
> behaviour and is there anything I can do about it? In my application I need
> the insize to equal the outsize.****
>
>  ****
>
> Thanks a lot for your help.****
>
>  ****
>
> Cheers****
>
> Nico****
>
>  ****
>
> ** **
>

Reply via email to