Search in sources :

Example 6 with HkdfPrfKey

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

the class HkdfPrfKeyManagerTest method validateKey_invalidKeyVersion_throws.

@Test
public void validateKey_invalidKeyVersion_throws() throws Exception {
    HkdfPrfKey key = HkdfPrfKey.newBuilder().setVersion(1).setKeyValue(ByteString.copyFrom(Random.randBytes(32))).setParams(HkdfPrfParams.newBuilder().setHash(HashType.SHA256)).build();
    assertThrows(GeneralSecurityException.class, () -> manager.validateKey(key));
}
Also used : HkdfPrfKey(com.google.crypto.tink.proto.HkdfPrfKey) Test(org.junit.Test)

Example 7 with HkdfPrfKey

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

the class HkdfPrfKeyManagerTest method validateKey_invalidSha1Key_throws.

@Test
public void validateKey_invalidSha1Key_throws() throws Exception {
    HkdfPrfKey key = HkdfPrfKey.newBuilder().setVersion(0).setKeyValue(ByteString.copyFrom(Random.randBytes(32))).setParams(HkdfPrfParams.newBuilder().setHash(HashType.SHA1)).build();
    assertThrows(GeneralSecurityException.class, () -> manager.validateKey(key));
}
Also used : HkdfPrfKey(com.google.crypto.tink.proto.HkdfPrfKey) Test(org.junit.Test)

Aggregations

HkdfPrfKey (com.google.crypto.tink.proto.HkdfPrfKey)7 Test (org.junit.Test)7 HkdfPrfKeyFormat (com.google.crypto.tink.proto.HkdfPrfKeyFormat)1 HkdfStreamingPrf (com.google.crypto.tink.subtle.prf.HkdfStreamingPrf)1 StreamingPrf (com.google.crypto.tink.subtle.prf.StreamingPrf)1 InputStream (java.io.InputStream)1