Python-Gnupg

13 September 2011
Tags: python

At CashStar I had to implement some interactions with files being sent to us and needing to decrypt them on the fly. GPG was the encryption we were using and I decided to make use of python-gnupg for my side of the code. GnuPrivacyGuard needs to be installed as python-gnupg is a wrapper to that.

Developing on a mac I found that installing GPGTools was the easiest route in doing that. On the servers we would do the normal compiling of the relevant source code to install. There are currently 2 versions of GPG out there 1.41 and 2.018. GPGTools installs both and a bunch of other goodies.

To install python-gnupg, the ever faithful pip does the trick

pip install python-gnupg

Now you can do everything you need to do through python. If you run into any issues, a good resource is either the docs or to actually go and download the source and there is a file there called test_gnupg.py that gives you all the example code you need.