[Ndn-lib] NDN-JS support for crypto.subtle

Thompson, Jeff jefft0 at remap.UCLA.EDU
Mon Feb 2 14:37:23 PST 2015


Hello all,

NDN-JS now has preliminary support for crypto.subtle (the WebCrypto API). Crypto.subtle is an API so that JavaScript code in browsers can use fast native crypto. If NDN-JS detects that the browser has crypto.subtle, then it will use it. Otherwise it falls back to the (slow) pure JavaScript code. We have tested it in Chrome and Firefox. The speed up is substantial, increasing from 22 signatures per second to 1000 per second with crypto.subtle.

Currently there is support for signing and verifying. Crypto.subtle is asynchronous and returns its results in a callback. This was OK for verify because the NDN-JS call already uses callbacks for onVerified and onVerifyFailed. But for signing, we needed to add an optional callback to KeyChain.sign.  See the doc comment for the onComplete callback:
https://github.com/named-data/ndn-js/blob/82eeee27eff7f94ab10af2112f65e54ce233e797/js/security/key-chain.js#L272

Many thanks to Ryan Bennett for submitting the code to support crypto.subtle.

- Jeff T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-lib/attachments/20150202/160a569e/attachment.html>


More information about the Ndn-lib mailing list