iroh_quinn_proto::crypto

Trait PacketKey

Source
pub trait PacketKey: Send + Sync {
    // Required methods
    fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize);
    fn decrypt(
        &self,
        packet: u64,
        header: &[u8],
        payload: &mut BytesMut,
    ) -> Result<(), CryptoError>;
    fn tag_len(&self) -> usize;
    fn confidentiality_limit(&self) -> u64;
    fn integrity_limit(&self) -> u64;
}
Expand description

Keys used to protect packet payloads

Required Methods§

Source

fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize)

Encrypt the packet payload with the given packet number

Source

fn decrypt( &self, packet: u64, header: &[u8], payload: &mut BytesMut, ) -> Result<(), CryptoError>

Decrypt the packet payload with the given packet number

Source

fn tag_len(&self) -> usize

The length of the AEAD tag appended to packets on encryption

Source

fn confidentiality_limit(&self) -> u64

Maximum number of packets that may be sent using a single key

Source

fn integrity_limit(&self) -> u64

Maximum number of incoming packets that may fail decryption before the connection must be abandoned

Implementations on Foreign Types§

Source§

impl PacketKey for Box<dyn PacketKey>

Source§

fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize)

Source§

fn decrypt( &self, packet: u64, header: &[u8], payload: &mut BytesMut, ) -> Result<(), CryptoError>

Source§

fn tag_len(&self) -> usize

Source§

fn confidentiality_limit(&self) -> u64

Source§

fn integrity_limit(&self) -> u64

Implementors§