[pycrypto] AES decrypting issues

Mike Driscoll mdriscoll at co.marshall.ia.us
Wed Oct 7 12:54:58 CST 2009


Hi Luke,
> Does it decrypt with the PHP example?
>   

I asked my colleague and he doesn't use that decrypt method...he just 
uses the encrypt one.

> You might try encrypting/decrypting an example with Python, then
> decrypting the encrypted example with PHP to make sure you have the
> right configuration settings.
>
> It's also possible that the data was corrupted. Is there any kind of
> integrity check for the file?
>   

I don't think so.

> Luke
>   

My guess is that either I'm doing something stupid or the encryption is 
screwed up.

- Mike

> Mike Driscoll wrote:
>   
>> Hi,
>>
>> I am working on a project where I need to decrypt some data that has
>> been encrypted with AES. Our webmaster gave me a PHP example that he 
>> uses, but I'm supposed to use Python. Here's the PHP code:
>>
>> $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
>> $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
>> return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key,
>> $data,MCRYPT_MODE_ECB, $iv),"\0");
>>
>> I've been told on c.l.py that the iv in this case should be 16 bytes.
>>
>> I tried following the example on this blog by modifying it as needed:
>>
>> http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/
>>
>> But no matter which base64 decode method I use, I get some kind of 
>> error: b32decode, b64decode and decodestring all return a padding error 
>> whereas b16decode claims that I don't have only 16-bit characters in my 
>> data string.
>>
>> I've never done this before, so I'm not sure where I'm going wrong. Any 
>> advice would be appreciated. I'm on Windows XP with Python 2.5.
>>
>> Thanks,
>>
>> Mike
>>
>> _______________________________________________
>> pycrypto mailing list
>> pycrypto at lists.dlitz.net
>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>
>>   
>>     
>
>   



More information about the pycrypto mailing list