Skip to main content

PacketKey

Trait PacketKey 

Source
pub trait PacketKey: Send {
    // Required methods
    fn seal(&self, pn: u64, header: &[u8], payload: &mut [u8], tag: &mut [u8]);
    fn open(
        &self,
        pn: u64,
        header: &[u8],
        payload_and_tag: &mut [u8],
    ) -> Result<usize, ()>;
    fn tag_len(&self) -> usize;
    fn confidentiality_limit(&self) -> u64;
    fn integrity_limit(&self) -> u64;
}
Expand description

AEAD packet protection for one direction.

Required Methods§

Source

fn seal(&self, pn: u64, header: &[u8], payload: &mut [u8], tag: &mut [u8])

Encrypts payload in place and writes the tag (tag_len() bytes) to tag.

Source

fn open( &self, pn: u64, header: &[u8], payload_and_tag: &mut [u8], ) -> Result<usize, ()>

Decrypts payload_and_tag in place; returns the plaintext length.

Source

fn tag_len(&self) -> usize

Source

fn confidentiality_limit(&self) -> u64

Packets that may be sealed before a key update is required (RFC 9001 §6.6).

Source

fn integrity_limit(&self) -> u64

Failed decryptions tolerated before the connection must close (RFC 9001 §6.6).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§