GcmContextBuilder
Provides support for building GCM (Galois/Counter Mode) cipher contexts.
Extends
Accessors
additionalData
Set Signature
set additionalData(
data
):void
Specify additional authentication data (AAD) to be included in the GCM context.
Remarks
This parameter is optional.
Parameters
data
ArrayBuffer
The additional data to include.
Returns
void
iv
Set Signature
set iv(
iv
):void
Specify the initialization vector (IV) to use. Use a 4-byte array when intending to use a randomized sequence of nonces (the IV is used as an identifier to differentiate the sequence). Otherwise, set it with an array of length equal to the value returned by the ivSize() API (in that case the IV is used as an arbitrary nonce).
Remarks
This parameter is mandatory.
Parameters
iv
ArrayBuffer
The initialization vector to use.
Returns
void
ivSize
Get Signature
get ivSize():
number
Get the size of the initialization vector (IV) for the GCM cipher when used as an arbitrary nonce.
Returns
number
The size of the IV in bytes.
key
Set Signature
set key(
key
):void
Specify the symmetric key to be used for encryption or decryption.
Remarks
This parameter is mandatory.
Parameters
key
The symmetric key to use.
Returns
void
Inherited from
tagLength
Set Signature
set tagLength(
length
):void
Specify the desired length of the authentication tag.
Remarks
This parameter is optional.
Parameters
length
number
The length of the authentication tag in bits.
Returns
void
Methods
buildDecryptionContext()
buildDecryptionContext():
DecryptionContext
Build a context that can be used for decryption operations.
Returns
A decryption context.
Throws
AccessDeniedError If the key lacks the KeyPurpose.DECRYPT purpose.
Throws
InvalidArgumentError If any mandatory parameter is missing or the key is invalid.
Inherited from
CipherContextBuilder
.buildDecryptionContext
buildEncryptionContext()
buildEncryptionContext():
EncryptionContext
Build a context that can be used for encryption operations.
Returns
An encryption context.
Throws
AccessDeniedError If the key lacks the KeyPurpose.ENCRYPT purpose.
Throws
InvalidArgumentError If any mandatory parameter is missing or the key is invalid.
Inherited from
CipherContextBuilder
.buildEncryptionContext
buildWrappingContext()
buildWrappingContext(
scheme
):WrappingContext
Build a context that can be used for wrapping keys.
Parameters
scheme
The wrapping scheme to be used.
Returns
A wrapping context.
Throws
AccessDeniedError If the key lacks the KeyPurpose.WRAP and KeyPurpose.UNWRAP purposes.
Throws
InvalidArgumentError If any mandatory parameter is missing or the key is invalid.
Throws
NotSupportedError If the implementation does not support wrapping operations.
Inherited from
CipherContextBuilder
.buildWrappingContext
Last updated: Sep 30, 2025