vibornoff / webcrypto-shim

Web Cryptography API shim for legacy browsers

Home Page:https://vibornoff.github.io/webcrypto-shim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PBKDF2 for IE11

ValeryEliseev opened this issue · comments

Can you add PBKDF2 algorithm into webcrypto-shim for Internet Explorer 11 and other legacy browsers?
I'm know about asmCrypto, node-forge and similar solutions.
It would be useful to do WebCrypto-style PBKDF2, based on native browser SHA hash implementation to crossbrowser support.

Unfortunately it would be damn slow to base PBKDF2 on native browser SHA implementations due to the fact that each call to digest is asyncronous.

commented

Could you please elaborate your answer? The asmcrypto lib also does PBKDF2 in JS and it is fast.

This lib doesn't implement crypto algorithms itself. It only adapts those already implemented in your browser. @ValeryEliseev asked if it would be practical to implement PBKDF2 basing on SHA via WebCrypto API. Short answer is no.

I would say it's worth extending this shim by creating small wrappers for libraries like SJCL and CryptoJS, they seem to have working implementations of PBKDF2. https://jswebcrypto.azurewebsites.net/demo.html#/pbkdf2
iOS still doesn't have the implementation of PBKDF2 in place, yet most browsers support it.

@vflyson , ok, feel free to implement it and make pull request.
Your implementation should be:

  • asynchronous (e.g. run via web worker)
  • single-source (web worker and PBKDF implementation must be deployed in one single js file)

And also take a look to https://github.com/vibornoff/asmcrypto.js -- it has the fastest non-native PBKDF2.