pub struct PacketKey {
key: LessSafeKey,
iv: Iv,
suite: &'static Tls13CipherSuite,
}Expand description
Keys to encrypt or decrypt the payload of a packet
Fields§
§key: LessSafeKeyEncrypts or decrypts a packet’s payload
iv: IvComputes unique nonces for each packet
suite: &'static Tls13CipherSuiteThe cipher suite used for this packet key
Implementations§
source§impl PacketKey
impl PacketKey
fn new(suite: &'static Tls13CipherSuite, secret: &Prk) -> Self
sourcepub fn encrypt_in_place(
&self,
packet_number: u64,
header: &[u8],
payload: &mut [u8],
) -> Result<Tag, Error>
pub fn encrypt_in_place( &self, packet_number: u64, header: &[u8], payload: &mut [u8], ) -> Result<Tag, Error>
Encrypt a QUIC packet
Takes a packet_number, used to derive the nonce; the packet header, which is used as
the additional authenticated data; and the payload. The authentication tag is returned if
encryption succeeds.
Fails iff the payload is longer than allowed by the cipher suite’s AEAD algorithm.
sourcepub fn decrypt_in_place<'a>(
&self,
packet_number: u64,
header: &[u8],
payload: &'a mut [u8],
) -> Result<&'a [u8], Error>
pub fn decrypt_in_place<'a>( &self, packet_number: u64, header: &[u8], payload: &'a mut [u8], ) -> Result<&'a [u8], Error>
Decrypt a QUIC packet
Takes the packet header, which is used as the additional authenticated data, and the
payload, which includes the authentication tag.
If the return value is Ok, the decrypted payload can be found in payload, up to the
length found in the return value.
sourcepub fn confidentiality_limit(&self) -> u64
pub fn confidentiality_limit(&self) -> u64
Number of times the packet key can be used without sacrificing confidentiality
See https://www.rfc-editor.org/rfc/rfc9001.html#name-confidentiality-limit.
sourcepub fn integrity_limit(&self) -> u64
pub fn integrity_limit(&self) -> u64
Number of times the packet key can be used without sacrificing integrity
See https://www.rfc-editor.org/rfc/rfc9001.html#name-integrity-limit.
Auto Trait Implementations§
impl Freeze for PacketKey
impl RefUnwindSafe for PacketKey
impl Send for PacketKey
impl Sync for PacketKey
impl Unpin for PacketKey
impl UnwindSafe for PacketKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
§type PreprendResult = Tail
type PreprendResult = Tail
TupleList], of an [Prepend::prepend()] call,
including the prepended entry.