W3cubDocs

/DOM

Crypto

The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.

An object with this interface is available on Web context via the Window.crypto property.

Properties

This interface implements properties defined on RandomSource.

Crypto.subtle Read only
Returns a SubtleCrypto object providing access to common cryptographic primitives, like hashing, signing, encryption or decryption.

Methods

This interface implements methods defined on RandomSource.

Crypto.getRandomValues()
Fills the passed TypedArray with cryptographically sound random values.

Specifications

Specification Status Comment
Web Cryptography API
The definition of 'Crypto' in that specification.
Recommendation Initial definition

Browser CompatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 11 12 26 11 15 6.1
subtle 37 12 34
34
32 — 34
Disabled
Disabled From version 32 until version 34 (exclusive): this feature is behind the dom.webcrypto.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
11 24 10.1
10.1
7
Prefixed
Prefixed Requires the vendor prefix: webkit
getRandomValues 11 12 26 11 15 4
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes 18 12 26 14 6.1 Yes
subtle 37 37 12 34
34
32 — 34
Disabled
Disabled From version 32 until version 34 (exclusive): this feature is behind the dom.webcrypto.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
24 10.1
10.1
7
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes
getRandomValues Yes 18 12 26 14 4 Yes

See Also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Crypto