@Override
  public byte[] decrypt(final byte[] ciphertext) throws GeneralSecurityException {
    if (ciphertext.length < NONCE_LENGTH_IN_BYTES) {
      throw new GeneralSecurityException("ciphertext too short");
    }
    byte[] nonce = Arrays.copyOf(ciphertext, NONCE_LENGTH_IN_BYTES);
    ByteBuffer rawCiphertext =
        ByteBuffer.wrap(
            ciphertext, NONCE_LENGTH_IN_BYTES, ciphertext.length - NONCE_LENGTH_IN_BYTES);
    return cipher.decrypt(nonce, rawCiphertext);
  }
A stream cipher, as described in RFC 8439 https://tools.ietf.org/html/rfc8439, section 2.4.

<p>This cipher is meant to be used to construct an AEAD with Poly1305.
java_src/src/main/java/com/google/crypto/tink/subtle/ChaCha20.java