Constructs a mechanism parameter for AES encryption or decryption with Galois Counter Chaining (GCM, see NIST SP-800-38D).
More...
Constructs a mechanism parameter for AES encryption or decryption with Galois Counter Chaining (GCM, see NIST SP-800-38D).
The following example illustrates the usage of the MechParamGCM class:
if (plain != data)
throw Exception(
"<decrypt>",
"decrypted data doesn't match original data");
Encapsulates an array of primitive type char in an object and provides methods to operate on binary d...
Definition: sw/cxi_api_c/def/bytearray.h:22
void clear(void)
Definition: bytearray.cpp:165
Constructs an exception object.
Definition: sw/cxi_api_c/def/exception.h:22
Encapsulates key handles or key blobs of type 'Backup Blob', see Format of Key Blobs.
Definition: sw/cxi_api_c/def/key.h:19
Constructs a mechanism parameter for AES encryption or decryption with Galois Counter Chaining (GCM,...
Definition: sw/cxi_api_c/def/mechparam.h:131
MechanismParameter getEncoded(void)
Definition: mechparam.cpp:849
#define CXI_FLAG_CRYPT_FINAL
Finalize En/Decryption Operation.
Definition: fw/cxi/def/cxi_defs.h:510
#define CXI_MECH_MODE_DECRYPT
Decryption mode.
Definition: fw/cxi/def/cxi_defs.h:333
#define CXI_MECH_MODE_ENCRYPT
Encryption mode.
Definition: fw/cxi/def/cxi_defs.h:332
◆ MechParamGCM()
Constructs mechanism parameter for Galois Counter Mode (see NIST SP-800-38D).
- Parameters
-
| mech | XOR combination of mechanism specifier:
- crypt mode (see Mode Parameter)
- CXI_MECH_MODE_ENCRYPT
- CXI_MECH_MODE_DECRYPT
- chaining mode: The chaining mode CXI_MECH_CHAIN_GCM is set as default and cannot be changed.
|
| iv_init | Initialization Vector:
- The length of the Initialization Vector has to be less than 2^16 - 1.
- 96 bit (12 bytes) length is recommended by the NIST, but other values are allowed as well.
- On chunked operation the IV has to be given (at least) on the first call of the AES GCM algorithm.
- For encryption, it is recommended to use a zero length ByteArray as IV. In this case the CryptoServer generates a random 12 byte IV internally.
|
| ad | additional authentication data.
- On chunked operation additional authentication data should be given once on the first call and has to be absent on subsequent calls.
|
| tagbits | Number of bits in the authentication tag |
| iv_gen_func | IV generation function:
- For signing calls we recommend to use CXI_GCM_IV_GENERATE for this parameter. In this case the CryptoServer generates a random IV internally with l_iv_init Bytes. This IV is returned by the final encryption call and must then be used as IV for the decryption.
|
◆ getEncoded()
- Returns
- Returns the encoded mechanism parameter.