Cannot decrypt message from Amazon Connect using RawRsaKeyringNode
See original GitHub issueI’m creating an IVR credit card payment solution in Amazon Connect and am encrypting the credit card details with the built-in Connect encryption features. I’ve used this blog post as a reference for my implementation. I’m trying to write a nodejs12.x Lambda which decrypts the payload from Connect.
The Lambda source code used in that project (s3://connect-sharing/DecryptCustomerInput.zip) uses a library called awsencryptionsdk-js
to decrypt the payload from Connect. However, that library is not published to npmjs. Rather than copy and paste that module into my project, I’m trying to write my code to use @aws-crypto/client-node
. However, I’m not able to decrypt the payload.
Here’s some code which shows how I decrypt the Connect payload with my private key using the old awsencryptionsdk-js
library:
const AWSEncryptionSDKHelper = require("awsencryptionsdk-js");
/**
* @param {string} privateKeyPEM - The private key in PEM format.
* @param {string} encryptedDataBase64 - The encrypted payload encoded in base 64 format.
* @returns {Promise<string>} - The decrypted message.
*/
async function oldDecrypt(privateKeyPEM, encryptedDataBase64) {
const awsEncryptionHelper = new AWSEncryptionSDKHelper(privateKeyPEM, encryptedDataBase64);
const data = await awsEncryptionHelper.decrypt();
const frames = data.body.frames;
frames.sort((a, b) => parseInt(a.seq) - parseInt(b.seq));
return frames
.map(({ text }) => text)
.concat([data.body.lastFrame.text])
.join('');
}
The code above decrypts the payload and returns the message with no issues.
Below is the new code I wrote using @aws-crypto/client-node
based on this example:
const { RawRsaKeyringNode, decrypt } = require('@aws-crypto/client-node');
/**
* @param {string} privateKeyPEM - The private key in PEM format to decrypt the cipher text.
* @param {string} base64CipherText - The cipher text in base 64 format.
* @param {string} keyName - Name of the key used to encrypt this message.
* @returns {Promise<string>}
*/
async function newDecrypt(privateKeyPEM, base64CipherText, keyName) {
const keyring = new RawRsaKeyringNode({
keyName,
keyNamespace: 'AmazonConnect',
rsaKey: { privateKey: privateKeyPEM }
});
const ciphertextBuffer = Buffer.from(base64CipherText, 'base64');
const { plaintext, messageHeader } = await decrypt(keyring, ciphertextBuffer);
return plaintext.toString('utf-8');
}
When I try to decrypt with newDecrypt
, I get the following error stack trace:
(node:22162) UnhandledPromiseRejectionWarning: Error: unencryptedDataKey has not been set
at Object.needs (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/material-management/build/main/needs.js:17:15)
at NodeDecryptionMaterial.getUnencryptedDataKey (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/material-management/build/main/cryptographic_material.js:217:17)
at NodeDefaultCryptographicMaterialsManager.decryptMaterials (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/material-management-node/build/main/node_cryptographic_materials_manager.js:49:46)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I dug a bit deeper into this library’s code and found that an exception is thrown in _unwrapKey
of raw_rsa_keyring_node.js:
Error: error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error
at Object.privateDecrypt (internal/crypto/cipher.js:44:12)
at RawRsaKeyringNode._unwrapKey (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/raw-rsa-keyring-node/build/main/raw_rsa_keyring_node.js:63:45)
at RawRsaKeyringNode._onDecrypt (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/raw-keyring/build/main/raw_keyring_decorators.js:32:35)
at RawRsaKeyringNode.onDecrypt (/var/task/orchestrate_lex_conversation/node_modules/@aws-crypto/material-management/build/main/keyring.js:58:38)
...
Based on the documentation and the examples given, I’m not sure if I’m using the API incorrectly or if there is something wrong with the payload from Connnect. I’m still going through the docs and the code to try and sort it out myself, but I wanted to reach out to see if there’s something obvious I’m missing.
Below are two payloads that may be decrypted with my private key. The 1st one comes directly from Connect. The 2nd one I created myself using @aws-crypto/client-node
’s encrypt
method. The 1st one fails, while the 2nd one works 🤔
Connect payload
The decrypted payload is 1236547891321456
.
AYADeDOc+0FhSFUFo3AviGMBU3MAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREE5RkxLMG8wS0x3a3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Zfr6ekuOSjH4Y/u9WJloNNOpI0TG/KvH1TyXQyfVmRCrPShKmRwwORKl79n9HwIxAPas5ox0uqDbZUv15L2+5XwIKSVMnxJwxf7GPFgQG+IRIHQ/DXKBVXUL+Ec5C+gXAA==
Here is the public key, private key, and certificate I’m using to encrypt/decrypt the data. These keys are only used for my own testing so it is safe to share.
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtTgxf4wvSC5sNnBk7q/I
J003Z9oHz9pnObZ/MfjPCHNYZoeqM0QaKAJ8RxkzEbyD5YJhb0NbTMJxzd706tJw
G66zIiyeSqr/UM/tqVNVTefYh4uLM3/wXyaYa6Hc+L+5Q165YFeOn0gnF2u1w2Cq
OX0ThQ5M1kMX0wPIpJSG1glbyGyjqvoqqDDrnfJHusQmHSB/M2ZUQOtwL7LEGD3K
g1mU/Fl2wusONLeT/YnklCHkiPvDHpxMNX3zuyj9b5vabIFYvfOWSiXdYWLg3ZNY
xpEnApe/qswkIOnd8Fv74yUgC2+KkkvX6yYmIgjO/UaNQ6uCun6IKvIRAjY/X6fm
5kEqOa98Bzj0EVVXasRtKILU05krJwU4oXivCSwPrV6lZf46bHbjfmcWBS/MMDdL
NiAoeh+GVCqUn2Lx1puaegNLPrTuv/cdntFoFXJDQSzn6dHb4Fv9Rbcnpp6gckdg
/Q1bSjtkdjGEf1cw2Go9+45FPf4mURdHNuRBeIv6ucdOldA4aqfFRi8ovtSmpKbk
x0vupZ3ubi5VffkWdyxWtL3RYHLUYgY8ikHHizgvuEkE8S+CRcPYuLP329u/LJDw
mamjB7gLIDjDN4QpHSLsbJ10xSkum5m8ehf9YlMh6bZV4dMtC0cqoeQ8k2xiNPo2
Ab2SUPDWjCdNehNtobrBOT8CAwEAAQ==
-----END PUBLIC KEY-----
-----BEGIN CERTIFICATE-----
MIIFZzCCA0+gAwIBAgIUIBYoz2BaYunsCR9zrwyMQd5n+Z0wDQYJKoZIhvcNAQEL
BQAw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ED9S6Y2WsbrySS50JM+KVvr33NfvJ6XdoL0Sbm3hWj0my
jGAPqUpDP05wsbloCISj/WqFQNDG3NgKWhNnxg0CggEBAKuDYIyay6Kbx4ApHQzD
jcTN4w/gpU4eIGd7QF+THHZ2hgM3ygyPyu/Zh8iQ8BujBeQjaG3izpnswk1lLVLH
/YsHguhIxDC0qXO0Ntgj51GqxkMe6Sn69rpeCL7q5IXMkAmlO/vv4mbhQMVp2tpF
IiIRhnkBZwThUwP4qSHpboeJEznp/2d/9dmk7zra7hkQtBNMJP9qp/lmDgEF5B/v
IBXujdm+wo36L7/ohXbfELNVHSPhkVj/d+/5wRLJFsV0SUDLhUhSpTUqVfAaxNcC
+aDLQM4BYWByOuuESdksKEj0O3K03E1wOjce0oooWY57WI39qxLRYfPWXSQPYxL3
GGUCggEAceBEn6yR2eXmD5sl4G1Y+Fl9d9nZmuIWx3aOpUYgkcvSg/+t7WfbPF7o
zudcKFlL5PBnYROewwAKlsSZdsgYqL1gR7xIT5UYJ+zpgrfeaCBBIK1Fbn4R9zj4
+qHZ5k79a4GYvIQ/eEAXBVc7vUy1avM0sRtbi+f50z9qenX8qqF6iwRFMj3YReHM
Qz6FVpuChG3QZilpfUPWKfGM4011d37fZLfqTgPi1X+Y7+b5lysQP5zu5iS3VR24
vIjKLt/ypnh/ufx8FtdLGl9K2WyVWEAytjqMe1TAQ1KbH73sywqmy4Lr51X+r9lB
IcJ4EqixWPnCt6/xnIr801futKtvdw==
-----END PRIVATE KEY-----
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (3 by maintainers)
Top GitHub Comments
Yes that is something we are working on. It was a somewhat recent addition.
Additionally, the defaults should probably change. With all things in security, it is every upward. So having a default padding mode is sub-optimal.
I’ll take this as a request to produce docs from the typescript interfaces. 😃
I verified that I could indeed decrypt your message from the code linked in the blog post. Then I read through that code to find the options, (I used a little console.log magic… 😦 ) and with a little bit of intuition/memory.
The padding information is not stored in the ESDK message format, so that is just something you have to know 😦
Hey @seebees,
Yes! That solves my problem perfectly! And it’s much faster than before. Cheers!
Regarding the documentation, I did not find any documentation around the
oaepHash
option for theRawRsaKeyringNode
constructor. In fact, if there are JavaScript-specific API docs I could not find them anywhere. I did find this page which has a couple of simple examples, but there are no API-level docs for this library.Also, how did you know that
oaepHash
should be set to'sha512'
as opposed to'sha384'
or one of the other valid options? I used the AWS Encryption SDK message format reference to decode the message header, body and footer, but I didn’t see any information about what kind of OAEP hash algorithm to use (maybe I missed it).Thanks again!