webcrypto-shim

Web Cryptography API shim for legacy browsers

  • Owner: vibornoff/webcrypto-shim
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

webcrypto-shim.js

Web Cryptography API shim for legacy browsers.

Quick start with Bower

Install the package

$ bower install webcrypto-shim

and link scripts into your html code

<script src="bower_components/promiz/promiz.js"></script>
<script src="bower_components/webcrypto-shim/webcrypto-shim.js"></script>

Now you can use webcrypto api through the window.crypto and window.crypto.subtle objects.

Note that IE11 lacks support of Promise-s and requires promiz.js to work properly. You can replace promiz.js with any Promise/A+-compatible implementation.

Supported browsers

The library is targeted to fix these browsers having prefixed and buggy webcrypto api implementations:

  • Internet Explorer 11, Mobile Internet Explorer 11,
  • Safari 8 - 10, iOS Safari 8 - 10.

These browsers have unprefixed and conforming webcrypto api implementations, so no need in shim:

  • Chrome 43+, Chrome for Android 44+,
  • Opera 24+,
  • Firefox 34+,
  • Edge 12+.
  • Safari 11+.

Crossbrowser support of algorithms & operations

  • SHA-256, SHA-384: digest

  • HMAC: sign, verify, generateKey, importKey, exportKey

    • with hash SHA-1, SHA-256, SHA-384
  • AES-CBC: encrypt, decrypt, generateKey, importKey, exportKey, wrapKey, unwrapKey

    • TODO tests
  • AES-KW: generateKey, importKey, exportKey, wrapKey, unwrapKey

    • TODO tests
  • RSASSA-PKCS1-v1_5: sign, verify, generateKey, importKey, exportKey

    • with hash SHA-256, SHA-384
    • and modulusLength at least 2048 bits
  • RSA-OAEP: encrypt, decrypt, generateKey, importKey, exportKey, wrapKey, unwrapKey

    • with hash SHA-1
    • and modulusLength at least 2048 bits
    • FIXME only "jwk" format for wrapped/unwrapped keys

Known limitations

deriveKey, deriveBits are not supported under IE11 and Safari since there is no implementation of any algorithm providing key derivation.

Under IE11 exception is thrown in case of empty input data since IE11 silently discards empty data and leaves returned Promise object never resolved nor rejected.

Other browsers support

See https://vibornoff.github.io/webcrypto-examples/index.html

BrowserStack — automated & manual crossbrowser testing solution.

Main metrics

Overview
Name With Ownervibornoff/webcrypto-shim
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2015-08-08 01:14:49
Pushed At2021-03-23 08:44:58
Last Commit At2021-03-23 11:36:51
Release Count7
Last Release Namev0.1.7 (Posted on 2021-03-23 11:44:07)
First Release Namev0.1.1 (Posted on 2016-02-26 15:49:11)
用户参与
Stargazers Count121
Watchers Count15
Fork Count38
Commits Count85
Has Issues Enabled
Issues Count31
Issue Open Count6
Pull Requests Count13
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private