简体   繁体   中英

How to encrypt with JavaScript and then decrypt with C#

I'm working with ASP.NET MVC4 and here is what i want to do:

I have a Web API that Gets a username, a password and a serial number and return a JSON file with the required data. But as a matter of security, passwords should not figure that clear in the URL, so I changed its implementation into a Web API that gets an encrypted string, that will be decrypted later to extract the three fields.

The problem is when working with a view that calls this Web API, I should encrypt the text fields entered by the user using JavaScript, right? So this encryption with JavaScript should correspond to the decryption method written in C#. Is there any existing way to do that ? Or should I consider this problem differently?

Just use a secure connection ( https:// ssl).

Any encryption you can do in JavaScript can be reversed, since the code used to encrypt the data is available to anyone that uses it, and can easily be reverse-engineered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM