[][src]Function ring::aead::seal_in_place

pub fn seal_in_place(
    key: &SealingKey,
    nonce: &[u8],
    ad: &[u8],
    in_out: &mut [u8],
    out_suffix_capacity: usize
) -> Result<usize, Unspecified>

Encrypts and signs (“seals”) data in place.

nonce must be unique for every use of the key to seal data.

The input is in_out[..(in_out.len() - out_suffix_capacity)]; i.e. the input is the part of in_out that precedes the suffix. When seal_in_place() returns Ok(out_len), the encrypted and signed output is in_out[..out_len]; i.e. the output has been written over input and at least part of the data reserved for the suffix. (The input/output buffer is expressed this way because Rust's type system does not allow us to have two slices, one mutable and one immutable, that reference overlapping memory at the same time.)

out_suffix_capacity must be at least key.algorithm().tag_len(). See also MAX_TAG_LEN.

ad is the additional authenticated data, if any.

C analog: EVP_AEAD_CTX_seal.

Go analog: AEAD.Seal