Unsupported state or unable to authenticate data
See original GitHub issueI can’t decrypt this string. I encrypted a string with the following key, which I read from a file using fs and encoding utf-8. Then I tried to decrypt it and got the error in the image below.
My Key: attention, the key below has an empty line at the end
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAtLUeYvKWtAzhgeCM/bdQrirG+1m1OyDgM5bJfzyOE0Qd7Zyb
IhLrJ/jQpuYQ3tqdwXJBozRLpj9S4zid7S75SF+bvPGU5QY9fhCxJYbyf8yaiQ+v
vIQf6cbhOYOKtm16rRdxX2wJj28ETx8SWmRgTkLGlDmGkiUSAWr/8QMWSYuCnG1c
470v3f/PvUC4XlohZWBPs2uZGUge27shKluclGwryojH6AaCr/h5fSjHBQxcChp2
Yp/Qx2QU5fVbQpZNZ2cvvGCCTJbu4CX381jL+T4twQa5JWPZC1u1sI/VvmEVCRto
VhcErP/lCRJk2Qcp1c4A+QFySb+l9HGkVwq3BwIDAQABAoIBADecJSW+EbKG5D7b
o4fQifuPHnzrNmJj05sMpCWLtQ0owS0GLJdnywYaA9vYoQhzrmiBiMF4rm8Svac/
HRqIgh5LjdmvXmq8aOAKsvkhdi7uAAB9207gOhHvKhBQ8rcBKedqd3EuBiMlvuW6
YiN/EEQFOKcUrNz8m3XkP68jjBBFYYSp3CKTyNjz2e5uYMNvWyPnzWCy2PoAYzoJ
SMV/WYHWf6WIt6xNkJ83HjQmR3hnP2d7z7c9ahxods4Uorxr1orYCLOsW1QuU/mG
ZEnfpMDq93l3M6FuEfLn7olF131UKMMNRow8GmnYn8pNIUsb0QPI0btXADEPEDHI
34gEkAECgYEA7OpYmkbKLFmeF7KzBCENKjsb1hFHJrXzutIXHRGXS3IxOJtkDd+g
WEGq16OXDF/3xie3K2IHjnzllEXtuTsxdh32dmiRCcQxQyPLDRMLgSZPjtOsuDYG
XHSzVRXDzFz3KYIB+AF8Aew4Auba7BOZY3yFVbZ7Eq5I9X15OWYBKwECgYEAw0Oo
GEMuyA1PGWVVJxDsT5I22f7AGN0RM6unBtqeWdoHwFwFylFySfOJReiKkyjnmkRX
BBVyxV1zZJ3aiSLuZkgjZtL8EAi7ReLPuWtfFJc53LaIco7fuoUQ89Uhh5AuPBCE
cvOYL0G0+Y3LR1CVu2MCVBRpyz8QuF/n2U/UigcCgYAjsrAFFxORmTNUGM4WmjBU
o7FvEQ1qjNIb3Vo0PBlS+fLmt6tc18xeYA6xDWpOKAu6pPNZqxy+YJ1rORo35e5v
ANbJQrpQAWr21ebbonoCTNaCC+0jmKheuArpkCz/lyZ676cCSp733zMVZNmp5s4f
Cn1AzA1BZFeD/hMNDgyxAQKBgFhDZOBSvfq/yVl5bJxUEf2F4jV36e1TQEtS9BUt
DRcgbxCMiDGDz12OMCbhjoImo0ogShUWfOKp81cv43DJ0Wl6gkYgaL/2snBMrgjq
d/gew5D5EYR3ALqXG6qcVKOqkLul27j6U3hJAz0q0xBRZN1nS84lzAyLXUt6Tpr0
cuZRAoGBAKb0s3EHlDlTfCV9XBhJxXMBpmTDBI7n9YswyVsjo83VS13Ux3NqGuVA
2vb7GdgEOWzAWne03I+A47b6EDCwVyduLCQ8UqKmda6xSbf93Vwzet4RgzyO6xTL
UkecGtAgt9zQZ349rtyJjZz9ePCCkH/kTfUHXrxTjfhLyYVqlaJy
-----END RSA PRIVATE KEY-----
Encrypted String: 92df937f687b10f8c3c4ff6629bec84a0a5acfb9ba76243ee9d24e81a9b005394028740197f19aa27ccff3a373897f164c70837abf3eab0a193276a90a78ab2bbe636270df2809064f42ffbe1b3b066af627c3629d6bbb253f82b02434772065f3a552509fbbdbe7702c7c2dd5dc8e37fab94f00b62428e7df025e77f9bb0f9ebe0f830cd1ff39e4875d6c048efb856d3d224bb5db02d53b88bd7a14a6feb2a152e0c66a4eb4adf11f1b190a096a90e22a3a3cd4b64b5e
Error:

Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (4 by maintainers)
Top Results From Across the Web
"Unsupported state or unable to authenticate data" with aes ...
I'm trying to implement encrypt/decrypt functions using aes-128-gcm as provided by node crypto. From my understanding, gcm encrypts the ...
Read more >crypto decrypt data got error "Unsupported state or unable to ...
Error : Unsupported state or unable to authenticate data at Decipheriv.final (internal/crypto/cipher.js:172:29) at Object.
Read more >Node.js – “Unsupported state or unable to authenticate data ...
I'm trying to implement encrypt/decrypt functions using aes-128-gcm as provided by node crypto. From my understanding, gcm encrypts the ciphertext but also ...
Read more >Cannot decrypt a file with nodejs : r/learnjavascript - Reddit
Last line gives me an error: Error: Unsupported state or unable to authenticate data. Encryping seems to work because I get a new...
Read more >Error: Unsupported state or unable to authenticate data - Kibana
When I create new reports I (sometimes) get the message "Error: Unsupported state or unable to authenticate data" on top of my display....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ok so i found the issue. Make sure your key size is max of 64bytes
same issue here https://sourceb.in/0OKwvFvNmH