Members
(static, constant) name
The name of the mode.
Methods
(static) _ctrMode(encrypt, prf, data, iv, adata, tlen)
GCM CTR mode.
Encrypt or decrypt data and tag with the prf in GCM-style CTR mode.
Parameters:
Name | Type | Description |
---|---|---|
encrypt |
Boolean | True if encrypt, false if decrypt. |
prf |
Object | The PRF. |
data |
bitArray | The data to be encrypted or decrypted. |
iv |
bitArray | The initialization vector. |
adata |
bitArray | The associated data to be tagged. |
tlen |
Number | The length of the tag, in bits. |
(static) decrypt(prf, ciphertext, iv, adataopt, tlenopt) → {bitArray}
Decrypt in GCM mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prf |
Object | The pseudorandom function. 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. |
tlen |
Number |
<optional> |
128 | The desired tag length, in bits. |
Returns:
The decrypted data.
- Type
- bitArray
(static) encrypt(prf, plaintext, iv, adataopt, tlenopt) → {bitArray}
Encrypt in GCM mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
prf |
Object | The pseudorandom function. 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. |
tlen |
Number |
<optional> |
128 | The desired tag length, in bits. |
Returns:
The encrypted data, an array of bytes.
- Type
- bitArray