Re: AES 256 EVP APIs for encrypting files

2013-04-25 Thread Taraniteja Vishwanatha
Thank you Matt and Dave. Matt, Yes I agree that I should be calling EncryptInit and EncryptFinal only once. That is one of the mistakes. The reason why I did that was, I am exposing a encryption API to other functions in the project. They dont care how encryption is done. They have a buffer ( usu

RE: AES 256 EVP APIs for encrypting files

2013-04-25 Thread Dave Thompson
>From: owner-openssl-us...@openssl.org On Behalf Of Taraniteja Vishwanatha >Sent: Thursday, 25 April, 2013 16:43 >I was using the low level aes APIs and now have switched to EVP ones. >My string encryption and decryption always work fine. But when it comes >to files, I am getting malloc errors:

Re: AES 256 EVP APIs for encrypting files

2013-04-25 Thread Matt Caswell
On 25 April 2013 21:42, Taraniteja Vishwanatha wrote: > Hey guys, > > I was using the low level aes APIs and now have switched to EVP ones. My Good. That is (in most cases) the correct approach. > string encryption and decryption always work fine. But when it comes to > files, I am getting mall

Re: AES-256 using CTR mode.

2013-01-16 Thread Matt Caswell
No, as far as I know, there is no support for OCB. For the documentation on which modes are supported check evp.h!!! :-) Matt On 16 January 2013 02:57, Rohit Bansal wrote: > Thanks Matt. > > On that note, do we have support for OCB mode in openssl. Where can i find > the documentation for all

Re: AES-256 using CTR mode.

2013-01-15 Thread Rohit Bansal
Thanks Matt. On that note, do we have support for OCB mode in openssl. Where can i find the documentation for all the modes supported by openssl?? Regards, Rohit Bansal On Mon, Jan 14, 2013 at 1:16 PM, Matt Caswell wrote: > The EVP API is documented here: > https://www.openssl.org/docs/crypto

Re: AES-256 using CTR mode.

2013-01-14 Thread Matt Caswell
The EVP API is documented here: https://www.openssl.org/docs/crypto/EVP_EncryptInit.html# There is some example code there too. It doesn't use AES or CTR, but the principle is the same. Just replace EVP_bf_cbc() with EVP_aes_256_ctr(), and ensure you use an appropriately sized key and IV. Matt

Re: AES-256 using CTR mode.

2013-01-14 Thread Rohit Bansal
Thanks Matt. Is there a sample code i can look into? In my case the key is unique across different messages, so having same IV across messages should not lead me into problem Thanks, Rohit Bansal On Mon, Jan 14, 2013 at 12:22 PM, Matt Caswell wrote: > Yes, you can use CTR mode for AES-256: us

Re: AES-256 using CTR mode.

2013-01-14 Thread Matt Caswell
Yes, you can use CTR mode for AES-256: use the EVP interface with the EVP_CIPHER of EVP_aes_256_ctr(). However it is a fundamental requirement of CTR mode that the IV must be unique across messages. If you reuse the IV then your messages can be broken quite trivially. Therefore, if by a fixed IV,

Re: AES-256 Implementation and OpenSSL

2012-04-03 Thread Jakob Bohm
On 4/2/2012 5:09 PM, Theodore Tolstoy wrote: Hi! There is a widely known and used AES implementation in C by "Niyaz PK" for encryption/decryption: http://www.hoozi.com/posts/advanced-encryption-standard-aes-implementation-in-cc-with-comments-part-1-encryption/ . It seems to implement AES-{128,1

Re: AES-256 Implementation and OpenSSL

2012-04-02 Thread Wim Lewis
On 2 Apr 2012, at 8:09 AM, Theodore Tolstoy wrote: > It seems to implement AES-{128,192,256} ECB mode of > encryption/decryption(?). Am I wrong? > > Is it possible to use OpenSSL to achieve equivalent results? Yes. The low-level openssl AES implementation (AES_ecb_encrypt(), etc.) is available

Re: AES-256 Implementation and OpenSSL

2012-04-02 Thread Marek . Marcola
Hello, This is standard AES implementation based on FIPS 197 ("standard" means also "slow"). OpenSSL daes not have such implementation, OpenSSL have optimized AES implementation based on function AES_encrypt() which far more faster then standard implementation. Standard implementation is good for

RE: AES-256 CBC encrypt/decrypt usage problem

2010-05-25 Thread David Schwartz
Kunal Sharma wrote: >What I see happening is this: >ENCRYPT - size of /etc/rgconf on disk is 157043 bytes >ENCRYPT - size of /etc/rgconf_encrypted on disk is 157044 bytes. >BROWSER saves the file to disk - size is 136 bytes (How ???) You called 'strlen' on something that was not a string, so it

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-25 Thread ~ Kunal Sharma ~
Friends, I was able to resolve the problem with my web application not able to read the entire contents of encrypted file. Now my encryption and decryption is working ok. Thanks for all the help. Kunal On Sat, May 22, 2010 at 12:34 AM, ~ Kunal Sharma ~ wrote: > Ok friends. I'm back after tryi

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-21 Thread ~ Kunal Sharma ~
Ok friends. I'm back after trying out EVP stuff. Here's my code: DECRYPT int wfd; if((wfd = creat("/etc/rgconf_encrypted",0644)) == -1) { console_printf("Couldn't open output file for writingn"); }else{ console_printf("\nuser input encrypted file len

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-21 Thread ~ Kunal Sharma ~
Thanks Jeff, Carter. I'm in the process of trying out EVP routines to do my stuff now. Will post an update once I'm done. Thanks again for your time. - Kunal On Fri, May 21, 2010 at 5:55 PM, Carter Browne wrote: > Kunal, > > If your data can include NULs, you should not use strlen to calculat

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-21 Thread Carter Browne
Kunal, If your data can include NULs, you should not use strlen to calculate the length of the buffer, you need to provide the length in some other way - in your example presumably as an additional parameter. Carter Carter Browne CBCS cbro...@cbcs-usa.com 781-721-2890 On 5/21/2010 2:30 AM, ~ K

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-21 Thread Jeffrey Walton
Hi Kunal, > I was also wondering about the cipher block size. I was thinking > of using 16 as block size, read the input ... You have no choice. AES is a 16-byte block cipher. Using the EVP_* functions is easier. Jeff On Fri, May 21, 2010 at 2:30 AM, ~ Kunal Sharma ~ wrote: > David, > Thanks f

Re: AES-256 CBC encrypt/decrypt usage problem

2010-05-20 Thread ~ Kunal Sharma ~
David, Thanks for taking out time to review my code and reply. 1) I agree that using sizeof was a blunder on my part. 2) I'm calling decode2 with rg_conf_buf_dup and rg_conf_buf_dup_2, second one being the output buffer. So I'm certain that I don't modify the input buffer (though I just zero out

RE: AES-256 CBC encrypt/decrypt usage problem

2010-05-20 Thread David Schwartz
Kunal Sharma wrote: void encode2(char *inbuf,char *outbuf) { unsigned char key32[] = "As different as chalk and cheese"; unsigned char iv[] = "As dark as pitch"; AES_KEY aeskey; memset(outbuf, 0, sizeof(outbuf)); AES_set_encrypt_key(key32, 32*8,

Re: AES-256 APIs

2009-06-24 Thread Dr. Stephen Henson
On Wed, Jun 24, 2009, Gaurav Shah wrote: > Hi All, > I am kind of novice to cryptography and presently trying to develope my > own Encryption/Decryption library. Many ppl suggested me to use AES-256 > algo for Encryption/Decryption. However, I do not find any documentation > about OpenSSL that

RE: Aes-256 /testing of AES_cbc_encrypt

2006-09-06 Thread Bhat, Jayalakshmi Manjunath
Thank you very much for the quick reply. Regards, Jaya. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marek Marcola Sent: Wednesday, September 06, 2006 3:31 PM To: openssl-users@openssl.org Subject: RE: Aes-256 /testing of AES_cbc_encrypt Hello

RE: Aes-256 /testing of AES_cbc_encrypt

2006-09-06 Thread Marek Marcola
Hello, > > I went through FIPS-197 for AES. Now if I want to test > void AES_cbc_encrypt(const unsigned char *in, unsigned > char *out, >const unsigned long length, const AES_KEY *key, >unsigned char *ivec, const int enc) function. >

RE: Aes-256 /testing of AES_cbc_encrypt

2006-09-06 Thread Bhat, Jayalakshmi Manjunath
. How should I test this function? Regards, Jaya. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marek Marcola Sent: Monday, September 04, 2006 4:51 PM To: openssl-users@openssl.org Subject: Re: Aes-256 Hello, > I want to test AES-256 encryption

RE: Aes-256

2006-09-04 Thread Bhat, Jayalakshmi Manjunath
Hi, Thanks a lot for the timely help. Regards, Jaya -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marek Marcola Sent: Monday, September 04, 2006 4:51 PM To: openssl-users@openssl.org Subject: Re: Aes-256 Hello, > I want to test AES-

Re: Aes-256

2006-09-04 Thread Marek Marcola
Hello, > I want to test AES-256 encryption and decryption. And also SH-512 > hashing functionality in > SSL. Pls can any one tell me how do I do it? If you want to check correctness of your implementation/OpenSSL API you may download FIPS-197 (for AES) and FIPS-180 (for SHA1/256/384/512) and