Search in sources :

Example 6 with HkdfPrfKeyFormat

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

the class HkdfPrfKeyManagerTest method validateKeyFormat_empty_throws.

@Test
public void validateKeyFormat_empty_throws() throws Exception {
    HkdfPrfKeyFormat keyFormat = HkdfPrfKeyFormat.getDefaultInstance();
    assertThrows(GeneralSecurityException.class, () -> factory.validateKeyFormat(keyFormat));
}
Also used : HkdfPrfKeyFormat(com.google.crypto.tink.proto.HkdfPrfKeyFormat) Test(org.junit.Test)

Example 7 with HkdfPrfKeyFormat

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

the class PrfKeyTemplatesTest method hkdfSha256Values.

@Test
public void hkdfSha256Values() throws Exception {
    HkdfPrfKeyFormat format = HkdfPrfKeyFormat.parseFrom(PrfKeyTemplates.HKDF_SHA256.getValue(), ExtensionRegistryLite.getEmptyRegistry());
    assertThat(format.getKeySize()).isEqualTo(32);
    assertThat(format.getParams().getHash()).isEqualTo(HashType.SHA256);
}
Also used : HkdfPrfKeyFormat(com.google.crypto.tink.proto.HkdfPrfKeyFormat) Test(org.junit.Test)

Aggregations

HkdfPrfKeyFormat (com.google.crypto.tink.proto.HkdfPrfKeyFormat)7 Test (org.junit.Test)7 KeyTemplate (com.google.crypto.tink.KeyTemplate)1 HkdfPrfKey (com.google.crypto.tink.proto.HkdfPrfKey)1