基于密码在javascript中生成RSA密钥对

Generate RSA key pair in javascript, based on a password(基于密码在javascript中生成RSA密钥对)
本文介绍了基于密码在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 的公钥对她的内容(或者实际上是她的内容的 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密钥对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
Ordinals in words javascript(javascript中的序数)
getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)