Python and PHP encryption/decryption

Piet van Oostrum piet at cs.uu.nl
Fri Aug 21 13:36:00 EDT 2009


>>>>> "Diez B. Roggisch" <deets at nospam.web.de> (DBR) wrote:

>DBR> Jean-Claude Neveu schrieb:
>>> I'm looking for a recommendation about encryption/decryption packages for
>>> Python.
>>> 
>>> I'm working on a project that will require me to store some values in a
>>> database in encrypted format. I'll be storing them from a PHP script and
>>> retrieving them (decrypting them) using Python. I'm currently using PHP's
>>> mcrypt package to encrypt the values, and I'm using AES for encryption,
>>> so something AES-compatible would be ideal. However, the project is at
>>> the development stage so I can easily change how I'm encrypting things in
>>> PHP if there is a compelling reason on the Python side of things to do
>>> so.

>DBR> With PyCrypto[1] you have a wide range of choices, amongst others AES.

>DBR> If that's the best algorithm, or even the best python-package to implement
>DBR> it, I don't know.


>DBR> [1] http://www.dlitz.net/software/pycrypto/

Pycrypto had been stalled in development. The latest release was in
2005. There is now a new developer and that it were the link above goes,
but he has not yet released anything. so you will have to do with the
2005 release.

There is an alternative library: m2crypto
(http://chandlerproject.org/Projects/MeTooCrypto). It is built on top of
OpenSSL which is available for most platforms that have Python whereas
Pycrypto has its own C implementations of crypto algorithms. M2crypto
has a recent release. Also I think because OpenSSL is widely used, its
vulnerabilities are easier detected and corrected, whereas I don't think
that is the case for Pycrypto.

M2crypto is much bigger than you need for this project, however. If that
doesn't bother you I would recommend it.

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list