GPG Quick Notes

A cheatsheet for GPG

Generate Keypair:

gpg --full-gen-key

generate revoke certificate:

gpg --gen-revoke [USER-ID]

list keys:

gpg --list-keys

option:

--keyid-format short/long

delete key:

gpg --delete-key [USER-ID]

output key:

gpg --armor --output public-key.txt --export [USER-ID]

upload key:

gpg --send-keys [USER-ID] --keyserver hkp://sybkeys.pgp.net

fingerprint:

gpg --fingerprint [USER-ID]

import key:

gpg --import [key-file]

search on server for key:

gpg --keyserver hkp://sybkeys.pgp.net --search-keys [USER-ID]

encrypt for someone:

gpg -r some@mail.x -e file

decrypt:

gpg -d file.gpg

sign data:

gpg --sign file
gpg --clearsign file
gpg --detach-sign file
gpg --armor --detach-sign file

verify sig:

gpg --verify [signature file] [file]

encrypt and sign:

gpg --local-user [sender id] --recipient [receiver id] --armor --sign --encrypt file

add additional email address:

gpg --edit-key [kei/user-id]
adduid (and follow instructions)
trust (optional)

private key export and import:

gpg --export-secret-keys --armor <USER-ID> privkey.asc
gpg --import privkey.asc

export subkeys:

gpg --list-secret-keys --with-subkey-fingerprint
gpg -a --export-secret-subkeys [subkey_id]! > /tmp/subkey.gpg

edit key:

gpg --edit-key <user-id>


passwd #change passphrase  
clean  #compact any user id that is no longer usable (revoked or expired)
revkey #revoke a key
addkey #add a subkey
expire #change expiration time
addduid # add additional names
addphoto # add photo to key
save # save change and quit
edited 20.04.2024
created 18.11.2020
EOF
[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<