GPG cheat sheet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Etienne Baqué 6357a1b8e3 Fixed Markdown in Readme file 10 months ago
LICENSE Initial commit 3 years ago Fixed Markdown in Readme file 10 months ago

GPG cheat sheet

Install GPG on Debian/Ubuntu

$ sudo apt install gnupg

Create a key

$ gpg --full-generate-key

List keys

$ gpg --list-keys --fingerprint

Export my public key

$ gpg --export -a "My Name" > myname.asc

Export my private key

$ gpg --armor --export-secret-keys "My Name" > myname.asc

Sending and encrypting a file

  1. First, get recipient's public key and send them mine.
  2. Import their key:
    $ gpg --import recipient.asc

    Check that the key was imported successfully by listing the keys available on my machine.

  3. Encrypt file for recipient:
    $ gpg -e -u "My Name" -r "Their Name" test.txt

Decrypting a file

$ gpg -d test.txt.gpg

Encrypting a file for myself

$ gpg -e -r "My Name" test.txt

Delete a previously added public key

$ gpg --delete-key keyId

keyId can be found with gpg --list-keys

Delete my own key

  1. First, delete the private key:
    gpg --delete-secret-key keyId
  2. Then delete the public key:
     gpg --delete-key keyId