I am currently developing an MVC application where I am working on encrypting my password. I have successfully encrypted the password using a click event and it is functioning properly. However, I am now facing the challenge of decrypting the same value in the MVC controller using CryptoJs.
Below is the code snippet:
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/tripledes.js"></script>
var secretString = document.getElementById("txtPassword").value;
var password = "$1$O3JMY.Tw$AdLnLjQ/5jXF9.MTp3gHv/";
debugger;
//document.getElementById("secretstring").innerHTML = secretString;
// var pass = document.getElementById("txtPassword").value;
var encrypted = CryptoJS.TripleDES.encrypt(secretString, password);
// document.getElementById("encryptedstring").innerHTML = encrypted.toString();
//var decrypted = CryptoJS.TripleDES.decrypt(encrypted.toString(), password);
//var finaltext = decrypted.toString(CryptoJS.enc.Utf8);
//document.getElementById("txtPassword").value = encrypted;
I need to transmit the encrypted value to the C# code and decrypt it there using CryptoJs.TripleDES.decrypt.
Can anyone offer assistance with this issue? Your help is greatly appreciated. Thank you in advance.