問題描述
據(jù)我了解,RSA 密鑰通常是基于(強)隨機生成器生成的.
As far as I understand, RSA keys are usually generated based on a (strong) random generator.
相反,我想根據(jù)密碼創(chuàng)建它們.
Instead, I want to create them based on a password.
或者更確切地說是在其哈希上,例如 sha512(sha512(password+salt)+password+pepper)
Or rather on its hash, for example sha512(sha512(password+salt)+password+pepper)
這需要在客戶端用 JavaScript 完成.
This needs to be done client side, in JavaScript.
有人知道怎么做嗎?是否有一個簡單的 JavaScript 庫可以根據(jù)給定的輸入確定性地創(chuàng)建 RSA 密鑰對?
Would anyone know how to do this? Is there an easy JavaScript library that creates RSA key pairs deterministically, based on a given input?
(實際上,我說的是 RSA,但任何安全的非對稱加密就足夠了,我只需要公私加密)
(Actually, I'm mentioning RSA but any secure asymmetrical encryption would suffice, I just need public-private encryption)
補充:我需要這個,因為我正在構(gòu)建一些安全的通信解決方案,不需要依賴連接甚至服務器來保證安全.
Addition: I need this because I'm building some secure communication solution, that doesn't need to rely on the connection or even the server to be secure.
我正在使用隨機密鑰使用 AES 加密所有內(nèi)容,并且這些密鑰是 RSA 加密的.這個想法是 Alice 可以使用 Bob 的公鑰對她的內(nèi)容(或者實際上是她的內(nèi)容的 AES 密鑰)進行 RSA 加密(因此 Bob 的公鑰必須在線存儲).
I'm encrypting all content with AES using random keys, and the keys are RSA-encrypted. The idea is Alice can RSA-encrypt her content (or actually, the AES-key for her content) with Bob's public key (therefore Bob's public key must be stored online).
稍后,當 Bob 再次輸入他的密碼時,他的瀏覽器可以確定性地計算他的 RSA 私有 &現(xiàn)場公鑰,從 Alice 那里下載內(nèi)容,并使用他的私鑰在本地解密.
Later, when Bob enters his password again, his browser can deterministically calculate his RSA private & public key on the spot, download the content from Alice, and decrypt it locally using his private key.
推薦答案
看起來像 Cryptico當您將密碼作為 RNG 的種子時,可以為您提供幫助.
Looks like Cryptico can help you, when you feed your password as a seed for RNG.
這篇關于基于密碼在javascript中生成RSA密鑰對的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!