Decrypts the provided data.
The parameters for the decryption operation.
A Promise which will be fulfilled with the decrypted data.
The decrypt()
method of the Cipher
interface decrypts encrypted data.
It typically takes the data to decrypt (also known as "ciphertext") and algorithm-specific parameters as input and returns the decrypted data (also known as "plaintext").
Encrypts the provided data.
The parameters for the encryption operation.
A Promise which will be fulfilled with the encrypted data.
The encrypt()
method of the Cipher
interface encrypts data.
It typically takes the data to encrypt (also known as "plaintext") and algorithm-specific parameters as input and returns the encrypted data (also known as "ciphertext").
The
Cipher
interface provides methods for encrypting and decrypting data.It defines two core functions:
encrypt()
for converting plaintext to ciphertext using specific algorithm parameters, anddecrypt()
for the reverse process, turning ciphertext back into plaintext. These methods operate asynchronously and return promises that resolve to the processed data, whether encrypted or decrypted.The interface is designed to be flexible, accommodating various encryption algorithms and their unique parameters. It defaults to using
EnclosedEncryptParams
andEnclosedDecryptParams
, which are intended to be used with a closure that captures the key and algorithm-specific parameters so that arbitrary data can be encrypted and decrypted without exposing the key or parameters to the caller. However, the interface can be extended to support other parameter types, such asEncryptParams
andDecryptParams
, which are intended to be used when the key and algorithm-specific parameters are known to the caller.