EVP_DecryptFinal_ex:bad decrypt

2009-02-16 Thread José Hidalgo C .
Hi i'm having problems with the function EVP_DecryptFinal_ex... i have the next code: #include stdio.h #include string.h #include libgen.h #include wchar.h #include sys/time.h #include openssl/pem.h #include openssl/sha.h #include openssl/hmac.h #include openssl/evp.h #include openssl/bio.h

RE: EVP_DecryptFinal_ex:bad decrypt

2009-02-16 Thread David Schwartz
When i use to encrypt data, i have not problems.. when i decrypt the result of this code, i have not problem... when i decrypt with this program, i have 13015:error:06065064:digital envelope routines: EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:461: The EVP_DecryptUpdate works ok, decrypt

RE: EVP_DecryptFinal_ex:bad decrypt

2009-02-16 Thread David Schwartz
buff = (char *)malloc(bptr-length); memcpy(buff, bptr-data, bptr-length-1); buff[bptr-length-1] = 0; Umm, you don't copy the last byte of data. You don't allocate enough space to hold the data and a terminator. This is probably your main error. How will 'buff' hold a C-style string when

RE: Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-22 Thread Gbenga Taylor
: Re: Help with EVP_DecryptFinal_ex:bad decrypt On Thu, Jan 15, 2009 at 02:45:49PM -0500, Adam Bender wrote: BUG: Don't pass the same buffer/offset to EncryptFinal_ex(), this clobbers the first encrypted block. Instead use sym_out_buf + out_total if the buffer is long enough for both

Re: Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-22 Thread Ger Hobbelt
the ciphertext? thanks -Original Message- From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Victor Duchovni Sent: Thursday, January 15, 2009 3:00 PM To: openssl-users@openssl.org Subject: Re: Help with EVP_DecryptFinal_ex:bad decrypt On Thu

Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-15 Thread Adam Bender
Hi, I'm trying to write simple AES encryption/decryption routines. I'm having trouble with the decryption routine, specifically, I get this error: 27013:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:461: I've included my code below; I compile it with: g++

Re: Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-15 Thread Victor Duchovni
On Wed, Jan 14, 2009 at 06:17:28PM -0500, Adam Bender wrote: if (!EVP_EncryptUpdate(ctx, sym_out_buf, out_total, (const unsigned char *) data, data_len)) { ERR_print_errors_fp(stdout); } if (!EVP_EncryptFinal_ex(ctx, sym_out_buf, out_len)) { ERR_print_errors_fp(stdout); } BUG: Don't

Re: Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-15 Thread Adam Bender
On Thu, Jan 15, 2009 at 2:29 PM, Victor Duchovni victor.ducho...@morganstanley.com wrote: On Wed, Jan 14, 2009 at 06:17:28PM -0500, Adam Bender wrote: if (!EVP_EncryptUpdate(ctx, sym_out_buf, out_total, (const unsigned char *) data, data_len)) { ERR_print_errors_fp(stdout); }

Re: Help with EVP_DecryptFinal_ex:bad decrypt

2009-01-15 Thread Victor Duchovni
On Thu, Jan 15, 2009 at 02:45:49PM -0500, Adam Bender wrote: BUG: Don't pass the same buffer/offset to EncryptFinal_ex(), this clobbers the first encrypted block. Instead use sym_out_buf + out_total if the buffer is long enough for both the original ciphertext and the final block.

RE: Reposting: EVP_DecryptFinal_ex:bad decrypt

2007-11-21 Thread Pankaj Mathur
After doing this I could encrypt / decrypt upto 7 KB only. The code fails after 7 KB. Please help. thanks From: [EMAIL PROTECTED] To: openssl-users@openssl.org Subject: RE: Reposting: EVP_DecryptFinal_ex:bad decrypt Date: Wed, 21 Nov 2007 01:32:12 + Thanks for the response Dr

RE: Reposting: EVP_DecryptFinal_ex:bad decrypt

2007-11-20 Thread Pankaj Mathur
Subject: Re: Reposting: EVP_DecryptFinal_ex:bad decrypt On Mon, Nov 19, 2007, Pankaj Mathur wrote: I am still struggling with this issue. I did not get much help from the list, so I am reposting again. if(!EVP_EncryptUpdate(ctx,pBuff[currentLength

Reposting: EVP_DecryptFinal_ex:bad decrypt

2007-11-19 Thread Pankaj Mathur
I am still struggling with this issue. I did not get much help from the list, so I am reposting again. Thanks! From: [EMAIL PROTECTED] To: openssl-users@openssl.org Subject: EVP_DecryptFinal_ex:bad decrypt Date: Fri, 9 Nov 2007 22:33:52 + Hi , I am trying to encrypt and decrypt

Re: Reposting: EVP_DecryptFinal_ex:bad decrypt

2007-11-19 Thread Dr. Stephen Henson
On Mon, Nov 19, 2007, Pankaj Mathur wrote: I am still struggling with this issue. I did not get much help from the list, so I am reposting again. if(!EVP_EncryptUpdate(ctx,pBuff[currentLength], datalength,

Re: EVP_DecryptFinal_ex:bad decrypt

2007-11-10 Thread Harald Latzko
Hello Pankaj, Am 09.11.2007 um 23:33 schrieb Pankaj Mathur: Hi , I am trying to encrypt and decrypt a large file using the Openssl API. I am doing this by calling EVP_EncryptUpdate / EVP_DecryptUpdate iteratively for a block size of 1024 and then calling the EVP_EncryptFinal_ex/

EVP_DecryptFinal_ex:bad decrypt

2007-11-09 Thread Pankaj Mathur
Hi , I am trying to encrypt and decrypt a large file using the Openssl API. I am doing this by calling EVP_EncryptUpdate / EVP_DecryptUpdate iteratively for a block size of 1024 and then calling the EVP_EncryptFinal_ex/ EVP_DecryptFinal_ex respectively in the end. It always fails to decrypt

EVP_DecryptFinal_ex:bad decrypt

2007-11-09 Thread Pankaj Mathur
Hi , I am trying to encrypt and decrypt a large file using the Openssl API. I am doing this by calling EVP_EncryptUpdate / EVP_DecryptUpdate iteratively for a block size of 1024 and then calling the EVP_EncryptFinal_ex/ EVP_DecryptFinal_ex respectively in the end. It always fails to decrypt