Created
February 12, 2018 21:53
-
-
Save ftorto/30398a13656f991f07b568fe8dc05007 to your computer and use it in GitHub Desktop.
Remove primary secret key from .gnupg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your fingerprint | |
gpgKey=0x1234123123123 | |
# Export the full backup to store somewhere | |
gpg --export-secret-keys --armor ${gpgKey} > ${gpgKey}.full_backup.asc | |
# Export partial backup with only your subkeys | |
gpg --export-secret-subkeys --armor ${gpgKey} > ${gpgKey}.only_subkeys.asc | |
# Erase your .gnupg | |
mv --no-clobber ~/.gnupg ~/.gnupg.BAK | |
gpg2 | |
#ctrl+c | |
cp ~/.gnupg.BAK/gpg.conf ~/.gnupg | |
rm -rf ~/.gnupg.BAK | |
# Import partial backup | |
gpg --import ${gpgKey}.only_subkeys.asc | |
gpg --list-secret-keys gpg ${gpgKey} | |
# You see `sec# ` meaning the primary secret key is missing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment