Has anyone worked with the AWS KMS API and Cognitect's aws-api? I'm having trouble reading the :Plaintext
key from the response.
(let [r (aws-api/invoke c {:op :GenerateDataKey
:request {:KeyId cmk-arn
:KeySpec "AES_256"}})
plaintext (:Plaintext r)]
(with-open [p plaintext
out (io/output-stream "test.txt")]
(clojure.data.codec.base64/decoding-transfer p out)))
java.lang.ArrayIndexOutOfBoundsException: Index -7 out of bounds for length 123
The AWS docs say Plaintext
is a "Base64-encoded binary data object." If I slurp
plaintext
, I get "�$���r*�!��8yS�x;�\f�@\r�bn@�"
returned which is definitely not base64. Is aws-api doing something with the response before I get it?when you call the aws-api doc function for the operation what does it say?