Javascript - 使用密码加密数据的最佳方式 [英] Javascript - Best way to encrypt data with password

查看:125
本文介绍了Javascript - 使用密码加密数据的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个可以在网络上存储包含应用程序设置的cookie的服务器。服务器将接受任何数据,但我想在将它们存储在cookie中之前对所有设置进行加密,并在读取它们时对其进行解密。因此,我可以存储非常敏感的数据,例如帐户用户名和帐户Cookie和服务器中的密码无法对其执行任何操作。

I'm creating a server which can store cookies on the web that will contain application settings. The server will accept any data, but I want to encrypt all the settings before storing them in a cookie and decrypt them when reading them out. So I can store very sensitive data like Account Usernames & Passwords in the cookies and the server cannot do anything with it.

我现在的问题是:在客户端上使用JavaScript密码加密此类数据的最佳方法是什么?侧?什么是最安全的?

My question is now: What is the best way to encrypt such data with a password in JavaScript on the client side? What is the most secure?

我需要一些代码,我可以将其嵌入到我的网站中并从那里使用它。

I need some code that I can embed into my site and use it from there.

推荐答案

我建议您在JavaScript代码中使用AES加密。有关库和链接,请参阅 Javascript AES加密。您遇到的麻烦就是选择仅在客户端提供的密钥。也许你可以提示用户?或者将一些未发送到服务器的客户端系统信息混合在一起。

I'd recommend using AES encryption in your JavaScript code. See Javascript AES encryption for libraries and links. The trouble you'll have is picking a key that is only available on the client side. Perhaps you can prompt the user? Or hash together some client system information that's not sent to the server.

这篇关于Javascript - 使用密码加密数据的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