public final class MacKeyTemplates extends Object
KeyTemplate for Mac.
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 = MacFactory.getPrimitive(handle);
| Modifier and Type | Field and Description |
|---|---|
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
|
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
|
| Constructor and Description |
|---|
MacKeyTemplates() |
| 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 KeyTemplate createHmacKeyTemplate(int keySize, int tagSize, HashType hashType)
KeyTemplate containing a HmacKeyFormat with some specified
parameters.