public byte[] encrypt(final byte[] nonce, final byte[] plaintext, final byte[] associatedData)
      throws GeneralSecurityException {
    if (plaintext.length > Integer.MAX_VALUE - MAC_TAG_SIZE_IN_BYTES) {
      throw new GeneralSecurityException("plaintext too long");
    }
    ByteBuffer ciphertext = ByteBuffer.allocate(plaintext.length + MAC_TAG_SIZE_IN_BYTES);
    encrypt(ciphertext, nonce, plaintext, associatedData);
    return ciphertext.array();
  }
Encrypts {@code plaintext} with Poly1305 authentication based on {@code associatedData}.

<p>Please note that nonce should be randomly generated by the caller hence keys need to be
rotated after encrypting a certain number of messages depending on the nonce size of the
underlying {@link InsecureNonceChaCha20Base}.

@param nonce specified by caller
@param plaintext data to encrypt
@param associatedData associated authenticated data
@return ciphertext with the following format {@code actual_ciphertext || tag}
java_src/src/main/java/com/google/crypto/tink/aead/internal/InsecureNonceChaCha20Poly1305Base.java