Code Monkey home page Code Monkey logo

webcrypto-shim's Introduction

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

Sponsored by

BrowserStack โ€” automated & manual crossbrowser testing solution.

webcrypto-shim's People

Contributors

vibornoff avatar dependabot[bot] avatar tomrlq avatar daytonlowell avatar dignifiedquire avatar kevlened avatar ruffio avatar fjandin avatar rileymarsh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.