Encrypting and Decrypting with the aws-cli KMS
Just a memo for myself.
Encryption
aws cli ver.1
1 | aws kms encrypt --key-id alias/<kms鍵> --plaintext "<暗号化したい文字列>" --output text --query CiphertextBlob |
aws cli ver.2
1 | aws kms encrypt --key-id alias/<kms鍵> --plaintext "$(echo -n '<暗号化したい文字列>' | base64)" --output text --query CiphertextBlob |
Decryption
1 | aws kms decrypt --ciphertext-blob fileb://<(echo '文字列'|base64 -d) | jq .Plaintext --raw-output |base64 -d |
