Here is a short manual for GPG.
The following command can be used:
Default settings may be enough for your environments, or not. Hence be careful in what you are using here.
Here is how to add a new email address to a given key:
gpg --edit-key > adduid # Fill in the fields
Here is how to delete a public key associated to an account name, note that is there are a private key in your private key ring associated with it it will generate an error.
gpg --delete-key "User Name"
Here is how to delete a private key from the secret key ring.
gpg --delete-secret-key "User Name"
Here is how to list public keys:
And here is how to list the private keys:
To export a public key:
gpg --export -a "User Name" > public.key
To export a private key:
gpg --export-secret-key -a "User Name" > private.key
To import a public key:
gpg --import public.key
To import a private key:
gpg --allow-secret-key-import --import secret.gpg.key
Here is how to encrypt some data:
gpg -e -r "User Name" file.txt
And how to decrypt it:
gpg -d file.txt.gpg
Look at the list of keys available in your environment to list an ID:
Then send it:
gpg --keyserver keyserver.example.com --send-keys id_of_key
Here is how to receive it:
gpg --keyserver keyserver.example.com --recv-keys id_of_key
Here is how to look up for existing keys.
gpg --keyserver keyserver.example.com \ # Ex: (keys.gnupg.net) --search-keys "Search String, user name or email"
Unless otherwise specified, the contents of this website are (C)Copyright Michael Paquier 2010-2023 and are licensed for use under CC BY-SA 3.0.