Share via

Web Cryptography API updates

The Web Cryptography API provides basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption.

Since its initial implementation in Internet Explorer 11, the World Wide Web Consortium (W3C) specification has changed significantly. The Microsoft Edge implementation has been updated to reflect these changes.

Promise-based model

The W3C Web Cryptography API specification has changed from an event-driven model to a new model based on JavaScript Promises. Microsoft Edge introduces support for this new model and removes support for the legacy model.

The following table summarizes the API changes across versions.

Web Cryptography API area IE11 Microsoft Edge
CryptoOperation object Supported Not supported
KeyOperation object Supported Not supported
window.crypto property Supported behind vendor prefix (window.msCrypto) Supported (no prefix)
Key.type property Return type DOMString Return type KeyType
Key.algorithm property Return type Algorithm Return type KeyAlgorithm
Key.keyUsage property Return type sequence<DOMString> Return type sequence<KeyUsage>
SubtleCrypto methods (encrypt, decrypt, sign, verify, digest, generateKey, importKey, exportKey, wrapKey, unwrapKey) Return type CryptoOperation or KeyOperation Return type Promise; Changes to various parameter types (see spec for details)
onabort, oncomplete, onerror, onprogress event callbacks Supported Not supported