Re: How to do encryption using AES in Openssl

2012-03-30 Thread Ben Laurie
On Thu, Mar 29, 2012 at 5:40 AM, Prashanth kumar N prashanth.kuma...@gmail.com wrote: Thanks Ken for pointing out the mistake... after changing to AES_Decrypt(), it worked but i still see issue when i print the decrypted output as it has extra non-ascii characters in it. Below is the input

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Dr. Stephen Henson
On Thu, Mar 29, 2012, Prashanth kumar N wrote: Thanks Marek. I will try the attached code in the attached files. In many of the examples i have come across, i see IV is always being. Is it not possible to use this API by setting IV to NULL? (As i understand for CBC IV is a must) . In

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Ken Goldman
On 3/29/2012 1:40 AM, Prashanth kumar N wrote: Thanks Ken for pointing out the mistake... after changing to AES_Decrypt(), it worked but i still see issue when i print the decrypted output as it has extra non-ascii characters in it. That's what happens in C if you try to printf an array

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Prashanth kumar N
Stephen, Does it mean we can't use AES without IV ? As per XTS support in Openssl, i find the following function but don't see any implementation for the same AES_xts_encrypt(). I found the below link form which what i understand is new file called e_aes_xts.c should be present... am i missing

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Prashanth kumar N
Bit confusing... are you saying that i need to add NULL termination at the end of encrypted data? Isn't this wrong? I assume i shouldn't be NULL terminating the input string which needs to be encrypted. On Thu, Mar 29, 2012 at 7:10 PM, Ken Goldman kgold...@us.ibm.com wrote: On 3/29/2012 1:40

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Marek . Marcola
-openssl-us...@openssl.org 03/29/2012 04:03 PM Please respond to openssl-users@openssl.org To openssl-users@openssl.org cc Subject Re: How to do encryption using AES in Openssl Bit confusing... are you saying that i need to add NULL termination at the end of encrypted data

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Prashanth kumar N
respond to openssl-users@openssl.org To openssl-users@openssl.org cc Subject Re: How to do encryption using AES in Openssl Bit confusing... are you saying that i need to add NULL termination at the end of encrypted data? Isn't this wrong? I assume i shouldn't be NULL

Re: How to do encryption using AES in Openssl

2012-03-29 Thread Dr. Stephen Henson
On Thu, Mar 29, 2012, Prashanth kumar N wrote: Thanks Marek. If i select CBC mode encryption and i have data which is not aligned to block, i assume padding will be taken by the API's itself. Only if you use EVP. For low level APIs you have to manually add and remove padding. Steve. -- Dr

RE: How to do encryption using AES in Openssl

2012-03-29 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Prashanth kumar N Sent: Thursday, 29 March, 2012 10:02 Bit confusing... are you saying that i need to add NULL termination at the end of encrypted data? Isn't this wrong? I assume i shouldn't be NULL terminating the

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Prashanth kumar N
Here is the modified program #include stdio.h 2 #include openssl/aes.h 3 4 static const unsigned char key[] = { 5 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 6 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 7 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 8

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Prashanth kumar N
I tried to use EVP but let if of go due to bad documentation... On Wed, Mar 28, 2012 at 2:49 AM, Jakob Bohm jb-open...@wisemo.com wrote: On 3/27/2012 10:42 PM, Jeffrey Walton wrote: On Tue, Mar 27, 2012 at 4:26 PM, Ken Goldmankgold...@us.ibm.com wrote: On 3/27/2012 3:51 PM, Jakob Bohm

Re: How to do encryption using AES in Openssl

