Skip to content

GPG

GPG

https://gock.net/blog/2020/gpg-cheat-sheet

Key management

Show

List Keys:

#List public keys
gpg --list-keys

#List all secret keys
gpg --list-secret-keys


#List keys from another home directory
gpg --homedir ~/.gnupg-alternate --list-keys

#Change home directory
export GNUPGHOME=/mnt/c/Users/USER/AppData/Roaming/gnupg/
gpg --list-keys

Create

Generate new Key Interactive:

gpg --full-generate-key
[...]
pub   ed25519 2024-05-06 [SC]
      CB74066316253430000C2C1D3DBB6D64F46843C7
uid                      Generalzer0 (Generalzer0 Key) <[email protected]>
sub   cv25519 2024-05-06 [E]

Export Keys:

#Export Specific Key 
gpg -a --export CB7406631625343A4CBC2C1D3DBB6D64F46843C7 > public.asc
gpg -a --export-secret-key CB7406631625343A4CBC2C1D3DBB6D64F46843C7 > private.asc

#Export all keys
gpg -a --export > public-all.asc
gpg -a --export-secret-key > secret-all.asc

Import keys:

gpg --import keys.asc