Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

A GPG key, also referred to as a GnuPG key (GNU Privacy Guard), is a digital key pair used for encryption and signing purposes. It consists of two parts:

  1. Public Key: This is a mathematically related part of the key pair that can be freely shared with others. It's used for encrypting data or verifying digital signatures. Anyone with your public key can encrypt messages or files that only you, with the private key, can decrypt.

  2. Private Key: This is the sensitive part of the key pair that should be kept secret and secure. It's used for decrypting messages or files encrypted with your public key and for signing data to create a digital signature.

Here's how GPG keys work in practice:

Benefits of GPG Keys:

Common Uses of GPG Keys:

In essence, GPG keys provide a powerful tool for securing your digital communications and data by ensuring confidentiality, integrity, and authenticity.

work with GPGs

# generate one
gpg --full-generate-key # RSA is better than DSA!

# list keys
gpg --list-secret-keys

# export public key
gpg --armor --export <key-id> #  fingerprint or key ID

config the key for git

git config --global user.signingkey <key-id> # got from gpg ``--list-secret-keys``
git config --global commit.gpgsign true