简体   繁体   English

是否可以在Phonegap / Cordova应用程序中生成数字签名?

[英]Is it possible to generate digital signatures in Phonegap/Cordova App?

Node.js v6 includes a module that provide cryptographic functionality, including sign and verify functions. Node.js v6包括一个提供加密功能的模块,包括签名和验证功能。

If there isn't a way to sign or verify signatures maybe is there a way to port Node.js module to Cordova or Phonegap? 如果没有办法签名或验证签名可能有办法将Node.js模块移植到Cordova或Phonegap吗?

Basically what i need is way to sign messages and verify the signature from a Cordova App. 基本上我需要的是签署消息并验证Cordova应用程序签名的方法。

https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_sign https://nodejs.org/dist/latest-v6.x/docs/api/crypto.html#crypto_class_sign

I found what i was looking for: 我找到了我要找的东西:

http://kjur.github.io/jsrsasign/ http://kjur.github.io/jsrsasign/

Here a demo of how to generate,sign and verify keys: http://kjur.github.io/jsrsasign/sample-ecdsa.html 这里有一个如何生成,签名和验证密钥的演示: http//kjur.github.io/jsrsasign/sample-ecdsa.html

Incredible, it's pure javascript. 难以置信,这是纯粹的JavaScript。 So is going to work in both platforms iOS and Android. 因此,它将在iOS和Android平台上运行。

My only concerns is to know how secure is use this library for key generation. 我唯一关心的是知道使用这个库进行密钥生成是多么安全。 At least i can generate the keys and send it using secure channel, later sign/verify using the App. 至少我可以生成密钥并使用安全通道发送它,稍后使用App进行签名/验证。

Android has a class to to sign and verify signatures, aptly named Signature . Android有一个类来签名和验证签名,恰当地命名为Signature IOS has similar functionality.Write a cordova plugin which wraps these classes. IOS具有类似的功能。 编写一个包装这些类的cordova插件

Apart from some basic functionality that is provided by webview, everything in cordova is provided via plugins that uses underlying native platform. 除了webview提供的一些基本功能外,cordova中的所有内容都是通过使用底层本机平台的插件提供的。 Thus, it is possible to to sign or verify signatures in Cordova. 因此,可以在Cordova中签名或验证签名。 But it may be more effort than you are willing to do. 但这可能比你愿意付出的努力更多。

It is not possible to execute Node code inside a cordova app, only in hooks, but there are several cryptographic libraries in javascript, which maybe can help you 无法在cordova app中执行Node代码,只能在钩子中执行,但javascript中有几个加密库,可能对你有所帮助

Check cryptojs , or this plugin for cordova 检查cryptojs ,或者这个 cordova的插件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM