- Export key to file:
gpg -o key.gpg --export <KEY ID>
- Export key in ASCII:
gpg -o key.asc --export --armor <KEY ID>
Note: Omitting the -o|--output option will print the key to stdout.
gpg --import key.gpg
gpg --import key.asc
- Generate new key:
gpg --gen-key
- Generate a new key with options dialog:
gpg --full-gen-key
- List public keys:
gpg -k
,gpg --list-keys
- List secret keys:
gpg -K
,gpg --list-secret-keys
gpg --edit-key <KEY ID>
# In the interactive prompt:
gpg> sign
gpg> save
- Take the secret key in key.gpg and generate a text file to-be-printed.txt that contains the secret data:
paperkey --secret-key my-secret-key.gpg --output to-be-printed.txt
- Take the secret key data in my-key-text-file.txt and combine it with my-public-key.gpg to reconstruct my-secret-key.gpg:
paperkey --pubring my-public-key.gpg --secrets my-key-text-file.txt --output my-secret-key.gpg
Refer: https://devhints.io/gnupg