Django 站点加密
我正在编写一个网站,要求所有数据都加密传输。
昨晚,我考虑在发布表单数据之前对其进行加密,但我刚刚创建了一个用于登录的 Django 表单,并意识到使用操作字段会将数据发送回未加密的服务器。
<form method="post" action="">
{% csrf_token %}
<div id="login_box_user">{{loginForm.userName}}</div>
<div id="login_box_pass">{{loginForm.password}}</div>
<div id="login_box_sbmt"><input id="submitbutton" name="submit" value="Login" type="submit" /></div>
</form>
我想,为了解决这个问题,我需要一个 Javascript 函数作为在发送之前对其进行编码的操作,或者一个 Javascript 提交按钮。
同时,我正在考虑 SSL,但我们目前没有运行服务器,因此我无法将 SSL 证书连接到它以在开发/测试期间使用。 据我了解,使用 SSL 传输的数据将被加密。我想知道当我计划获得 SSL 证书并在我们拥有该网站的域名后使用 SSL 时,加密所有内容是否值得
I am writing a site for which I require all data to be transmitted under encryption.
Last night I was considering encrypting form data before posting it but I've just created a Django form for login and realised that using the action field will send the data back to the server unencrypted.
<form method="post" action="">
{% csrf_token %}
<div id="login_box_user">{{loginForm.userName}}</div>
<div id="login_box_pass">{{loginForm.password}}</div>
<div id="login_box_sbmt"><input id="submitbutton" name="submit" value="Login" type="submit" /></div>
</form>
I'm thinking that in order to get around this, I would need to have a Javascript function as the action to encode it before sending, or a Javascript submit button.
At the same time I'm thinking about SSL but we don't currently have a server running so I wouldn't be able to connect an SSL certificate to it for use during development/testing.
The way I understand it, using SSL the data transmitted would be encrypted. I'm wondering if it is worth the effort of encrypting everything, when I plan to get an SSL certificate and using SSL once we have a domain for the site
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如此处所解释的,JavaScript 中的加密是没有用的。所以 SSL 是您唯一的选择。
Encryption in JavaScript is useless as explained here. So SSL is your only option.
如果您打算使用 https 部署站点,我在这里找到了一些信息:
http://www.redrobotstudios.com/blog/2009/02/18/securing-django-with-ssl/
I've found some information here if you plan to deploy your site with https:
http://www.redrobotstudios.com/blog/2009/02/18/securing-django-with-ssl/