Last active
February 26, 2017 07:40
-
-
Save ivawzh/a57cf4056be7889677f8de72042e07ae to your computer and use it in GitHub Desktop.
Bash helper function that decrypts Base64 encoded KMS secret.
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
function decrypt_kms { | |
if [ "$#" -ne 1 ]; then | |
echo "Please provide base64 encoded kms-secret (aka. ciphertext-blob), e.g. decrypt_kms aasd123123lkjklj" | |
else | |
echo $(aws kms decrypt \ | |
--ciphertext-blob fileb://<(echo "$1" | base64 -d) \ | |
--output text \ | |
--query Plaintext | base64 --decode | |
) | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment