Open damms005 opened 2 years ago
I have tried the code below, but the output is just some random stuff rather than the original encrypted string:
const fs = require('fs');
const { Readable } = require("stream")
const { exit } = require('process');
const CryptoJS = require("crypto-js");
const key = '13^07v90';
const iv = '13^07v90';
const [, , pathToEncryptedFile] = process.argv;
if (!pathToEncryptedFile) {
console.log('No file to decrypt')
exit()
}
const encryptedString = fs.readFileSync(pathToEncryptedFile).toString();
let decryptedData = CryptoJS.DES.decrypt(fs.readFileSync(pathToEncryptedFile).toString(), key, {
iv,
padding: CryptoJS.pad.Pkcs7
})
console.log('decrypted data: ', decryptedData.toString())
I have the code below in my C# code. I am migrating same to NodeJS and handling cryptography with Crypto JS (I figured this will be my easiest option, as I have no expertise in cryptography). I need help with how to convert the C# decyption code below to Crypo JS: (I can provide the encryption code too if required)