class AesCtrJceCipher implements IndCpaCipher {

  @Override
  public byte[] encrypt(final byte[] plaintext) throws GeneralSecurityException {
    if (plaintext.length > Integer.MAX_VALUE - ivSize) {
      throw new GeneralSecurityException(
          "plaintext length can not exceed " + (Integer.MAX_VALUE - ivSize));
    }
    byte[] ciphertext = new byte[ivSize + plaintext.length];
    byte[] iv = Random.randBytes(ivSize);
    System.arraycopy(iv, 0, ciphertext, 0, ivSize);
    doCtr(plaintext, 0, plaintext.length, ciphertext, ivSize, iv, true);
    return ciphertext;
  }

  public  AesCtrJceCipher(final byte[] key, int ivSize);

}