The Web Crypto API is an interface allowing a script to use cryptographic primitives in order to build systems using cryptography.
Warning: The Web Crypto API provides a number of low-level cryptographic primitives. It's very easy to misuse them, and the pitfalls involved can be very subtle.
Even assuming you use the basic cryptographic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts.
Errors in security system design and implementation can make the security of the system completely ineffective.
If you're not sure you know what you are doing, you probably shouldn't be using this API.
Interfaces
Some browsers implemented an interface called Crypto
without having it well defined or being cryptographically sound. In order to avoid confusion, methods and properties of this interface have been removed from browsers implementing the Web Crypto API, and all Web Crypto API methods are available on a new interface: SubtleCrypto
. The Crypto.subtle
property gives access to an object implementing it.
Specifications
Specification | Status | Comment |
---|---|---|
Web Cryptography API | Recommendation | Initial definition |
Browser compatibility
Crypto
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Crypto
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 26 |
IE
Full support 11 |
Opera
Full support 15 |
Safari
Full support 6.1 |
WebView Android
Full support Yes |
Chrome Android
Full support 18 |
Firefox Android
Full support 26 |
Opera Android
Full support 14 |
Safari iOS
Full support 6.1 |
Samsung Internet Android
Full support 1.0 |
getRandomValues()
|
Chrome
Full support 11 |
Edge
Full support 12 |
Firefox
Full support 26 |
IE
Full support 11 |
Opera
Full support 15 |
Safari
Full support 6.1 |
WebView Android
Full support ≤37 |
Chrome Android
Full support 18 |
Firefox Android
Full support 26 |
Opera Android
Full support 14 |
Safari iOS
Full support 6.1 |
Samsung Internet Android
Full support 1.0 |
Chrome
Full support 37 |
Edge
Full support 12 |
Firefox Full support 34 Full support 34 No support 32 — 34 Disabled' From version 32 until version 34 (exclusive): this feature is behind the |
IE
Partial support 11 |
Opera
Full support 24 |
Safari Full support 10.1 Full support 10.1 Full support 7 Prefixed' Implemented with the vendor prefix: webkit |
WebView Android
Full support 37 |
Chrome Android
Full support 37 |
Firefox Android Full support 34 Full support 34 No support 32 — 34 Disabled' From version 32 until version 34 (exclusive): this feature is behind the |
Opera Android
Full support 24 |
Safari iOS Full support 10.3 Full support 10.3 Full support 7 Prefixed' Implemented with the vendor prefix: webkit |
Samsung Internet Android
Full support 3.0 |
Legend
- Full support
- Full support
- Partial support
- Partial support
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
Web Crypto API by Mozilla Contributors is licensed under CC-BY-SA 2.5.