decrypt method

Decrypts buffer's data using the algorithm and key parameters.

Important  As of Microsoft Edge, this method returns a Promise object. See Web Cryptography API updates for more info.
IE11

 

Syntax

var retVal = SubtleCrypto.decrypt(algorithm, key, buffer);

Parameters

algorithm [in]

Type: any

A valid algorithm object.

key [in]

Type: Key

A valid Key object.

buffer [in, optional]

Type: ArrayBufferView

An ArrayBufferView object containing the data to decrypt. If this parameter is specified, the returned operation will immediately complete and return with the decrypted data. Otherwise, the caller is expected to perform the following tasks:

  1. Provide data through any number of calls to the process method of the CryptoOperation object returned by this (decrypt) method.
  2. Call the finish method (on this same CryptoOperation object) when done entering data via the process method.

Once the above two steps are completed, the operation will be completed and the decrypted data returned.

Return value

Type: Promise

A Promise object that will decrypt data using the specified algorithm with the supplied key.

Note  IE11 returns a CryptoOperation. See Web Cryptography API updates for more info.

Remarks

The decrypt method supports the following cryptographic algorithms:

  • AES-CBC
  • AES-GCM
  • RSAES-PKCS1-v1_5
  • RSA-OAEP

For an example, see encrypt.

See also

SubtleCrypto
encrypt

 

 

Show: