Created
May 19, 2019 10:56
-
-
Save parj/aa6db77cd496bf85d08e97f552bef270 to your computer and use it in GitHub Desktop.
Decrypting gpg private key and importing gpg
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 | |
# Stop on error | |
set -e | |
main() { | |
decryptAndImportPrivateKeys | |
} | |
# From gist - https://gist.github.com/Bost/54291d824149f0c4157b40329fceb02c | |
tstp() { | |
date +"%Y-%m-%d %H:%M:%S,%3N" | |
} | |
# From gist - https://gist.github.com/Bost/54291d824149f0c4157b40329fceb02c | |
exeinf() { | |
echo "INFO " $(tstp) "$ "$@ | |
} | |
# From gist - https://gist.github.com/Bost/54291d824149f0c4157b40329fceb02c | |
exeerr() { | |
echo "ERROR" $(tstp) "$ "$@ | |
} | |
decryptAndImportPrivateKeys() { | |
exeinf "Unzipping archive" | |
unzip -o .travis/secret-private-key.zip -d .travis | |
exeinf "Extracting private gpg key" | |
openssl aes-256-cbc -d -in .travis/secret-private-key -out .travis/gpg-private-key.asc -k "${PRIVATE_KEY}" | |
exeinf "Importing gpg key" | |
gpg --batch --import .travis/gpg-private-key.asc | |
exeinf "List Keys" | |
gpg --list-secret-keys | |
gpg --list-public-keys | |
exeinf "Completed importing key" | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment