Search in sources :

Example 6 with HmacPrfParams

use of com.google.crypto.tink.proto.HmacPrfParams in project tink by google.

the class HmacPrfKeyManager method createTemplate.

/**
 * @return a {@link KeyTemplate} containing a {@link HmacKeyFormat} with some specified
 *     parameters.
 */
private static KeyTemplate createTemplate(int keySize, HashType hashType) {
    HmacPrfParams params = HmacPrfParams.newBuilder().setHash(hashType).build();
    HmacPrfKeyFormat format = HmacPrfKeyFormat.newBuilder().setParams(params).setKeySize(keySize).build();
    return KeyTemplate.create(new HmacPrfKeyManager().getKeyType(), format.toByteArray(), KeyTemplate.OutputPrefixType.RAW);
}
Also used : HmacPrfKeyFormat(com.google.crypto.tink.proto.HmacPrfKeyFormat) HmacPrfParams(com.google.crypto.tink.proto.HmacPrfParams)

Aggregations

HmacPrfParams (com.google.crypto.tink.proto.HmacPrfParams)6 HmacPrfKeyFormat (com.google.crypto.tink.proto.HmacPrfKeyFormat)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Test (org.junit.Test)4 HmacPrfKey (com.google.crypto.tink.proto.HmacPrfKey)2