@Test public void createKey_valid() throws Exception { manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 10, HashType.SHA1))); manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 20, HashType.SHA1))); manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 10, HashType.SHA256))); manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 32, HashType.SHA256))); manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 10, HashType.SHA512))); manager.validateKey(factory.createKey(makeHmacKeyFormat(16, 64, HashType.SHA512))); }
@Override public void validateKey(HmacKey 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()); }
HmacKeyManager extends KeyTypeManager<HmacKey> { @Override public void validateKey(HmacKey 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()); } }
HmacKeyManager extends KeyTypeManager<HmacKey> { @Override public void validateKey(HmacKey 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()); } HmacKeyManager(); }
HmacKeyManager extends KeyTypeManager<HmacKey> { @Override public void validateKey(HmacKey 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()); } HmacKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HmacKey key); @Override HmacKey parseKey(ByteString byteString); @Override KeyFactory<HmacKeyFormat, HmacKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate hmacSha256HalfDigestTemplate(); static final KeyTemplate hmacSha256Template(); static final KeyTemplate hmacSha512HalfDigestTemplate(); static final KeyTemplate hmacSha512Template(); }
HmacKeyManager extends KeyTypeManager<HmacKey> { @Override public void validateKey(HmacKey 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()); } HmacKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(HmacKey key); @Override HmacKey parseKey(ByteString byteString); @Override KeyFactory<HmacKeyFormat, HmacKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate hmacSha256HalfDigestTemplate(); static final KeyTemplate hmacSha256Template(); static final KeyTemplate hmacSha512HalfDigestTemplate(); static final KeyTemplate hmacSha512Template();  }