AES decrypting in Python

Stef Mientki stef.mientki at gmail.com
Thu Oct 8 01:32:38 CEST 2009


Heikki Toivonen wrote:
> Mike Driscoll wrote:
>   
>> EVP.Cipher(alg="aes_256_ecb", key=SomeKey, iv=SomeIV, op=dec,
>> padding=False)
>>
>> I don't really see where I pass the data that needs the decrypting
>> though. Can someone shed some light on this?
>>     
>
> Look at test_AES method in
> http://svn.osafoundation.org/m2crypto/trunk/tests/test_evp.py
>
> Basically EVP.Cipher returns the cipher object. You call the update
> update(data) method on it (you can call this many times if you have lots
> of data), which returns (possibly partial) result and finally call the
> final() method to finish, which will return the last piece of the
> decrypted data.
>
> You might also want to take a look at m2secret[1] which is a small
> library/utility built on top of M2Crypto to encrypt/decrypt stuff. By
> default it uses AES.
>
> [1] http://www.heikkitoivonen.net/m2secret/
>
>   
thanks Heikki,
finally some encryption / decryption tool that can be used by 
non-crypto-maniaks.

cheers,
Stef



More information about the Python-list mailing list