In this video, we will encrypt and sign documents with PGP and Python as part of my series on encryption with Python.
Specifically, we are going to use GnuPG or GPG, which is essentially a free version of PGP and is part of the OpenPGP standard
First of all….PGP or Pretty Good Privacy.
PGP was developed in the early nineties by Phil Zimmerman. Phil offered up the source code for PGP which was used to develop the Open PGP ..a standard for
GPG encrypts data using asymmetric key pairs that are individually generated by users. GPG also supports symmetric encryption with AES and other algorithms …but we’ll leave that discussion for another day.
If you remember, In the world of asymmetric encryption , each user has a key pair …one public and one private key. There is a mathematical relationship between each key pair where you can encrypt with one and decrypt with the other.
How this typically works is that Bob securely sends Alice his public key. Alice encrypts a file with Bob’s public key and sends it to Bob, knowing that only Bob can decrypt because he has the private key that was associated with the public key he sent to Alice.
GPG has several command line options to manage your encryption but we are going to use a Python library instead called pythongnupg
To exchange encrypted files in GPG, each user will need to have GPG installed on their computer. Also, we will need to install the GnuPG libray in python to write the code.