pub fn crypto_secretstream_xchacha20poly1305_pull(
state: &mut State,
message: &mut [u8],
tag: &mut u8,
ciphertext: &[u8],
associated_data: Option<&[u8]>,
) -> Result<usize, Error>Expand description
Decrypts ciphertext from the stream for state with optional
additional_data, placing the result into message (which must be manually
resized) and tag. Returns the length of the message.
Due to a quirk in libsodium’s implementation, you need to manually resize
message to the message length after decrypting when using this function.
Compatible with libsodium’s crypto_secretstream_xchacha20poly1305_pull.
NOTE: The libsodium version of this function contains an alignment bug which was left in place, and is reflected in this implementation for compatibility purposes. Refer to commit 290197ba3ee72245fdab5e971c8de43a82b19874
§Errors
Returns an error if ciphertext is too short or too long, message lacks
space for the plaintext, or authentication fails.