[pycrypto] AES decrypting issues
mdriscoll at co.marshall.ia.us
Wed Oct 7 12:54:58 CST 2009
> 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.
My guess is that either I'm doing something stupid or the encryption is
> Mike Driscoll wrote:
>> 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:
>> 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.
>> pycrypto mailing list
>> pycrypto at lists.dlitz.net
More information about the pycrypto