javascript - 反应原生 rsa-pss 密码学?
问题描述
我的网络应用程序中有这段代码:
let algorithm = {
name: "RSA-PSS",
hash: "SHA-256",
modulusLength: 4096,
publicExponent: new Uint8Array([1, 0, 1]),
saltLength: 32,
};
let keyPair = await crypto.subtle.generateKey(
algorithm,
true,
["sign", "verify"],
);
let [publicKey, privateKey] = await Promise.all([
crypto.subtle.exportKey("spki", keyPair.publicKey),
crypto.subtle.exportKey("pkcs8", ketPair.privateKey),
]);
let newKeyPair = await Promise.all([
crypto.subtle.importKey("spki", publicKey, algorithm, true, ["verify"]),
crypto.subtle.importKey("pkcs8", privateKey, algorithm, true, ["sign"]),
]).then(([publicKey, privateKey]) => ({publicKey, privateKey}));
let signature = await crypto.subtle.sign(
algorithm,
newKeyPair.privateKey,
new TextEncoder().encode(someMessageToSign).buffer,
);
我需要在本机反应中复制它。有没有可以在 Android 和 iOS 上运行的库?
解决方案
推荐阅读
- python - 如何在python中使用opencv读取图像的掩码
- python - 在 python 3.7 中使用 Beautifulsoup 从 WSJ 抓取文章?
- django - ERR_CONNECTION_REFUSED 与 Django 和 Vue.js 捆绑文件
- java - 如何在 Spring Boot 中将多个域添加到 Access-Control-Allow-Origin?
- spring-boot - 弹簧靴 2 | 在接口中定义@RequestMapping
- python - gatk VariantRecalibrator 上的 Snakemake
- java - 在java中的方法中返回不同的数据类型
- c++ - 如何将字节从 std::ostream 流式传输到 std::vector
? - php - Laravel 集合变换/映射方法不一致的行为
- react-native - 如何修复键盘以隐藏 React Native 中的输入字段