Last active
February 14, 2019 19:28
-
-
Save SerhatTeker/7280880622a1ca0728c750cc5eab8dc3 to your computer and use it in GitHub Desktop.
For BackUp and Restore your PublicKey & PrivateKey & RevokeCertificate
This file contains hidden or 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
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
# DECRYPT PubKey + PriKey | |
#----------------------------------------------------------------------------------------------------- | |
PUBKEY_FILE=anapub.key | |
PRIKEY_FILE=anapri.key | |
DEC_PUBKEY_FILE=anapubDec.key | |
DEC_PRIKEY_FILE=anapriDec.key | |
echo "Keys to decrypt:" | |
ls -l $PUBKEY_FILE $PRIKEY_FILE | |
gpg --output $DEC_REVOKE_FILE --decrypt | |
gpg --output $DEC_PRIKEY_FILE --decrypt | |
echo "Keys output files:" | |
ls -l $DEC_PUBKEY_FILE $DEC_PRIKEY_FILE |
This file contains hidden or 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
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
# ENCRYPT EXPORT RevokeCert + PubKey + PriKey | |
#----------------------------------------------------------------------------------------------------- | |
REVOKE_FILE=revoke.asc | |
PUBKEY_FILE_ASC=anapub.asc | |
PUBKEY_FILE=anapub.key | |
PRIKEY_FILE=anapri.key | |
gpg -K | |
echo "select a KEYID" | |
read KEYID | |
# create a public key file | |
gpg -ao $PUBKEY_FILE --export $KEYID | |
gpg -ao $PUBKEY_FILE_ASC --export $KEYID | |
echo "REMEMBER THE COMING PASSPHRASE FOR REVOKE CERTIFICATE!" | |
# create revoke certificate file w/ encryption | |
gpg --gen-revoke $KEYID | \ | |
gpg --armor --output $REVOKE_FILE --symmetric --cipher-algo AES256 | |
# create private key file w/encryption | |
echo "REMEMBER THE COMING PASSPHRASE FOR PRIVATE KEY!" | |
gpg --armor --export-secret-keys $KEYID | \ | |
gpg --armor --output $PRIKEY_FILE --symmetric --cipher-algo AES256 | |
ls -l $PUBKEY_FILE $PRIKEY_FILE $REVOKE_FILE |
This file contains hidden or 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
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
# IMPORT PubKey + PriKey | |
#----------------------------------------------------------------------------------------------------- | |
DEC_PUBKEY_FILE=anapubDec.key | |
DEC_PRIKEY_FILE=anapriDec.key | |
echo "importing private and public keys" | |
ls -l $DEC_PRIKEY_FILE $DEC_PUBKEY_FILE | |
gpg --import $DEC_PUBKEY_FILE | |
gpg --import $DEC_PRIKEY_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment