問題描述
我正在建立一個網站,我的付款方式將是 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:
- 公鑰在 JavaScript 外部文件中,私鑰在服務器上的 PHP 中
- 用戶在表單中輸入他們的用戶名和密碼,然后點擊提交
- JavaScript 運行并加密密碼,將其存儲回文本字段
- 表單提交到服務器,密碼用PHP解密
- PHP 中的純文本密碼是加鹽的 &散列然后與數據庫中的散列進行比較.
- 注冊/更改密碼功能的可能流程類似.
我認為 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 進行解密的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!