SSL 替代 - 使用 JavaScript 加密密码提交给 PHP 进行解密 [英] SSL Alternative - encrypt password with JavaScript submit to PHP to decrypt

查看:19
本文介绍了SSL 替代 - 使用 JavaScript 加密密码提交给 PHP 进行解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站,我的付款方式将是 Google Checkout 和 Paypal.将有链接/按钮将用户重定向到安全的 Google/Paypal 站点以处理付款.这意味着我不需要为我的网站安装 SSL 证书每年 150 美元的额外费用和复杂性.

I'm building a website and my payment methods will be Google Checkout and Paypal. There will be links/buttons which will redirect the user to the secure Google/Paypal sites for processing the payments. This means I do not need the $150/year added expense and complexity of installing SSL certificates for my site.

但是,我想在用户登录时加密他们的密码,这样如果他们在网络上,一些运行 FireSheep 等的恶意人员就无法读取用户的实际密码,因为它被发送到服务器.网站的其余部分不需要加密,因为它不是真正的敏感数据,可能会显着降低用户体验.

However I would like to encrypt user's passwords as they are logging in so that if they are on a network some malicious person running FireSheep etc can't read the user's actual password as it is being sent to the server. The rest of the site doesn't need encryption as it's not really sensitive data and would probably slow the user experience down significantly.

我的想法是这可以用公钥加密来实现.假设这个过程是这样的:

My thoughts are this could be implemented with public key cryptography. Lets say the process goes something like this:

  1. 公钥在 JavaScript 外部文件中,私钥在服务器上的 PHP 中
  2. 用户在表单中输入他们的用户名和密码,然后点击提交
  3. JavaScript 运行并加密密码,将其存储回文本字段
  4. 表单提交到服务器,密码用PHP解密
  5. PHP 中的纯文本密码是加盐的 &散列然后与数据库中的散列进行比较.
  6. 注册/更改密码功能的可能流程类似.

我认为 RSA 之类的东西可以解决问题.但是我已经在网上寻找一个可用的 JavaScript 库来完成它,但似乎没有一个与可用的 PHP 库兼容.无论如何,它需要生成一组与 JavaScript 和 PHP 兼容的密钥.

I'm thinking something like RSA would do the trick. But I've hunted around the net for a working JavaScript library to do it but none seem to be compatible with the PHP libraries available. At any rate it needs to generate a set of keys that are compatible with the JavaScript and PHP.

有谁知道实际可行的解决方案吗?如果不是我们写一个然后开源它怎么样.不幸的是,编写加密/解密代码非常复杂,所以我真的不知道现有库在做什么以及如何修改它们以使其工作.我已经有了会话固定/劫持的保护,所以我对此不感兴趣.只是对在数据到达网络服务器之前加密数据感兴趣.

Anyone know of an actual working solution for this? If not how about we write one then open source it. Unfortunately writing encryption/decryption code is pretty complex so I don't really know exactly what the existing libraries are doing and how to modify them to make it work. I already have protection for session fixation/hijacking so I'm not interested in that. Just interested in encrypting the data before it gets to the web server.

注意:请不要发布一堆指向独立 Javascript 或 PHP 加密库的链接,我已经在 Google 上找到了这些链接.这实际上没有用.我需要的是 JavaScript 加密和 PHP 解密代码,它们实际上可以和谐地协同工作以产生上述预期结果.

另外,如果您可以避免发布诸如仅使用 SSL"之类的评论.我实际上想要一个解决这个确切问题的方法,即使它不是最佳实践,但它仍然很有趣.

非常感谢!

推荐答案

http://www.jcryption.org/ -- 是你要找的组合.

http://www.jcryption.org/ -- Is the combination you are looking for.

这篇关于SSL 替代 - 使用 JavaScript 加密密码提交给 PHP 进行解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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