Encrypts data with AES in CBC mode and returns the ciphertext. The key must be 16, 24, or 32 raw bytes (or Base64 of those), and the IV must be 16 bytes. CBC is the only supported mode.

Parameters

string
required
The data to encrypt.
string
required
A 16, 24, or 32 byte key, raw or Base64.
string
required
A 16 byte initialization vector, raw or Base64.
string
default:"CBC"
The cipher mode. Only “CBC” is supported.

Returns

string
The encrypted bytes.

Example

Errors