Encrypts buffer's data using the algorithm and key parameters.
Syntaxvar retVal = SubtleCrypto.encrypt(algorithm, key, buffer);
- algorithm [in]
A valid algorithm object.
- key [in]
A valid Key object.
- buffer [in, optional]
An ArrayBufferView object containing the data to encrypt. If this parameter is specified, the returned operation will immediately complete and return with the encrypted data. Otherwise, the caller is expected to perform the following tasks:
- Provide data through any number of calls to the process method of the CryptoOperation object returned by this (encrypt) method.
- 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 encrypted data returned.
A Promise object that will encrypt data using the specified algorithm with the supplied key.
The encrypt method supports the following cryptographic algorithms: