Created
November 2, 2020 17:34
-
-
Save project0/99006ac19655efbc41e2b15c36808876 to your computer and use it in GitHub Desktop.
AWS KMS encryption/decryption
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 | |
function awskmsencrypt() { | |
key="$1" | |
text="$2" | |
aws kms encrypt --key-id "$key" --plaintext fileb://<(echo "$text") --output text --query CiphertextBlob | |
} | |
function awskmsdecrypt() { | |
crypt="$1" #base64 | |
aws kms decrypt --ciphertext-blob fileb://<(echo "$crypt" | base64 -d) --output text --query Plaintext | base64 -d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment