GCM constructor
GCM(
- BlockCipher cipher
Creates a GCM instance with the specified block cipher.
Parameters:
cipher
: The block cipher with a 16-byte block size to be used for GCM encryption and decryption.
Throws:
ArgumentException
if the provided block cipher does not have a 16-byte block size.
Implementation
GCM(BlockCipher cipher) {
if (cipher.blockSize != 16) {
throw const ArgumentException("GCM supports only 16-byte block cipher");
}
_cipher = cipher;
_subkey = List<int>.filled(_cipher.blockSize, 0);
_cipher.encryptBlock(List<int>.filled(_cipher.blockSize, 0), _subkey);
}