use of com.google.crypto.tink.proto.AesCtrHmacAeadKeyFormat in project tink by google.
the class AeadKeyTemplates method createAesCtrHmacAeadKeyTemplate.
/**
* @return a {@link KeyTemplate} containing a {@link AesCtrHmacAeadKeyFormat} with some specific
* parameters.
*/
public static KeyTemplate createAesCtrHmacAeadKeyTemplate(int aesKeySize, int ivSize, int hmacKeySize, int tagSize, HashType hashType) {
AesCtrKeyFormat aesCtrKeyFormat = AesCtrKeyFormat.newBuilder().setParams(AesCtrParams.newBuilder().setIvSize(ivSize).build()).setKeySize(aesKeySize).build();
HmacKeyFormat hmacKeyFormat = HmacKeyFormat.newBuilder().setParams(HmacParams.newBuilder().setHash(hashType).setTagSize(tagSize).build()).setKeySize(hmacKeySize).build();
AesCtrHmacAeadKeyFormat format = AesCtrHmacAeadKeyFormat.newBuilder().setAesCtrKeyFormat(aesCtrKeyFormat).setHmacKeyFormat(hmacKeyFormat).build();
return KeyTemplate.newBuilder().setValue(format.toByteString()).setTypeUrl(AesCtrHmacAeadKeyManager.TYPE_URL).setOutputPrefixType(OutputPrefixType.TINK).build();
}
Aggregations