Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Adrian Cantrill kmscommands.txt 0ac4f2a Apr 11, 2019
0 contributors

Users who have contributed to this file

34 lines (14 sloc) 1.07 KB
aws kms create-key --description "SAPRO" --region us-east-1
aws kms create-alias --target-key-id XXX --alias-name "alias/saprokey" --region us-east-1
aws kms generate-data-key --key-id alias/saprokey --key-spec AES_256 --region us-east-1
echo "CIPHERTEXT_FROM_PREV_COMMAND" > datakey_ciphertext_base64.txt
echo "PLAINTEXT_FROM_PREV_COMMAND" > datakey_plaintext_base64.txt
cat datakey_plaintext_base64.txt | base64 --decode > datakey_plaintext_decoded.txt
echo "Pinehead is amazing" | openssl enc -e -aes256 -k fileb://home/ec2-user/datakey_plaintext_decoded.txt > ~/topsecret.txt
cat topsecret.txt
rm datakey_plaintext_*
cat datakey_ciphertext_base64.txt | base64 --decode > ./datakey_ciphertext_decoded.txt
aws kms decrypt --ciphertext-blob fileb:///home/ec2-user/datakey_ciphertext_decoded.txt --region us-east-1
echo "PLAINTEXT_FROM_PREV_COMMAND" > ./datakey_plaintext_base64.txt
cat ./datakey_plaintext_base64.txt | base64 --decode > ./datakey_plaintext_decoded.txt
cat ./topsecret.txt | openssl enc -d -aes256 -k fileb://home/ec2-user/datakey_plaintext_decoded.txt
You can’t perform that action at this time.