@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(); try { manager.validateKey(key); fail(); } catch (GeneralSecurityException e) { } }
@Override public void validateKey(HkdfPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); validateKeySize(key.getKeyValue().size()); validateParams(key.getParams()); }
HkdfPrfKeyManager extends KeyTypeManager<HkdfPrfKey> { @Override public void validateKey(HkdfPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); validateKeySize(key.getKeyValue().size()); validateParams(key.getParams()); } }
HkdfPrfKeyManager extends KeyTypeManager<HkdfPrfKey> { @Override public void validateKey(HkdfPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); validateKeySize(key.getKeyValue().size()); validateParams(key.getParams()); } HkdfPrfKeyManager(); }
HkdfPrfKeyManager extends KeyTypeManager<HkdfPrfKey> { @Override public void validateKey(HkdfPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); validateKeySize(key.getKeyValue().size()); validateParams(key.getParams()); } HkdfPrfKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HkdfPrfKey key); @Override HkdfPrfKey parseKey(ByteString byteString); @Override KeyFactory<HkdfPrfKeyFormat, HkdfPrfKey> keyFactory(); static void register(boolean newKeyAllowed); static String staticKeyType(); static final KeyTemplate hkdfSha256Template(); }
HkdfPrfKeyManager extends KeyTypeManager<HkdfPrfKey> { @Override public void validateKey(HkdfPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); validateKeySize(key.getKeyValue().size()); validateParams(key.getParams()); } HkdfPrfKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HkdfPrfKey key); @Override HkdfPrfKey parseKey(ByteString byteString); @Override KeyFactory<HkdfPrfKeyFormat, HkdfPrfKey> keyFactory(); static void register(boolean newKeyAllowed); static String staticKeyType(); static final KeyTemplate hkdfSha256Template();  }