[英]How to generate KeyPair in IOS and Android using Cordova?
I am creating a banking app using angularjs1 and ionic1 for IOS and Android. 我正在使用用于iOS和Android的angularjs1和ionic1创建银行应用程序。 Due to some security concerns from clients the device should generate public and private key using SHA/RSA.
由于客户端的某些安全问题, 设备应使用SHA / RSA生成公钥和私钥。 I don't want to use any javascript plugin, strictly denied by the client.
我不想使用任何JavaScript插件,但客户端严格拒绝。 I digged a lot, OpenSSL and LetsEncrypt are the only options left as far as I know.
据我所知, OpenSSL和LetsEncrypt是我所知的唯一剩下的选项。 Both the websites discuss manual command prompt key generation on an operating system.
这两个网站都讨论了在操作系统上手动生成命令提示符键的问题。 I want a mechanism where I can:
我想要一种可以做到的机制:
signature = RSA256SignData(ASCIIBytes(data to be signed), rsaPrivateKey) 签名= RSA256SignData(ASCIIBytes(要签名的数据),rsaPrivateKey)
Encoded Signature = Base64Encode(signature) 编码签名= Base64Encode(签名)
I couldn't find any cordova plugin which can handle this. 我找不到任何可以处理此问题的cordova插件。 If there is no cordova plugin I'll be glad if anyone can tell me to do this in pieces or anything which is native.
如果没有cordova插件,如果有人可以告诉我分步进行或进行任何本地操作,我将非常高兴。
Thanks. 谢谢。
I do not know of a Cordova plugin that can accomplish these tasks. 我不知道可以完成这些任务的Cordova插件。
There are some excellent javascript libraries that do provide these functions. 有一些出色的javascript库确实提供了这些功能。 Have a look at node-jose which allows you to work with JWK, JWE and JWS.
看一下node-jose ,它使您可以使用JWK,JWE和JWS。 The library depends on (a slightly altered version of) node-forge which can do almost anything, including generating a keypair and signing/hashing data.
该库依赖于node-forge (略有改动的版本),它几乎可以执行任何操作,包括生成密钥对和签名/哈希数据。
The only drawback of using these libraries is that the speed may not be sufficient for the mobile devices you need to support. 使用这些库的唯一缺点是速度可能不足以支持您需要支持的移动设备。 My personal experience is that mobile devices are perfectly capable of working with 1024-bit keypairs.
我的个人经验是,移动设备完全能够使用1024位密钥对。 Working with 2048-bits is somewhat slow and generating a 2048-bit pair simply takes too long on most devices.
使用2048位比较慢,并且在大多数设备上生成2048位对仅花费太长时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.