Skip to main content

protect

Function protect 

Source
pub fn protect(
    header: &MessageHeader,
    nonce_source: NonceSource,
    payload: &[u8],
    keys: &SessionKeys,
    out: &mut [u8],
) -> Result<usize>
Available on crate feature rustcrypto only.
Expand description

Encrypts one message into out, returning how many octets it occupies.

payload is the protocol header and application payload — everything that travels encrypted. The header’s privacy flag decides whether §4.9’s obfuscation is applied.

The result is header || ciphertext || MIC.