Skip to main content

HeaderMask

Trait HeaderMask 

Source
pub trait HeaderMask: Send {
    // Required method
    fn mask(&mut self, sample: &[u8; 16]) -> Result<[u8; 5], CryptoError>;
}
Expand description

A keyed generator of record-number masks.

DTLS 1.3 encrypts the sequence number of a protected record by XORing it with the leading bytes of a mask computed from the first 16 bytes of the record’s ciphertext (RFC 9147 section 4.2.3): AES-ECB of the sample for the AES suites, and for ChaCha20 the keystream the block function gives with the sample’s first four bytes as the block counter and the other twelve as the nonce. QUIC header protection (RFC 9001 section 5.4) is the same computation, which is why five bytes come back; DTLS uses one or two of them.

Required Methods§

Source

fn mask(&mut self, sample: &[u8; 16]) -> Result<[u8; 5], CryptoError>

Computes the mask for sample.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§