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 areaIE11Microsoft Edge
CryptoOperation objectSupportedNot supported
KeyOperation objectSupportedNot supported
window.crypto propertySupported behind vendor prefix (window.msCrypto)Supported (no prefix)
Key.type propertyReturn type DOMStringReturn type KeyType
Key.algorithm propertyReturn type AlgorithmReturn type KeyAlgorithm
Key.keyUsage propertyReturn type sequence<DOMString>Return type sequence<KeyUsage>
SubtleCrypto methods (encrypt, decrypt, sign, verify, digest, generateKey, importKey, exportKey, wrapKey, unwrapKey)Return type CryptoOperation or KeyOperationReturn type Promise; Changes to various parameter types (see spec for details)
onabort, oncomplete, onerror, onprogress event callbacks SupportedNot supported

 

 

 

Show: