public final class MacKeyTemplates extends Object
KeyTemplate for Mac.
We recommend to avoid this class in order to keep dependencies small.
Instead, we recommend to use KeysetHandle.generateEntryFromParametersName or KeysetHandle.generateEntryFromParameters.
One can use these templates to generate new Keyset with
KeysetHandle. To generate a new keyset that contains a single
HmacKey, one can do:
Config.register(Mac.TINK_1_0_0);
KeysetHandle handle = KeysetHandle.generateNew(MacKeyTemplates.HMAC_SHA256_128BITTAG);
Mac mac = handle.getPrimitive(Mac.class);
| Modifier and Type | Field and Description |
|---|---|
static KeyTemplate |
AES_CMAC
A
KeyTemplate that generates new instances of com.google.crypto.tink.proto.CmacKey with the following parameters:
Key size: 32 bytes
Tag size: 16 bytes
OutputPrefixType: TINK
|
static KeyTemplate |
HMAC_SHA256_128BITTAG
A
KeyTemplate that generates new instances of HmacKey with the following parameters:
Key size: 32 bytes
Tag size: 16 bytes
Hash function: SHA256
OutputPrefixType: TINK
|
static KeyTemplate |
HMAC_SHA256_256BITTAG
A
KeyTemplate that generates new instances of HmacKey with the following parameters:
Key size: 32 bytes
Tag size: 32 bytes
Hash function: SHA256
OutputPrefixType: TINK
|
static KeyTemplate |
HMAC_SHA512_256BITTAG
A
KeyTemplate that generates new instances of HmacKey with the following parameters:
Key size: 64 bytes
Tag size: 32 bytes
Hash function: SHA512
OutputPrefixType: TINK
|
static KeyTemplate |
HMAC_SHA512_512BITTAG
A
KeyTemplate that generates new instances of HmacKey with the following parameters:
Key size: 64 bytes
Tag size: 64 bytes
Hash function: SHA512
OutputPrefixType: TINK
|
| Modifier and Type | Method and Description |
|---|---|
static KeyTemplate |
createHmacKeyTemplate(int keySize,
int tagSize,
HashType hashType) |
public static final KeyTemplate HMAC_SHA256_128BITTAG
KeyTemplate that generates new instances of HmacKey with the following parameters:
public static final KeyTemplate HMAC_SHA256_256BITTAG
KeyTemplate that generates new instances of HmacKey with the following parameters:
public static final KeyTemplate HMAC_SHA512_256BITTAG
KeyTemplate that generates new instances of HmacKey with the following parameters:
public static final KeyTemplate HMAC_SHA512_512BITTAG
KeyTemplate that generates new instances of HmacKey with the following parameters:
public static final KeyTemplate AES_CMAC
KeyTemplate that generates new instances of com.google.crypto.tink.proto.CmacKey with the following parameters:
public static KeyTemplate createHmacKeyTemplate(int keySize, int tagSize, HashType hashType)
KeyTemplate containing a HmacKeyFormat with some specified
parameters.