0

I am creating a data key under a master key on AWS KMS, I am converting the plaintext bytebuffer into string, but the length of this string is reported inconsistent, it's never 32 (for example using the SHA 256 key spec).

Mahesh H Viraktamath
  • 818
  • 3
  • 14
  • 34
  • 1
    How can you convert the plaintext key buffer into a "string?" It's binary data, not character data... Isn't it? Or is it already in Base64? It isn't clear what you're trying to do or how you are planning to use the result. – Michael - sqlbot May 16 '17 at 00:15
  • I need to use the plaintext to encrypt our files. And the encrypted blob will itself be encrypted and stored in out environment. – Mahesh H Viraktamath May 16 '17 at 06:41
  • 1
    Having reviewed the docs, it appears that this bytebuffer is indeed the binary representation of the key, which has been automatically converted from the base64 encoding used at the API level by the SDK. When I asked how you are planning to use it, I was referring to how you were using it from a code perspective, passing it to what method of what object in which library, etc... because I don't yet understand why you want to convert a blob into a string. Show the code for the conversion? Show the code where you will use the result? – Michael - sqlbot May 16 '17 at 11:00
  • Sorry, we cannot show the code. I am trying to encrypt the encryted blob and store it in the DB (so not directly encrypted blob but an extra layer of encryption on it). But when I try to decrypt it (before sending it to the aws kms) and send it to the aws kms, it throws an exception, which means the decrypted blob is not right. Now I came across the charset "ISO_8859_1", which is working. – Mahesh H Viraktamath May 16 '17 at 12:47

0 Answers0