gpg --full-generate-key
(1) RSA and RSA
4096
(at least 4096 to stay safe)0
(key does not expire)y
Your Name Here
your@email.com
Optionally a comment
O
(to confirm)For reference, Here's more info from GitHub.
gpg --list-keys
gpg --list-secret-keys --keyid-format LONG
# First, remove the private key
gpg --delete-secret-key key-id
# Then, remove the public key
gpg --delete-key key-id
gpg --output file.gpg --encrypt --recipient mundowarezweb@gmail.com file.txt
gpg --output file.txt --decrypt file.gpg
From https://www.gnupg.org/gph/en/manual/x56.html.
In binary format (inconvenient to be public on the web or sent via email).
gpg --output nono.gpg --export mundowarezweb@gmail.com
In plain-text format.
gpg --armor --export mundowarezweb@gmail.com
In plain-text format, saved to a file.
gpg --armor --output nonos-key.gpg --export --recipient mundowarezweb@gmail.com
gpg --armor --export --recipient mundowarezweb@gmail.com > nonos-key.gpg
You may want to transfer the private key you use to decrypt your files to another machine. Let's see how.
First, you must ensure the key is installed on your machine.
List the keys you have to get the name of the key you want to export.
gpg --list-secret-keys
From the output above, the name is ``.
gpg --export-secret-key NAME > ~/Desktop/my-secret-key.asc
Copy that key to another machine.
Then import it.
gpg --import my-secret-key.asc
gpg -o file.txt.gpg -e -r your@email.com file.txt
Note that the email provided needs to match that in your public GPG key.
gpg -o "file.txt" -d "file.txt.gpg"
Note that the email provided needs to match that in your private GPG key.
If you don't have the secret key required to decrypt a file, you'll get the following message.
gpg: public key decryption failed: No secret key
gpg: decryption failed: No secret key
You can change the password you use to unlock your GPG private key.
gpg --edit-key KEY-ID
passwd
save