Hi Rudy, I added call when needed because EncryptUpdate can be called more than once, as long as EncryptFinal hasn't already been called. Once EncryptFinal has been called your saying you have all the data you expect for that iteration. So if your 292 bytes were coming in an iterations of N bytes you would just keep calling EncryptUpdate every N bytes once the final iteration came in you would finalize with EncryptFinal and move on to the next step in your code. By your codes description, and my example, each is only needed once since all the data is already there.
That make sense? Anthony On Jul 16, 2010, at 3:10 AM, Rudy1 wrote: > > Hello Anthony, > > thank you for you fast reply. I visited your blog and analyzed your example. > There is one > question left. You added the comment "Call when needed" to your function > EVP_EncryptUpdate(). > What does that mean? In my case I want to encrypt a string containing 292 > bytes. After calling > EVP_EncryptUpdate_ex() the variable out_len = 288. Do I have to call > EVP_EncryptUpdate_ex() again > to encrypt the remaining 4 bytes? I thought the remaining bytes will be > encrypted by calling EVP_EncryptFinal_ex() > > Rudy1 > > > Anthony Gabrielson-4 wrote: >> >> Hello, >> This seems to be a pretty typical question that gets posted often. I have >> a simple example that I think hits it. Anyway, its the first entry into a >> blog that I'm starting to building up. If your interested the code and (a >> brief) explanation is available here: >> >> http://agabrielson.wordpress.com/2010/07/15/openssl-an-example-from-the-command-line/#more-4 >> >> >> One note - I didn't use the ex function; I used the older version. It >> should give you a slightly easier place to start from. >> >> Anthony >> >> ----- Original Message ----- >> From: "Rudy1" <r...@compumatica.eu> >> To: openssl-users@openssl.org >> Sent: Thursday, July 15, 2010 5:37:38 AM >> Subject: AES128 CBC >> >> I'm using the openssl crypto lib first time and I don't know how to >> encrypt text larger than blocksize (16 byte) . For example I want to >> encrypt a string of size 292 bytes. I call EVP_EncryptUpdate () one time >> and 288 bytes will be encrypted and finally I call EVP_EncryptFinal_ex(). >> Do I really encrypt the whole string correctly? Or do I have to call >> EVP_EncryptUpdate () for every blocksize chunk of my string? How large is >> the encrypted string? I would expect 304 bytes (288 + 16). Is this >> correct? Rudy1 >> >> View this message in context: AES128 CBC >> Sent from the OpenSSL - User mailing list archive at Nabble.com. >> >> > > -- > View this message in context: > http://old.nabble.com/AES128-CBC-tp29170995p29180726.html > Sent from the OpenSSL - User mailing list archive at Nabble.com. > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager majord...@openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org