@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;
  }
Encrypts the plaintext with counter mode encryption using randomly generated iv. The output
format is iv || raw ciphertext.

@param plaintext the plaintext to be encrypted.
@return the encryption of plaintext.
java_src/src/main/java/com/google/crypto/tink/subtle/AesCtrJceCipher.java