crypto decrypting #4763
Unanswered
Sxamoecode
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
function decrypt(text) { let iv = Buffer.from(text.iv, 'hex'); let encryptedText = Buffer.from(text.encryptedData, 'hex'); let decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(key), iv); decipher.setAutoPadding(true) let decrypted = decipher.update(encryptedText); decrypted = Buffer.concat([decrypted, decipher.final()]); //console.log(decrypted); return decrypted.toString();
I'm trying to decode a saved encrypted data on a database but returning =
error:1C800064:Provider routines::bad decrypt
when i decrypt` const see = await User.findOne({ email: user}); //JSON.stringify(user)
Beta Was this translation helpful? Give feedback.
All reactions