public final class HybridKeyTemplates extends Object
KeyTemplate for HybridDecrypt and HybridEncrypt primitives.
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#generateNew. To generate a new keyset that contains a single EciesAeadHkdfPrivateKey, one can do:
Config.register(HybridConfig.TINK_1_0_0);
KeysetHandle handle = KeysetHandle.generateNew(
HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM);
HybridDecrypt decrypter = handle.getPrimitive(HybridDecrypt.class);
HybridEncrypt encrypter = handle.getPublicKeysetHandle().getPrimitive(HybridDecrypt.class);
| Modifier and Type | Field and Description |
|---|---|
static KeyTemplate |
ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256
A
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
KEM: ECDH over NIST P-256
DEM: AES128-CTR-HMAC-SHA256 with the following parameters
AES key size: 16 bytes
AES CTR IV size: 16 bytes
HMAC key size: 32 bytes
HMAC tag size: 16 bytes
KDF: HKDF-HMAC-SHA256 with an empty salt
|
static KeyTemplate |
ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM
A
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
KEM: ECDH over NIST P-256
DEM: AES128-GCM
KDF: HKDF-HMAC-SHA256 with an empty salt
|
static KeyTemplate |
ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM_COMPRESSED_WITHOUT_PREFIX
A
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
KEM: ECDH over NIST P-256
DEM: AES128-GCM
KDF: HKDF-HMAC-SHA256 with an empty salt
EC Point Format: Compressed
OutputPrefixType: RAW
|
| Modifier and Type | Method and Description |
|---|---|
static KeyTemplate |
createEciesAeadHkdfKeyTemplate(EllipticCurveType curve,
HashType hashType,
EcPointFormat ecPointFormat,
KeyTemplate demKeyTemplate,
OutputPrefixType outputPrefixType,
byte[] salt) |
static EciesAeadHkdfParams |
createEciesAeadHkdfParams(EllipticCurveType curve,
HashType hashType,
EcPointFormat ecPointFormat,
KeyTemplate demKeyTemplate,
byte[] salt) |
public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
Unlike other key templates that use AES-GCM, the instances of HybridDecrypt
generated by this key template has no limitation on Android KitKat (API level 19). They might
not work in older versions though.
public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM_COMPRESSED_WITHOUT_PREFIX
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
Unlike other key templates that use AES-GCM, the instances of HybridDecrypt
generated by this key template has no limitation on Android KitKat (API level 19). They might
not work in older versions though.
public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256
KeyTemplate that generates new instances of EciesAeadHkdfPrivateKey with the following parameters:
public static KeyTemplate createEciesAeadHkdfKeyTemplate(EllipticCurveType curve, HashType hashType, EcPointFormat ecPointFormat, KeyTemplate demKeyTemplate, OutputPrefixType outputPrefixType, byte[] salt)
KeyTemplate containing a EciesAeadHkdfKeyFormat.public static EciesAeadHkdfParams createEciesAeadHkdfParams(EllipticCurveType curve, HashType hashType, EcPointFormat ecPointFormat, KeyTemplate demKeyTemplate, byte[] salt)
EciesAeadHkdfParams with the specified parameters.