Encrypting a string in Javascript and Decrypting in C#
I recently had to figure out a way to encrypt a string sent from a JavaScript app client and then receive that string on an ASP.NET server and subsequently decrypt it. Below is first the client-side JavaScript code, and then the server-side C# code. The key and iv have to be the same on both client and server and should be concealed from any 3rd party if possible. I’ve used a random string “8056483646328763” as both here, but please change it if you use this code. Make sure the size arguments match the size of your key string, so 128/8 (=16) in this case. This…