views:

1069

answers:

3

Can someone provide me code to encrypt / decrypt using m2crypto aes256 CBC using Python

A: 

When it comes to security nothing beats reading the documentation.

http://chandlerproject.org/bin/view/Projects/MeTooCrypto

Even if I took the time to understand and make the perfect code for you to copy and paste, you would have no idea if I did a good job or not. Not very helpful I know, but I wish you luck and secure data.

That link is no longer valid.
Daryl Spitzer
+2  A: 

M2Crypto's documentation is terrible. Sometimes the OpenSSL documentation (m2crypto wraps OpenSSL) can help. Your best bet is to look at the M2Crypto unit tests -- http://svn.osafoundation.org/m2crypto/trunk/tests/test_evp.py -- look for the test_AES() method.

joeforker
+1... joe, this answer was much appreciated today while I was working on a pet project. I was beginning to think I was nuts when looking at the M2Crypto docs and, um, sparsely commented epydoc API; surely, I was missing something obvious! Thanks for restoring my faith.
Jarret Hardie
+1  A: 

Take a look at m2secret:

Small utility and module for encrypting and decrypting data using symmetric-key algorithms. By default uses 256-bit AES (Rijndael) using CBC, but some options are configurable. PBKDF2 algorithm used to derive key from password.

RSabet