javascript 如何加密发送到服务器的http请求?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7995761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to encrypt the http request sent to server?
提问by Ved
Is it possible to hide the contents (or encrypt it) of an HTTP request so that no other than authorize person can view it ?? For example, if one user is just submitting a data to in Login page even if using the http post, then also it is possible to see the contents like username and password which are contained in request headers in firebug kind of tools.
是否可以隐藏(或加密)HTTP 请求的内容,以便授权人以外的人可以查看它?例如,如果一个用户只是在登录页面中提交数据,即使使用 http 帖子,那么也有可能在 firebug 类工具中看到包含在请求标头中的用户名和密码等内容。
I know that encryption algorithm at client side may be used but still data goes in HTTP request is visible.
我知道可能会使用客户端的加密算法,但仍然可以看到 HTTP 请求中的数据。
Any solutions ??? Thanks in advance...
有什么解决办法???提前致谢...
回答by James Hill
The standard method for encrypting web traffic is an SSL certificate. Their use is easily recognized by the httpsprotocol specification. - http://en.wikipedia.org/wiki/Https
加密 Web 流量的标准方法是 SSL 证书。https协议规范很容易识别它们的使用。- http://en.wikipedia.org/wiki/Https
SSL Certificates can be purchased easily online. Below are a couple of vendors that I use:
SSL 证书可以很容易地在线购买。以下是我使用的几个供应商:
回答by nfechner
The answer depends a lot on the setup you are looking for. If you just want to prevent anyone from listening in on the traffic, use HTTPSfor the requests.
答案很大程度上取决于您正在寻找的设置。如果您只想阻止任何人侦听流量,请对请求使用HTTPS。
If you want to encrypt the data you are sending with a specific password, check out the Stanford Javascript Crypto Library.
如果您想使用特定密码对发送的数据进行加密,请查看斯坦福 Javascript 加密库。
回答by David Horák
You must use HTTPSprotocol
您必须使用HTTPS协议