Hi I used the real key and IV now ,
But there is some problem in decrypting firat 16 bytes....can you tell why
is this happening...
the first 16 bytes are read properly but not gettin g decrypted??What could
be reason for this?
because of this my code is returning an error in decrypt final..
Thanks for info in advance.
Christian Hohnstaedt wrote:
>
> 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 [email protected]
> Automated List Manager [email protected]
>
>
--
View this message in context:
http://old.nabble.com/help-me-decrypting-a-binary-file-which-is-encrypted-by-aes-256-cbc-mode-tp26387750p26408343.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]