@Test public void validateKey_version() throws Exception { ChaCha20Poly1305KeyManager manager = new ChaCha20Poly1305KeyManager(); try { manager.validateKey( ChaCha20Poly1305Key.newBuilder(createChaCha20Poly1305Key(32)).setVersion(1).build()); fail(); } catch (GeneralSecurityException e) { } }
@Override public void validateKey(ChaCha20Poly1305Key key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("invalid ChaCha20Poly1305Key: incorrect key length"); } }
ChaCha20Poly1305KeyManager extends KeyTypeManager<ChaCha20Poly1305Key> { @Override public void validateKey(ChaCha20Poly1305Key key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("invalid ChaCha20Poly1305Key: incorrect key length"); } } }
ChaCha20Poly1305KeyManager extends KeyTypeManager<ChaCha20Poly1305Key> { @Override public void validateKey(ChaCha20Poly1305Key key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("invalid ChaCha20Poly1305Key: incorrect key length"); } } ChaCha20Poly1305KeyManager(); }
ChaCha20Poly1305KeyManager extends KeyTypeManager<ChaCha20Poly1305Key> { @Override public void validateKey(ChaCha20Poly1305Key key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("invalid ChaCha20Poly1305Key: incorrect key length"); } } ChaCha20Poly1305KeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(ChaCha20Poly1305Key key); @Override ChaCha20Poly1305Key parseKey(ByteString byteString); @Override KeyFactory<ChaCha20Poly1305KeyFormat, ChaCha20Poly1305Key> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate chaCha20Poly1305Template(); static final KeyTemplate rawChaCha20Poly1305Template(); }
ChaCha20Poly1305KeyManager extends KeyTypeManager<ChaCha20Poly1305Key> { @Override public void validateKey(ChaCha20Poly1305Key key) throws GeneralSecurityException { Validators.validateVersion(key.getVersion(), getVersion()); if (key.getKeyValue().size() != KEY_SIZE_IN_BYTES) { throw new GeneralSecurityException("invalid ChaCha20Poly1305Key: incorrect key length"); } } ChaCha20Poly1305KeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override void validateKey(ChaCha20Poly1305Key key); @Override ChaCha20Poly1305Key parseKey(ByteString byteString); @Override KeyFactory<ChaCha20Poly1305KeyFormat, ChaCha20Poly1305Key> keyFactory(); static void register(boolean newKeyAllowed); static final KeyTemplate chaCha20Poly1305Template(); static final KeyTemplate rawChaCha20Poly1305Template();  }