# GnuPG: The GNU Privacy Guard


Generating a new keypair

# gpg --gen-key

List the keys

# gpg --list-keys
# key=`gpg --list-keys | grep ^pub | tr '/' ' ' | awk '{print $3}'`
# email=`gpg --list-keys | grep uid | sed 's/.\+<\(.\+@.\+\..\+\)>/\1/'`

Generating a revocation certificate

# gpg --output revoke.asc --gen-revoke $key

Exporting a public key

# gpg --armor --output $email.gpg --export $key
# gpg --fingerprint $key

Importing a public key

# gpg --import $email.gpg
# gpg --edit-key $key
> fpr
> sign
> check

Making signatures

# gpg --sign original.file # 1
# gpg --clearsign original.file # 2
# gpg --detach-sig original.file # 3

Verifying signatures

# gpg --verify signed.file # 1, 2, 3
# gpg --decrypt signed.file # 1, 2

Encrypting documents

# gpg --output encrypted.file --encrypt --recipient $email original.file
# gpg --output encrypted.file --symmetric original.file # shared secret

Decrypting documents

# gpg --output original.file --decrypt encrypted.file

Delete a key from your public keyring

# gpg --delete-keys $key

References

https://www.gnupg.org/gph/en/manual.html

No comments: