据我了解,RSA 密钥通常是基于(强)随机生成器生成的.
As far as I understand, RSA keys are usually generated based on a (strong) random generator.
相反,我想根据密码创建它们.
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 库可以根据给定的输入确定性地创建 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)
补充:我需要这个,因为我正在构建一些安全的通信解决方案,不需要依赖连接甚至服务器来保证安全.
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 加密所有内容,并且这些密钥是 RSA 加密的.这个想法是 Alice 可以使用 Bob 的公钥对她的内容(或者实际上是她的内容的 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 私有 &现场公钥,从 Alice 那里下载内容,并使用他的私钥在本地解密.
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密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!