@Test public void validateKey_invalidWrongVersion_throws() throws Exception { EciesAeadHkdfPrivateKey privateKey = createValidPrivateKey(); EciesAeadHkdfPublicKey publicKey = privateManager.getPublicKey(privateKey); EciesAeadHkdfPublicKey invalidKey = EciesAeadHkdfPublicKey.newBuilder().setVersion(1).build(); try { publicManager.validateKey(invalidKey); fail(); } catch (GeneralSecurityException e) { } }
@Override public void validateKey(EciesAeadHkdfPublicKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); HybridUtil.validate(key.getParams()); }
EciesAeadHkdfPublicKeyManager extends KeyTypeManager<EciesAeadHkdfPublicKey> { @Override public void validateKey(EciesAeadHkdfPublicKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); HybridUtil.validate(key.getParams()); } }
EciesAeadHkdfPublicKeyManager extends KeyTypeManager<EciesAeadHkdfPublicKey> { @Override public void validateKey(EciesAeadHkdfPublicKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); HybridUtil.validate(key.getParams()); } EciesAeadHkdfPublicKeyManager(); }
EciesAeadHkdfPublicKeyManager extends KeyTypeManager<EciesAeadHkdfPublicKey> { @Override public void validateKey(EciesAeadHkdfPublicKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); HybridUtil.validate(key.getParams()); } EciesAeadHkdfPublicKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override EciesAeadHkdfPublicKey parseKey(ByteString byteString); @Override void validateKey(EciesAeadHkdfPublicKey key); }
EciesAeadHkdfPublicKeyManager extends KeyTypeManager<EciesAeadHkdfPublicKey> { @Override public void validateKey(EciesAeadHkdfPublicKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); HybridUtil.validate(key.getParams()); } EciesAeadHkdfPublicKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override EciesAeadHkdfPublicKey parseKey(ByteString byteString); @Override void validateKey(EciesAeadHkdfPublicKey key);  }