Struct holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_types::dependencies::rustls::quic::PacketKey
pub struct PacketKey { /* private fields */ }
Expand description
Keys to encrypt or decrypt the payload of a packet
Implementations§
§impl PacketKey
impl PacketKey
pub 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.
pub 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.
pub 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.
pub 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.
Trait Implementations§
§impl PacketKey for PacketKey
impl PacketKey for PacketKey
§fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize)
fn encrypt(&self, packet: u64, buf: &mut [u8], header_len: usize)
§fn decrypt(
&self,
packet: u64,
header: &[u8],
payload: &mut BytesMut
) -> Result<(), CryptoError>
fn decrypt(
&self,
packet: u64,
header: &[u8],
payload: &mut BytesMut
) -> Result<(), CryptoError>
§fn confidentiality_limit(&self) -> u64
fn confidentiality_limit(&self) -> u64
§fn integrity_limit(&self) -> u64
fn integrity_limit(&self) -> u64
Auto Trait Implementations§
impl RefUnwindSafe for PacketKey
impl Send for PacketKey
impl Sync for PacketKey
impl Unpin for PacketKey
impl UnwindSafe for PacketKey
Blanket Implementations§
§impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.