在javascript中根据密码生成RSA密钥对 [英] Generate RSA key pair in javascript, based on a password

查看:1445
本文介绍了在javascript中根据密码生成RSA密钥对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的理解,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的公钥(因此Bob的公钥必须在线存储)对其内容(或者实际上是她的内容的AES密钥)进行RSA加密。

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私人&

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密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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