Site Tools


gpg

GPG

backup and restore gpg

# https://medium.com/@chasinglogic/the-definitive-guide-to-password-store-c337a8f023a1
 
# backup
gpg2 --export-secret-keys > secret.gpg
 
# restore
gpg2 --import /path/to/secret.gpg

CheatSheet

# Import other people's key
curl https://keybase.io/dcai/key.asc | gpg --import
 
# list keys
gpg -k
 
# export public key
gpg --armor --export {useremail@dongsheng.org}
 
# export private key
gpg --export-secret-key --armor
 
# fingerprint
gpg --list-keys --fingerprint
 
# edit the key
gpg --edit-key {keyid} # the keyid is email address
gpg --send-key {keyid} # Similar to --export but sends the keys to a keyserver. 
# gpg --keyserver search.keyserver.net --send-key [email protected]
 
# revoke key
gpg2 --gen-revoke PUB_KEY_ID > revocert.asc
 
# encrypt
echo "test" | gpg --encrypt --armor
 
# decrypt
echo "[gpg encrypted contents here]" | gpg --decrypt
 
# Sign (encrypted by private), generate signature
# read this: https://www.gnupg.org/gph/en/manual/x135.html
echo -n | gpg -s --armor
 
# verify the signed message
# read this: https://www.gnupg.org/gph/en/manual/x135.html
echo '[gpg signature]' | gpg --verify

Dognsheng's public key

gpg.txt · Last modified: 2020-04-19 (external edit)