Last active
March 1, 2017 02:45
-
-
Save osvalr/c6a3c72b879abd236851e6fae82c6a15 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# This gist is mainly for export and import your gpg keys in order to backup them individualy, | |
# use somewhere else or whatever you want to do. | |
# usage: | |
# (1) $ export_gpg [email protected] fname | |
# NOTE: it will create two files: fname-gpg.txt, fname-gpg.key | |
# | |
# (2) $ import_gpg fname | |
export_gpg(){ | |
email=$1 | |
filename=$2 | |
gpg -a --export $email > ${filename}-gpg.key | |
gpg -a --export-secret-keys $email > ${filename}-gpg.key | |
gpg --export-ownertrust > ${filename}-gpg.txt | |
} | |
import_gpg(){ | |
filename=$1 | |
gpg --import ${filename}-gpg.key | |
gpg --import-ownertrust ${filename}-gpg.txt | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment