Last active
July 26, 2017 21:25
-
-
Save mlehner616/28e6279a8f3d0317ef5b0d10c1de7c30 to your computer and use it in GitHub Desktop.
aws-kms-crypt.sh
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
# Usage: | |
# encrypt kms-key-id plaintext | |
function encrypt () { | |
key_id=$1 | |
plaintext=$2 | |
aws kms encrypt --key-id $key_id --plaintext fileb://<(echo $plaintext) --query CiphertextBlob --output text | |
} | |
# Usage: | |
# decrypt ciphertext | |
function decrypt () { | |
ciphertext=$1 | |
aws kms decrypt --ciphertext-blob fileb://<(echo $ciphertext | base64 --decode) --output text --query Plaintext | base64 --decode | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment