gpg
(excerpted and modified from http://www.gnupg.org/gph/en/manual.html)
Suppose the key is:
Cyker Way (Cyker Way’s personal key) [email protected]
# Generate key pair
gpg --gen-key
# Generate revoke certificate
gpg --output revoke.gpg --gen-revoke [email protected]
# Export a public key
gpg --output public.gpg --armor --export [email protected]
# Import a public key
gpg --import public.gpg
# List public keys
gpg --list-keys
# List public keys with their fingerprints
gpg --fingerprint
# List public keys with their signatures
gpg --list-sigs
# Check public keys with their signatures
gpg --check-sigs
# Edit a public key
gpg --edit-key [email protected]
# Delete a public key
gpg --delete-key [email protected]
# List secret keys
gpg --list-secret-keys
# Delete a secret key
gpg --delete-secret-key [email protected]
# Encrypt a file (using public key)
gpg --output doc.enc --encrypt --recipient [email protected] doc.txt
# Encrypt a file (using symmetric encryption, need a password)
gpg --output doc.sym --symmetric doc.txt
# Decrypt an encrypted file
gpg --output doc.dec --decrypt doc.enc
# Sign a file
gpg --output doc.sig --local-user [email protected] --sign doc.txt
# Verify the signature
gpg --verify doc.sig
# Decrypt a signed file
gpg --output doc.dsg --decrypt doc.sig
# Sign a file in another detached file
gpg --output doc.sig --detach-sig doc.txt
# Verify the signature in a detached file
gpg --verify doc.sig doc.txt
# Search a key on the keyserver
gpg --keyserver pgp.mit.edu --search-keys [email protected]
# Send a key to the keyserver
gpg --keyserver pgp.mit.edu --send-keys 358A2A14
# Receive a key from the keyserver
gpg --keyserver pgp.mit.edu --recv-keys 358A2A14
Abbreviations:
--output, -o
--encrypt, -e
--symmetric, -c
--decrypt, -d
--sign, -s
--detach-sign, -b
--recipient, -r (choose a public key when there are multiple)
--local-user, -u (choose a secret key when there are multiple)
--armor, -a (alpha armored, can be used in combination with --export, --encrypt, --symmetric, --sign, --detach-sign)