[last updated: 2023-07-15]
GnuPG encryption home page
-----
This page still in development ...
- Delete a key:
- If a key has been revoked or expired, or for whatever other reason, you may want to delete it from your system.
- You must delete the private key before gpg will let you delete the public key
- $ gpg --delete-secret-key [ keyid or uid search parameter ]
The search parameter can be the email associated with the key, a keyword from the comment field,
either short (8-hex-chars) or long (16-hex-chars) key id, or the "real name" associated with the key.
- Once the secret key is deleted, you can delete the public key:
$ gpg --delete-key [ keyid or uid search parameter ]
-----------------------------------------------------------------
- Exporting your private key:
- If you want to take your private key to different computer than the one used to generate it,
you will need to export it to a file.
- You should of course separately encrypt this exported file to protect it while you transport it.
- $ gpg --export-secret-key -a -o [ outputFileName ] [ search param if needed]
- You will be asked for the passphrase that you specified when you generated the key.
- The exported file will be created in your current directory.
-----------------------------------------------------------------
- Editing your passwords:
- I Think the following is true, but have not yet fully tested it ...
Caution:
If you edit a key, it changes. This means its fingerprint and subsequent keyid's change.
It also means that if you've exported either your public or private keys, they are no longer valid.
- $ gpg --edit-key [ keyIdentifier ]
The "keyIdentifier" can be any of the parameters that uniquely define your key:
the actual key ID, your email, your name, a unique comment, etc.
Take care however if there is any ambiguity among the parameters,
and be sure the key that is found is the one you want.
- Once the gpg edit key is opened, the cursor will change to "gpg>"
- At this point there are many commands you can execute to do a variety of edit tasks.
See full documentation at: https://www.gnupg.org/gph/en/manual/r899.html
- Ones I've found useful:
-
- you may need to enter "o" for OK, and you may need to enter your password.
- When you're done, type: save
- Exit with <ctrl-c> or type quit
-----------------------------------------------------------------
- GnuPG Password manager:
- Not sure how this works.
- passwords are stored in "your key chain."
- Experimenting, I see that, on the same computer, files are decrypted without password prompt
whether or not you've selected to save your password in 'password manager,'
and whether or not you've deleted (as a test) the whole of the ~/.gnupg directory
- So in net not sure where the passwords are stored, perhaps in /usr/share/gnupg ...
-----------------------------------------------------------------
- In the end, however, it remains true that some system of saving/storing/retrieving your passwords is needed.
-----------------------------------------------------------------
- force passwords to be required:
- From: https://security.stackexchange.com/questions/103034/gnupg-decryption-not...
- As stated, if you execute a file decryption on the same computer where you did the encryption,
you will not (by default) be prompted for a password.
- On versions of GPG newer than v2.1, however, you can force a password to be entered in order to perform the decryption:
Create the file: ~/.gnupg/gpg-agent.conf
Put two lines into it:
default-cache-ttl 1
max-cache-ttl 1
Restart the agent with:
$ echo RELOADAGENT | gpg-connect-agent
-----------------------------------------------------------------