Oliver Castillo
Oliver Castillo

Reputation: 337

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.

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?

Basically what i need is way to sign messages and verify the signature from a Cordova App.

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

Upvotes: 5

Views: 1895

Answers (3)

Oliver Castillo
Oliver Castillo

Reputation: 337

I found what i was looking for:

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

Here a demo of how to generate,sign and verify keys: http://kjur.github.io/jsrsasign/sample-ecdsa.html

Incredible, it's pure javascript. So is going to work in both platforms iOS and 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.

Upvotes: 2

Atilla Ozgur
Atilla Ozgur

Reputation: 14721

Android has a class to to sign and verify signatures, aptly named Signature. IOS has similar functionality.Write a cordova plugin which wraps these classes.

Apart from some basic functionality that is provided by webview, everything in cordova is provided via plugins that uses underlying native platform. Thus, it is possible to to sign or verify signatures in Cordova. But it may be more effort than you are willing to do.

Upvotes: 1

Víctor
Víctor

Reputation: 3039

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

Check cryptojs, or this plugin for cordova

Upvotes: 0

Related Questions