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));
}
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));
}
Aggregations