The SubtleCrypto.decrypt() method returns a Promise of the cleartext corresponding to the ciphertext, algorithm and key given as parameters.
var result = crypto.decrypt(algo, key, ciphertext);
algo is a DOMString defining the decryption function to use. Supported values are: AES-CBC, AES-CTR, AES-GCM, and RSA-OAEP.
key is a CryptoKey containing the key to be used for decryption.ciphertext is a ArrayBuffer or an ArrayBufferView containing the data to be decrypted, the ciphertext.result is a Promise that returns the cleartext generated by the decryption of the ciphertext.The promise is rejected when the following exception is encountered:
InvalidAccessError when the encryption key is not a key for the requested decryption algorithm or when trying to use an algorithm that is either unknown or isn't suitable for decryption.| Specification | Status | Comment |
|---|---|---|
| Web Cryptography API The definition of 'SubtleCrypto.decrypt()' in that specification. | Candidate Recommendation | Initial definition. |
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 37 | (Yes) | 34 (34) | No support | ? | No support |
| Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | (Yes) | 37 | (Yes) | 34.0 (34) | No support | ? | No support |
Crypto and Crypto.subtle.SubtleCrypto, the interface it belongs to.
© 2005–2017 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/SubtleCrypto/decrypt