I am trying to convert a .net decryption method to nodejs
public static string Decrypt(string strEnCryptedText)
{
string strDecryption;
strDecryption = strEnCryptedText.Replace("~", "/");
strDecryption = strDecryption.Replace("~", "\\");
SymmetricAlgorithm mCSP = new DESCryptoServiceProvider();
ICryptoTransform ct;
System.IO.MemoryStream ms;
CryptoStream cs;
byte[] byt;
byte[] key = { 0, 154, ...,...,... };
byte[] IV = { 5, 10, ...,...,... };
try
{
byt = Convert.FromBase64String(strDecryption);
ct = mCSP.CreateDecryptor(key, IV);
ms = new System.IO.MemoryStream();
cs = new CryptoStream(ms, ct, CryptoStreamMode.Write);
cs.Write(byt, 0, byt.Length);
cs.FlushFinalBlock();
cs.Close();
return Encoding.UTF8.GetString(ms.ToArray());
}
catch
{
return "";
}
}
Any hints/suggestions would be helpful!