public final class AeadKeyTemplates extends Object
KeyTemplate for Aead keys.
One can use these templates to generate new Keyset with
KeysetHandle.generateNew(com.google.crypto.tink.proto.KeyTemplate). To generate a new keyset that contains a
single AesGcmKey, one can do:
Config.register(AeadConfig.TINK_1_1_0);
KeysetHandle handle = KeysetHandle.generateNew(AeadKeyTemplates.AES128_GCM);
Aead aead = AeadFactory.getPrimitive(handle);
| Modifier and Type | Field and Description |
|---|---|
static KeyTemplate |
AES128_CTR_HMAC_SHA256
A
KeyTemplate that generates new instances of AesCtrHmacAeadKey with the following parameters:
AES key size: 16 bytes
AES CTR IV size: 16 byte
HMAC key size: 32 bytes
HMAC tag size: 16 bytes
HMAC hash function: SHA256
|
static KeyTemplate |
AES128_EAX
A
KeyTemplate that generates new instances of com.google.crypto.tink.proto.AesEaxKey with the following parameters:
Key size: 16 bytes
IV size: 16 bytes
|
static KeyTemplate |
AES128_GCM
A
KeyTemplate that generates new instances of AesGcmKey with the following parameters:
Key size: 16 bytes
|
static KeyTemplate |
AES256_CTR_HMAC_SHA256
A
KeyTemplate that generates new instances of AesCtrHmacAeadKey with the following parameters:
AES key size: 32 bytes
AES CTR IV size: 16 byte
HMAC key size: 32 bytes
HMAC tag size: 32 bytes
HMAC hash function: SHA256
|
static KeyTemplate |
AES256_EAX
A
KeyTemplate that generates new instances of AesEaxKey with the following parameters:
Key size: 32 bytes
IV size: 16 bytes
|
static KeyTemplate |
AES256_GCM
A
KeyTemplate that generates new instances of AesGcmKey with the following parameters:
Key size: 32 bytes
|
static KeyTemplate |
CHACHA20_POLY1305
A
KeyTemplate that generates new instances of ChaCha20Poly1305Key. |
| Constructor and Description |
|---|
AeadKeyTemplates() |
| Modifier and Type | Method and Description |
|---|---|
static KeyTemplate |
createAesCtrHmacAeadKeyTemplate(int aesKeySize,
int ivSize,
int hmacKeySize,
int tagSize,
HashType hashType) |
static KeyTemplate |
createAesEaxKeyTemplate(int keySize,
int ivSize) |
static KeyTemplate |
createAesGcmKeyTemplate(int keySize) |
static KeyTemplate |
createKmsAeadKeyTemplate(String keyUri) |
static KeyTemplate |
createKmsEnvelopeAeadKeyTemplate(String kekUri,
KeyTemplate dekTemplate) |
public static final KeyTemplate AES128_GCM
KeyTemplate that generates new instances of AesGcmKey with the following parameters:
On Android KitKat (API level 19), the Aead instance generated
by this key template does not support associated data. It might not work at all in older
versions.
public static final KeyTemplate AES256_GCM
KeyTemplate that generates new instances of AesGcmKey with the following parameters:
On Android KitKat (API level 19), the Aead instance generated
by this key template does not support associated data. It might not work at all in older
versions.
public static final KeyTemplate AES128_EAX
KeyTemplate that generates new instances of com.google.crypto.tink.proto.AesEaxKey with the following parameters:
public static final KeyTemplate AES256_EAX
KeyTemplate that generates new instances of AesEaxKey with the following parameters:
public static final KeyTemplate AES128_CTR_HMAC_SHA256
KeyTemplate that generates new instances of AesCtrHmacAeadKey with the following parameters:
public static final KeyTemplate AES256_CTR_HMAC_SHA256
KeyTemplate that generates new instances of AesCtrHmacAeadKey with the following parameters:
public static final KeyTemplate CHACHA20_POLY1305
KeyTemplate that generates new instances of ChaCha20Poly1305Key.public static KeyTemplate createAesGcmKeyTemplate(int keySize)
KeyTemplate containing a AesGcmKeyFormat with some specified
parameters.public static KeyTemplate createAesEaxKeyTemplate(int keySize, int ivSize)
KeyTemplate containing a AesEaxKeyFormat with some specified
parameters.public static KeyTemplate createAesCtrHmacAeadKeyTemplate(int aesKeySize, int ivSize, int hmacKeySize, int tagSize, HashType hashType)
KeyTemplate containing a AesCtrHmacAeadKeyFormat with some specific
parameters.public static KeyTemplate createKmsAeadKeyTemplate(String keyUri)
KeyTemplate that can generate a KmsAeadKey pointing to keyUri.public static KeyTemplate createKmsEnvelopeAeadKeyTemplate(String kekUri, KeyTemplate dekTemplate)
KeyTemplate that can generate a KmsEnvelopeAeadKey whose KEK is pointing to kekUri
and DEK template is dekTemplate.