Hi christian,
Thank you very much for your help...I was thinking the same but I already
tried with real key...
and even I changed the code for getting the file size also but yet my
program didn't give me correct out put...
The problem actually is the files which i'm getting when I decrypt the bin
file through shell can be unzipped to get some result files whereas my code
i'm getting a output file i'm not able to unzip it properly ..can you help
regarding this issue..
thanks 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                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
> 
> 

-- 
View this message in context: 
http://old.nabble.com/help-me-decrypting-a-binary-file-which-is-encrypted-by-aes-256-cbc-mode-tp26387750p26402609.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to