Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 2 years ago.
Does anyone know of a python library or wrapper around a c library that will easily provide Authenticated AES via GCM mode?
PyCrypto does not support it and it does not appear that PyOpenSSL supports direct access to the symmetric cipher portions of OpenSSL
The PyCA cryptography library provides AES-GCM: https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/#cryptography.hazmat.primitives.ciphers.modes.GCM
I have just finished looking for an EAX or GCM mode AES encryption algorithm in python. This was a particularly difficult search because I was unable to download the PyCrypto alpha version, which includes both of these, due to a dependency issue.
Eventually I turned to an offshoot of pycrypto that can be pip installed without issue, and has a stable release of GCM.
http://pycryptodome.readthedocs.org/en/latest/src/introduction.html
I am looking for exactly the same thing, and strangely enough I cannot find any "official" solutions, just those:
- this small wrapper (used for iphone tools?)
- this github code drop which does AES GCM in Python, and nothing else
So it looks like the answer above (which I have upvoted) is right, you have to do the maths yourself.. It's a shame there isn't a python wrapper for a C/assembly library because the latest CPUs provide hardware acceleration for those calculations, and we won't benefit from those with a pure python solution.
PyCrypto has added AES-GCM support in the 2.7a1 release. I'm pretty sure this is an alpha release at this point.
https://github.com/dlitz/pycrypto