我想知道如何用RSA方法的公钥加密数据并传递到后端。目前,我看到了react本机-rsa-本机库,将其安装在项目中,并使用命令“rsa本机链接-本机-本机-rsa-本地”链接。但项目仍然不了解图书馆。并显示错误。
TypeError: Cannot read property 'generateKeys' of undefined.这是我根据库文档编写的测试代码。
RSA.generateKeys(4096) // set key size
.then(keys => {
console.log('4096 private:', keys.private); // the private key
console.log('4096 public:', keys.public); // the public key
RSA.encrypt(token, keys.public)
.then(encodedMessage => {
console.log(`the encoded message is ${encodedMessage}`);
RSA.decrypt(encodedMessage, keys.private)
.then(decryptedMessage => {
console.log(`The original message was ${decryptedMessage}`);
});
});});
请给我建议的方式,我可以加密的数据与反应本机的RSA method.React本机版本的项目是0.59。对于iOS,它支持从iOS版本9开始。
compileSdkVersion = 29
minSdkVersion = 19
targetSdkVersion = 29
buildToolsVersion = "28.0.3"
supportLibVersion = "28.0.0"
supportAndroidVersion = "28.0.0"

发布于 2021-03-23 17:59:05
似乎有关联的问题。您能否尝试在Pod文件中手动链接它并检查它在IOS模拟器中是否有效。
pod‘react本机-rsa-本机’,:path =>‘./node_modules/react本机-rsa-本机’
https://stackoverflow.com/questions/65209947
复制相似问题