Christina Penn wrote:

> Hello David,
 
> Can you show me exactly how to break up my example code to make my example
work?

It's really simple. When you want to decrypt a message, call
EVP_DecryptInit_ex. For each chunk of data you want to decrypt that is part
of the message, call EVP_DecryptUpdate. For the last block (or after it),
call EVP_DecryptFinal_ex.

> I tried removing the EVP_DecryptFinal_ex from my DecryptMessage function
and
> just seeing if the first part would just decrypt the first 7 bytes, but it
got
> thrown into my catch statement. I am really confused.

I'm not sure what you mean. That should have worked. (Note that zero bytes
coming out *is* working. You are not guaranteed that any particular number
of input bytes will produce any particular number of output bytes except
that all of the input will, of course, produce all of the output. If you
want a stream cipher, you know where to find them.)

By the way, I strongly advise you not to use the C++ 'string' class for
arbitrary chunks of bytes. It's really not suitable.

DS

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to