Constructs a mechanism parameter for AES encryption or decryption with "Counter with Cipher Block Chaining - Message Authentication Code", abbreviated CCM (see NIST SP 800-38C).
More...
Constructs a mechanism parameter for AES encryption or decryption with "Counter with Cipher Block Chaining - Message Authentication Code", abbreviated CCM (see NIST SP 800-38C).
The following example illustrates the usage of the MechParamCCM 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
int length(void) const
Definition: bytearray.cpp:180
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 "Counter with Cipher Block Cha...
Definition: sw/cxi_api_c/def/mechparam.h:155
MechanismParameter getEncoded(void)
Definition: mechparam.cpp:1004
#define CXI_FLAG_CRYPT_INIT
Initialize En/Decryption Operation.
Definition: fw/cxi/def/cxi_defs.h:509
#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
◆ MechParamCCM()
| MechParamCCM |
( |
int |
mech, |
|
|
const ByteArray & |
nonce, |
|
|
const ByteArray & |
ad, |
|
|
int |
datalen, |
|
|
int |
maclen = 16, |
|
|
int |
nonce_gen_func = CXI_MECH_PARAM_NONCE_NO_GENERATE |
|
) |
| |
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
|
| nonce_gen_func | nonce generation function:
- cxi_ccm_nonce_no_generate the host has to provide the nonce.
- cxi_ccm_nonce_generate the cryptoserver generates a random nonce with length of nonce. This nonce is returned by the final encryption call and must then be used as nonce for the decryption.
|
- The chaining mode CXI_MECH_CHAIN_CCM is set as default and cannot be changed.
- Parameters
-
| nonce | Nonce (7-13 bytes) for initial crypt call |
| 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.
- Parameters
-
| datalen | length total length of the data that will be passed to the crypt() call(s) later |
| maclen | length of the MAC (range 4-16), has to be set for initial and final crypt call |
◆ getEncoded()
- Returns
- Returns the encoded mechanism parameter.