Re: AES128 CBC

2010-07-20 Thread Rudy1

Hi Anthony,

that makes definitely sense for me. I encrypt data from pdf so I got the
whole 292 bytes at one go.

Thank you for your patience!
Rudy



Anthony Gabrielson-4 wrote:
> 
> 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"  
>>> 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 Listopenssl-users@openssl.org
>> Automated List Manager   majord...@openssl.org
> 
> __
> OpenSSL Project http://www.openssl.org
> User Support Mailing Listopenssl-users@openssl.org
> Automated List Manager   majord...@openssl.org
> 
> 

-- 
View this message in context: 
http://old.nabble.com/AES128-CBC-tp29170995p29217239.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

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


Re: AES128 CBC

2010-07-16 Thread Michael S. Zick
On Thu July 15 2010, Anthony Gabrielson wrote:
> 
> On Jul 15, 2010, at 6:18 PM, Michael S. Zick wrote:
> 
> > Interesting blog.
> > 
> > One quick question on the first linked-to source at the top:
> > quote
> >memset(plaintext,0,sizeof(plaintext));
> >in_len = strlen(ciphertext);
> > end-quote
> > 
> > How did you get strlen to ignore any embedded zeros in the ciphertext?
> > 
> > Mike
> 
> Hi Mike - that was a good catch.  I wrote the code quickly and moved on to my 
> objective - and that was a mistake.  Anyway, I updated the code and made the 
> necessary updates.  Thanks for pointing that out, I appreciate it.

I understand since I write a lot for my own site and wish people would point 
out the oopses.
That page you linked to that explains the acronyms bares repeating from time to 
time. Good article.

Mike
> 
> Anthony__
> OpenSSL Project http://www.openssl.org
> User Support Mailing Listopenssl-users@openssl.org
> Automated List Manager   majord...@openssl.org
> 
> 


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


Re: AES128 CBC

2010-07-16 Thread Anthony Gabrielson
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"  
>> 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 Listopenssl-users@openssl.org
> Automated List Manager   majord...@openssl.org

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


Re: AES128 CBC

2010-07-16 Thread Rudy1

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"  
> 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 Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: AES128 CBC

2010-07-15 Thread Anthony Gabrielson

On Jul 15, 2010, at 6:18 PM, Michael S. Zick wrote:

> Interesting blog.
> 
> One quick question on the first linked-to source at the top:
> quote
>memset(plaintext,0,sizeof(plaintext));
>in_len = strlen(ciphertext);
> end-quote
> 
> How did you get strlen to ignore any embedded zeros in the ciphertext?
> 
> Mike

Hi Mike - that was a good catch.  I wrote the code quickly and moved on to my 
objective - and that was a mistake.  Anyway, I updated the code and made the 
necessary updates.  Thanks for pointing that out, I appreciate it.

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


Re: AES128 CBC

2010-07-15 Thread Michael S. Zick
On Thu July 15 2010, Anthony Gabrielson 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
>  
> 

Interesting blog.

One quick question on the first linked-to source at the top:
quote
memset(plaintext,0,sizeof(plaintext));
in_len = strlen(ciphertext);
end-quote

How did you get strlen to ignore any embedded zeros in the ciphertext?

Mike
> 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"  
> 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. 
> 


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


Re: AES128 CBC

2010-07-15 Thread Anthony Gabrielson
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"  
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.