[pycrypto] AES decrypting issues

Luke Teyssier luke at cryptography.com
Wed Oct 7 11:09:12 CST 2009


Does it decrypt with the PHP example?

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?

Luke

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
>
>   

-- 
Luke Teyssier
Senior Staff Engineer
Cryptography Research, Inc.
575 Market St., 11th Floor
San Francisco, CA 94105
(415) 397-0123 x330 Direct
http://www.cryptography.com



More information about the pycrypto mailing list