Skip to content

Instantly share code, notes, and snippets.

@0xMurage
Created May 26, 2024 16:40
Show Gist options
  • Save 0xMurage/44c2cef42e3a31edca84343a1e9b2914 to your computer and use it in GitHub Desktop.
Save 0xMurage/44c2cef42e3a31edca84343a1e9b2914 to your computer and use it in GitHub Desktop.
GPG notes
1. To list available public keys
gpg -k --keyid-format long
2. To List the available secret keys
gpg -K --keyid-format long
  • If the primary secret key is not available, the secret title will end in a hash i.e. (sec#). In this case, you will need to import the primary master key to be able to modify/generate secret sub keys
3.Import the primary secret key
gpg --import {filename}
  1. Do something: Using the primary key identifier run,
gpg --edit-key {key identifier}
i) To change password:
  • Run command to change the passphrase
passwd
ii) To create new sub key
  • Run command to add sub key
addkey
5. Remove the primary/master key from local machine and use sub keys

i) Export the subkeys

gpg -a --export-secret-subkeys ${subKey! or primary key identifier} > {filename}

ii) Delete the primary and subkey from current keyring

gpg --delete-secret-keys {uid email here}

iii) Import the sub key(s)

gpg --import {filename}

iv) Trust the key Using the primary key identifier run,

gpg --edit-key {key identifier}

then run command trust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment