views:

5373

answers:

4

I am looking for a (preferably pure) python library to do AES 256 encryption and decryption.

This library should support the CBC cipher mode and use PKCS7 padding according to the answer to an earlier question of mine.

The library should at least work on Mac OS X (10.4) and Windows XP. Ideally just by dropping it into the source directory of my project. I have seen this by Josh Davis, but am not sure about how good it is and if it does the required CBC cipher mode... Scanning the source suggests it doesn't

+8  A: 

PyCrypto should be the one for you.

friol
There is also a wrapper called ezPyCrypto. Alas, both are in a sad state, as PyCrypto is currently switching maintainers and the new guy won't release.
Daren Thomas
PyCrypto has since had a release 2.1.0.
Craig McQueen
+3  A: 

How about ncrypt? It's not pure python but it is a lot faster as a result. It is basically a nice python wrapper on OpenSSL, so you know there's quality code behind it.

Dan
+3  A: 

PyCrypto is not clearly pythonic so you can get troubles compiling it on some platforms (AIX, HP-UX etc)

Denis Barmenkov
+3  A: 

Since I found this question when searching for the same thing I would like to add another one to the list:

SlowAEShttp://code.google.com/p/slowaes/
It's a development of Josh Davis' code, with the help of some other people. It seems to work fine.

Blixt