标题说明了一切.我想知道如何使用WebCrypto API生成RSA密钥对,如何使用密码保护它,以便将其存储在数据库中.
javascript cryptography passphrase webcrypto-api private-key
我想使用 Google 的 Apps Script 服务创建一个公钥/私钥 RSA。我找到了文档,但没有看到类似“生成密钥”或类似在 c# 中使用RSACryptoServiceProvider何时可以创建密钥并将其导出到 XML。
我看看这个文档https://developers.google.com/apps-script/reference/utilities/
var signature = Utilities.computeRsaSha256Signature("this is my input",
"-----BEGIN PRIVATE KEY-----\nprivatekeyhere\n-----END PRIVATE KEY-----\n");
Run Code Online (Sandbox Code Playgroud)
如何生成我的“KEY” 正确的方法是什么?
为了澄清我的要求,在 c# 中我们可以这样做。
using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(keySize))
{
privateKey = RSA.ToXmlString(true);
}
Run Code Online (Sandbox Code Playgroud)
这将生成一个私钥运行时,我尝试用 Apps 脚本做同样的事情,这可能吗?
事实上,我已经有了一个可以生成 RSA 密钥的 javascript 类,但是在 .Gs 代码文件中运行它需要很长时间。我的 Javascript 代码在浏览器中运行良好,但是当它运行到 .gs 文件时......它看起来非常慢
我正在寻找来自 Google 的“本机”服务来完成它..