简体   繁体   中英

Decrypting data with javascript - ASP.NET website

I use a hidden variable (input type=hidden) to store ID information on a page. To prevent attackers, I decided to encrypt the data stored using System.Security.Cryptography .

The hidden variable is accessed in JS and executes validation logic. I will need to decrypt the data before executing the validation logic. Is there a way to decrypt data in JS that was encrypted using System.Security.Cryptography

If you can decrypt it using JavaScript on the client side, so can any attacker. This approach is flawed for that reason. The Validation logic also needs to be done server side. You should never trust client side validation for anything that could potentially hurt your site.

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