Managing GPG keys on Linux for better security:
Create your own private/public key pair and revocation certificate
Export you public key
Export your private key
Protect your priavte key and revocation certificate by keeping them somewhere safe.
List keys by signature:
List all keys:
Share your public key on a public keyserver
NOTE: In Ubuntu by default all the keys are uploaded to keyserver.openpgp.com
Change default keyserver to another keyserver:
NOTE: If a public key is sent to OpenPGP, it sends a notification on keyowners email address
By default keys are not available for search by email address, the mail from openpgp has a link inside it, which needs to be clicked to verify identity
After your key is verified, you can serach for your key on the keyserver:
Import others public key to your key-ring:
If you want to send someone an encrypted message you´ll first need to import their public key from a file or keyserver
Import key from a file:
Import if you already know a key_id:
Import from a particular keyserver:
Validate public keys:
When you recieve a public key from someone, once you imported that public key how would you verify that public key belongs to that person, we need to authenticate it.
We can try following alternatives:
You can view the fingerprint of the public key
You can contact the keyś owner over the phone or meet in person.
Compare the two fingerprints and if the two fingerprints match, means you have the right public key
Then you sign the key as a valid key:
Managing your keys
List all keys
List all keys with signature
Delete a key-id
List keys in your private ring
How to extend key expiration date
List all the keys
Select a key using key-id which you want to change expiration of
Now you'll enter the gpg shell, here you can see all the applicable commands using
help
command
List all the keys and select a key you want to edit
Now enter
expire
in the gpg shell to start editing the expiration date
Save the changes
How to use the revocation certificate
If you're private key is compromised you can regenerate a new key pair using the revocation certificate to let everyone know that you are not using you're old key anymore.
On Linux their's a default revocation certificate stored in
~/.gnupg/openpgp-revocs.d/
location.Following command should be used to revoke a key using a revocation certificate
Now you should import it to your keyring
Now upload the revoked key to the keyserver
Last updated