@Test public void validateKey_wrongVersion_throws() throws Exception { HmacPrfKey validKey = factory.createKey(makeHmacPrfKeyFormat(16, HashType.SHA1)); try { manager.validateKey(HmacPrfKey.newBuilder(validKey).setVersion(1).build()); fail(); } catch (GeneralSecurityException e) { } }
@Override public void validateKey(HmacPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("key too short"); } validateParams(key.getParams()); }
HmacPrfKeyManager extends KeyTypeManager<HmacPrfKey> { @Override public void validateKey(HmacPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("key too short"); } validateParams(key.getParams()); } }
HmacPrfKeyManager extends KeyTypeManager<HmacPrfKey> { @Override public void validateKey(HmacPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("key too short"); } validateParams(key.getParams()); } HmacPrfKeyManager(); }
HmacPrfKeyManager extends KeyTypeManager<HmacPrfKey> { @Override public void validateKey(HmacPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("key too short"); } validateParams(key.getParams()); } HmacPrfKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HmacPrfKey key); @Override HmacPrfKey parseKey(ByteString byteString); @Override KeyFactory<HmacPrfKeyFormat, HmacPrfKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate hmacSha256Template(); static final KeyTemplate hmacSha512Template(); }
HmacPrfKeyManager extends KeyTypeManager<HmacPrfKey> { @Override public void validateKey(HmacPrfKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() < MIN_KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("key too short"); } validateParams(key.getParams()); } HmacPrfKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HmacPrfKey key); @Override HmacPrfKey parseKey(ByteString byteString); @Override KeyFactory<HmacPrfKeyFormat, HmacPrfKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate hmacSha256Template(); static final KeyTemplate hmacSha512Template();  }