跳到主要内容

PacketKey

搜索

trait PacketKey 

源代码
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;
}
展开描述

用于保护 packet payload 的密钥

必需方法§

源代码

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

加密时附加在包后的 AEAD tag 的长度

源代码

fn confidentiality_limit(&self) -> u64

单个密钥最多可用于发送的包数量

源代码

fn integrity_limit(&self) -> u64

在连接被迫放弃之前,最多可允许解密失败的入站包数量

Implementations on Foreign Types§

源代码§

impl PacketKey for Box<dyn PacketKey>

源代码§

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

实现者§