Package com.google.crypto.tink.aead
Class AeadKeyTemplates
- java.lang.Object
-
- com.google.crypto.tink.aead.AeadKeyTemplates
-
public final class AeadKeyTemplates extends java.lang.ObjectPre-generatedKeyTemplateforAeadkeys.We recommend to avoid this class to keep dependencies small.
- Using this class adds a dependency on protobuf. We hope that eventually it is possible to use Tink without a dependency on protobuf.
- Using this class adds a dependency on classes for all involved key types.
Instead, we recommend to use
KeysetHandle.generateEntryFromParametersNameorKeysetHandle.generateEntryFromParameters.One can use these templates to generate new
KeysetwithKeysetHandle.generateNew(com.google.crypto.tink.Parameters). To generate a new keyset that contains a singleAesGcmKey, one can do:AeadConfig.register(); KeysetHandle handle = KeysetHandle.generateNew(AeadKeyTemplates.AES128_GCM); Aead aead = handle.getPrimitive(RegistryConfiguration.get(), Aead.class);- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.crypto.tink.proto.KeyTemplateAES128_CTR_HMAC_SHA256AKeyTemplatethat generates new instances ofAesCtrHmacAeadKeywith 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: SHA256static com.google.crypto.tink.proto.KeyTemplateAES128_EAXAKeyTemplatethat generates new instances ofcom.google.crypto.tink.proto.AesEaxKeywith the following parameters: Key size: 16 bytes IV size: 16 bytesstatic com.google.crypto.tink.proto.KeyTemplateAES128_GCMAKeyTemplatethat generates new instances ofAesGcmKeywith the following parameters: Key size: 16 bytesstatic com.google.crypto.tink.proto.KeyTemplateAES256_CTR_HMAC_SHA256AKeyTemplatethat generates new instances ofAesCtrHmacAeadKeywith 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: SHA256static com.google.crypto.tink.proto.KeyTemplateAES256_EAXAKeyTemplatethat generates new instances ofAesEaxKeywith the following parameters: Key size: 32 bytes IV size: 16 bytesstatic com.google.crypto.tink.proto.KeyTemplateAES256_GCMAKeyTemplatethat generates new instances ofAesGcmKeywith the following parameters: Key size: 32 bytesstatic com.google.crypto.tink.proto.KeyTemplateCHACHA20_POLY1305AKeyTemplatethat generates new instances ofChaCha20Poly1305Key.static com.google.crypto.tink.proto.KeyTemplateXCHACHA20_POLY1305AKeyTemplatethat generates new instances ofXChaCha20Poly1305Key.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.crypto.tink.proto.KeyTemplatecreateAesCtrHmacAeadKeyTemplate(int aesKeySize, int ivSize, int hmacKeySize, int tagSize, com.google.crypto.tink.proto.HashType hashType)static com.google.crypto.tink.proto.KeyTemplatecreateAesEaxKeyTemplate(int keySize, int ivSize)static com.google.crypto.tink.proto.KeyTemplatecreateAesGcmKeyTemplate(int keySize)static com.google.crypto.tink.proto.KeyTemplatecreateKmsEnvelopeAeadKeyTemplate(java.lang.String kekUri, com.google.crypto.tink.proto.KeyTemplate dekTemplate)Returns a newKeyTemplatethat can generate aKmsEnvelopeAeadKeywhose key encrypting key (KEK) is pointing tokekUriand DEK template isdekTemplate.
-
-
-
Field Detail
-
AES128_GCM
public static final com.google.crypto.tink.proto.KeyTemplate AES128_GCM
AKeyTemplatethat generates new instances ofAesGcmKeywith the following parameters:- Key size: 16 bytes
On Android KitKat (API level 19), the
Aeadinstance generated by this key template does not support associated data. It might not work at all in older versions.
-
AES256_GCM
public static final com.google.crypto.tink.proto.KeyTemplate AES256_GCM
AKeyTemplatethat generates new instances ofAesGcmKeywith the following parameters:- Key size: 32 bytes
On Android KitKat (API level 19), the
Aeadinstance generated by this key template does not support associated data. It might not work at all in older versions.
-
AES128_EAX
public static final com.google.crypto.tink.proto.KeyTemplate AES128_EAX
AKeyTemplatethat generates new instances ofcom.google.crypto.tink.proto.AesEaxKeywith the following parameters:- Key size: 16 bytes
- IV size: 16 bytes
-
AES256_EAX
public static final com.google.crypto.tink.proto.KeyTemplate AES256_EAX
AKeyTemplatethat generates new instances ofAesEaxKeywith the following parameters:- Key size: 32 bytes
- IV size: 16 bytes
-
AES128_CTR_HMAC_SHA256
public static final com.google.crypto.tink.proto.KeyTemplate AES128_CTR_HMAC_SHA256
AKeyTemplatethat generates new instances ofAesCtrHmacAeadKeywith 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
-
AES256_CTR_HMAC_SHA256
public static final com.google.crypto.tink.proto.KeyTemplate AES256_CTR_HMAC_SHA256
AKeyTemplatethat generates new instances ofAesCtrHmacAeadKeywith 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
-
CHACHA20_POLY1305
public static final com.google.crypto.tink.proto.KeyTemplate CHACHA20_POLY1305
AKeyTemplatethat generates new instances ofChaCha20Poly1305Key.- Since:
- 1.1.0
-
XCHACHA20_POLY1305
public static final com.google.crypto.tink.proto.KeyTemplate XCHACHA20_POLY1305
AKeyTemplatethat generates new instances ofXChaCha20Poly1305Key.- Since:
- 1.3.0
-
-
Method Detail
-
createAesGcmKeyTemplate
public static com.google.crypto.tink.proto.KeyTemplate createAesGcmKeyTemplate(int keySize)
- Returns:
- a
KeyTemplatecontaining aAesGcmKeyFormatwith some specified parameters.
-
createAesEaxKeyTemplate
public static com.google.crypto.tink.proto.KeyTemplate createAesEaxKeyTemplate(int keySize, int ivSize)- Returns:
- a
KeyTemplatecontaining aAesEaxKeyFormatwith some specified parameters.
-
createAesCtrHmacAeadKeyTemplate
public static com.google.crypto.tink.proto.KeyTemplate createAesCtrHmacAeadKeyTemplate(int aesKeySize, int ivSize, int hmacKeySize, int tagSize, com.google.crypto.tink.proto.HashType hashType)- Returns:
- a
KeyTemplatecontaining aAesCtrHmacAeadKeyFormatwith some specific parameters.
-
createKmsEnvelopeAeadKeyTemplate
public static com.google.crypto.tink.proto.KeyTemplate createKmsEnvelopeAeadKeyTemplate(java.lang.String kekUri, com.google.crypto.tink.proto.KeyTemplate dekTemplate)Returns a newKeyTemplatethat can generate aKmsEnvelopeAeadKeywhose key encrypting key (KEK) is pointing tokekUriand DEK template isdekTemplate. Keys generated by this key template uses RAW output prefix to make them compatible with the remote KMS' encrypt/decrypt operations. Unlike other templates, when you generate new keys with this template, Tink does not generate new key material, but only creates a reference to the remote KEK.
-
-