Sitemap
Press enter or click to view image in full size
Photo by Filip Szalbot on Unsplash

Member-only story

Using Public Key Methods To Encrypt Data With GPG: RSA is still the Leader

3 min readFeb 15, 2023

--

Public key encryption is just pure magic. You have one key to encrypt, and another key to decrypt. Overall, we can use it to encrypt data, digitally sign data and to pass an encryption key:

Press enter or click to view image in full size

For digital signatures, we can use ECDSA, EdDSA, or RSA. While encryption, we can’t use elliptic curves (unless we mix it with symmetric key methods) and use RSA encryption. In this case, we will encrypt data using 1,024-bit, 2,048-bit, and 3,072-bit RSA keys.

It was Phil Zimmerman who created the PGP (Pretty Good Privacy), and which has advanced to the GNU Privacy Guard (GPG). Overall GPG is a program that is based on OpenPGP and can generate key pairs, encrypt and decrypt data, and digitally sign files and verify digital signatures.

We can generate an RSA key pair with (and where we store the key with a given real name and an associated email address):

input_data = gpg.gen_key_input(key_type="RSA",key_usage='encrypt',
key_length=1024,passphrase=password,name_real=user,name_email=email)

--

--

Prof Bill Buchanan OBE FRSE
Prof Bill Buchanan OBE FRSE

Written by Prof Bill Buchanan OBE FRSE

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.