private byte[] rawEncrypt(final byte[] plaintext, final byte[] associatedData)
      throws GeneralSecurityException {
    ByteBuffer output =
        ByteBuffer.allocate(
            ChaCha20.NONCE_LENGTH_IN_BYTES + plaintext.length + Poly1305.MAC_TAG_SIZE_IN_BYTES);
    byte[] nonce = Random.randBytes(ChaCha20.NONCE_LENGTH_IN_BYTES);
    output.put(nonce); // Prepend nonce to ciphertext output.
    cipher.encrypt(output, nonce, plaintext, associatedData);
    return output.array();
  }
ChaCha20Poly1305 AEAD construction, as described in <a
href="https://tools.ietf.org/html/rfc8439#section-2.8">RFC 8439, section 2.8</a>.

@since 1.1.0
java_src/src/main/java/com/google/crypto/tink/subtle/ChaCha20Poly1305.java