Hi, you used the ASCII representation of the key, instead of the real key. Same with iv.
On Tue, Nov 17, 2009 at 02:43:48AM -0800, NaGaGo wrote: > > Hai > this is the openssl shell command i'm using to decrypt a binary file... > openssl enc -d -K > 3834373532303435333730323834383132373330393233343531323330383839 -iv > 36363333383630393433313132323031 -aes-256-cbc-in final2.bin -out test.zip > As my target doesnot support openssl commd i was asked to write decryption > code using some API's and create a binary ...so I decided to write it using > AES API's > Here is my code please tell me where I went wrong...thanks in advance. > int main() > { > > unsigned long lSize; > FILE * inFile; > FILE * outFile; > size_t n,m; > char * pTemp; > char * buffer; > const AES_KEY *key; > inFile = fopen("SB2.bin", "rb"); > outFile = fopen("finalPackResult", "wb+"); > > unsigned char uKey[]= > "3834373532303435333730323834383132373330393233343531323330383839"; unsigned char uKey[]= "84752045370284812730923451230889"; > unsigned char iv[] = "36363333383630393433313132323031"; unsigned char iv[] = "6633860943112201"; > /* get file size and allocate memory to buffer */ > fseek (inFile , 0,SEEK_END); > lSize = ftell (inFile); > rewind (inFile); Maybe: struct stat st; fstat(fileno(inFile), &st); lSize = st.st_size; is saner than bouncing the filepos ? Christian ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org