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 Compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support11122611156.1
subtle3712

34

32 — 341

1124

10.1

7 webkit

getRandomValues11122611154
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support11111226146.1 Yes
subtle373712

34

32 — 341

24

10.1

7 webkit

Yes
getRandomValues11111226144 Yes

1. 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.

See Also

Document Tags and Contributors

Contributors to this page: fscholz, soanvig, jpmedley, Sebastianz, teoli, Noitidart, njoyce
Last updated by: fscholz,