@Test public void validateKey_checkAllLengths() throws Exception { AesSivKeyManager manager = new AesSivKeyManager(); for (int i = 0; i < 100; i++) { if (i == 64) { manager.validateKey(createAesSivKey(i)); } else { try { manager.validateKey(createAesSivKey(i)); fail(); } catch (GeneralSecurityException e) { } } } }
@Override public void validateKey(AesSivKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != 64) { throw new InvalidKeyException( "invalid key size: " + key.getKeyValue().size() + ". Valid keys must have 64 bytes."); } }
AesSivKeyManager extends KeyTypeManager<AesSivKey> { @Override public void validateKey(AesSivKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != 64) { throw new InvalidKeyException( "invalid key size: " + key.getKeyValue().size() + ". Valid keys must have 64 bytes."); } } }
AesSivKeyManager extends KeyTypeManager<AesSivKey> { @Override public void validateKey(AesSivKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != 64) { throw new InvalidKeyException( "invalid key size: " + key.getKeyValue().size() + ". Valid keys must have 64 bytes."); } } AesSivKeyManager(); }
AesSivKeyManager extends KeyTypeManager<AesSivKey> { @Override public void validateKey(AesSivKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != 64) { throw new InvalidKeyException( "invalid key size: " + key.getKeyValue().size() + ". Valid keys must have 64 bytes."); } } AesSivKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(AesSivKey key); @Override AesSivKey parseKey(ByteString byteString); @Override KeyFactory<AesSivKeyFormat, AesSivKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate aes256SivTemplate(); static final KeyTemplate rawAes256SivTemplate(); }
AesSivKeyManager extends KeyTypeManager<AesSivKey> { @Override public void validateKey(AesSivKey key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != 64) { throw new InvalidKeyException( "invalid key size: " + key.getKeyValue().size() + ". Valid keys must have 64 bytes."); } } AesSivKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(AesSivKey key); @Override AesSivKey parseKey(ByteString byteString); @Override KeyFactory<AesSivKeyFormat, AesSivKey> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate aes256SivTemplate(); static final KeyTemplate rawAes256SivTemplate();  }