Members
(static, constant) name
The name of the mode.
Methods
(static) decrypt(prp, ciphertext, iv, adataopt)
Decrypt in CBC mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prp |
Object | The block cipher. It must have a block size of 16 bytes. | ||
ciphertext |
bitArray | The ciphertext data. | ||
iv |
bitArray | The initialization value. | ||
adata |
bitArray |
<optional> |
[] | The authenticated data. It must be empty. |
Throws:
-
-
if the IV isn't exactly 128 bits, or if any adata is specified.
-
-
-
if if the message is corrupt.
-
Returns:
The decrypted data, an array of bytes.
(static) encrypt(prp, plaintext, iv, adataopt)
Encrypt in CBC mode with PKCS#5 padding.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prp |
Object | The block cipher. It must have a block size of 16 bytes. | ||
plaintext |
bitArray | The plaintext data. | ||
iv |
bitArray | The initialization value. | ||
adata |
bitArray |
<optional> |
[] | The authenticated data. Must be empty. |
Throws:
-
if the IV isn't exactly 128 bits, or if any adata is specified.
Returns:
The encrypted data, an array of bytes.