2012-03-28 Thread nudge
As an independent follower of this list, I'd just like say that even if the documentation has its critics, the support provided here is incredibly good ! On Wed, Mar 28, 2012, at 12:32 PM, Prashanth kumar N wrote: I tried to use EVP but let if of go due to bad documentation... On Wed, Mar

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Prashanth kumar N
I agree with this as it has made many life's easy ... On Wed, Mar 28, 2012 at 12:48 PM, nudge nudge...@fastmail.fm wrote: As an independent follower of this list, I'd just like say that even if the documentation has its critics, the support provided here is incredibly good ! On Wed, Mar

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Ken Goldman
On 3/28/2012 3:01 AM, Prashanth kumar N wrote: Here is the modified program [snip] 18 AES_KEY ectx; 19 AES_KEY dectx; 20 21 AES_set_encrypt_key(key, 256, ectx); 22 AES_encrypt(text, out, ectx); 23 24 printf(encryp data = %s\n, out); 25 26

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Marek . Marcola
-us...@openssl.org 03/28/2012 09:03 AM Please respond to openssl-users@openssl.org To openssl-users@openssl.org cc Subject Re: How to do encryption using AES in Openssl Here is the modified program #include stdio.h 2 #include openssl/aes.h 3 4 static const

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Ken Goldman
I agree with you in general. I assumed the OP was just experimenting. I use the raw AES_encrypt() because the standard I'm complying to uses a non-standard counter mode. I had to construct it from scratch. On 3/28/2012 10:56 AM, Marek.Marcola- wrote: If you want to use low-level AES

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Ben Laurie
On Tue, Mar 27, 2012 at 8:26 PM, Ken Goldman kgold...@us.ibm.com wrote: On 3/27/2012 3:51 PM, Jakob Bohm wrote: On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: You should really be using EVP instead of the low level routines. They are well documented with examples. Where, precisely? I

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Marek . Marcola
Sent by: owner-openssl-us...@openssl.org 03/28/2012 09:06 AM Please respond to openssl-users@openssl.org To openssl-users@openssl.org cc Subject Re: How to do encryption using AES in Openssl I tried to use EVP but let if of go due to bad documentation... On Wed, Mar 28, 2012

RE: How to do encryption using AES in Openssl

2012-03-28 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Prashanth kumar N Sent: Wednesday, 28 March, 2012 03:01 snip code; already answered As i read min AES block size is 128 bits which can go up to 256 bits in multiples of 32-bits. Is this correct? No but almost. The

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Prashanth kumar N
Thanks Ken for pointing out the mistake... after changing to AES_Decrypt(), it worked but i still see issue when i print the decrypted output as it has extra non-ascii characters in it. Below is the input unsigned char text[]=test12345678abc2; After decryption, i get the following string:

Re: How to do encryption using AES in Openssl

2012-03-28 Thread Prashanth kumar N
/2012 09:01:25 AM: Prashanth kumar N prashanth.kuma...@gmail.com Sent by: owner-openssl-us...@openssl.org 03/28/2012 09:03 AM Please respond to openssl-users@openssl.org To openssl-users@openssl.org cc Subject Re: How to do encryption using AES in Openssl Here

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Ken Goldman
On 3/27/2012 1:33 PM, pkumarn wrote: I am trying to write a sample program to do AES encryption using Openssl. I tried going through Openssl documentation( it's a pain), could not figure out much. I went through the code and found the API's using which i wrote a small program as below (please

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Dr. Stephen Henson
On Tue, Mar 27, 2012, pkumarn wrote: I am trying to write a sample program to do AES encryption using Openssl. I tried going through Openssl documentation( it's a pain), could not figure out much. I went through the code and found the API's using which i wrote a small program as below

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Jakob Bohm
On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: On Tue, Mar 27, 2012, pkumarn wrote: I am trying to write a sample program to do AES encryption using Openssl. I tried going through Openssl documentation( it's a pain), could not figure out much. I went through the code and found the API's using

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Ken Goldman
On 3/27/2012 3:51 PM, Jakob Bohm wrote: On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: You should really be using EVP instead of the low level routines. They are well documented with examples. Where, precisely? I didn't find it either when I was looking a few years ago, so I settled on the

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Jeffrey Walton
On Tue, Mar 27, 2012 at 4:26 PM, Ken Goldman kgold...@us.ibm.com wrote: On 3/27/2012 3:51 PM, Jakob Bohm wrote: On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: You should really be using EVP instead of the low level routines. They are well documented with examples. Where, precisely? I

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Jakob Bohm
On 3/27/2012 10:42 PM, Jeffrey Walton wrote: On Tue, Mar 27, 2012 at 4:26 PM, Ken Goldmankgold...@us.ibm.com wrote: On 3/27/2012 3:51 PM, Jakob Bohm wrote: On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: You should really be using EVP instead of the low level routines. They are well

Re: How to do encryption using AES in Openssl

2012-03-27 Thread Jeffrey Walton
On Tue, Mar 27, 2012 at 5:19 PM, Jakob Bohm jb-open...@wisemo.com wrote: On 3/27/2012 10:42 PM, Jeffrey Walton wrote: On Tue, Mar 27, 2012 at 4:26 PM, Ken Goldmankgold...@us.ibm.com  wrote: On 3/27/2012 3:51 PM, Jakob Bohm wrote: On 3/27/2012 9:37 PM, Dr. Stephen Henson wrote: You should