pub struct PacketProtection { /* private fields */ }Implementations§
Source§impl PacketProtection
impl PacketProtection
Sourcepub fn from_keys(
send_key: [u8; 32],
recv_key: [u8; 32],
generation: Generation,
) -> Result<Self, QdnfError>
pub fn from_keys( send_key: [u8; 32], recv_key: [u8; 32], generation: Generation, ) -> Result<Self, QdnfError>
Builds PacketProtection from keys.
Sourcepub const fn generation(&self) -> Generation
pub const fn generation(&self) -> Generation
Generation.
Sourcepub fn seal(
&mut self,
aad: &[u8],
plaintext: &mut [u8],
out: &mut [u8],
) -> Result<usize, QdnfError>
pub fn seal( &mut self, aad: &[u8], plaintext: &mut [u8], out: &mut [u8], ) -> Result<usize, QdnfError>
Encrypt plaintext in place. out receives pn || ciphertext || tag.
Sourcepub fn seal_paced(
&mut self,
aad: &[u8],
plaintext: &mut [u8],
out: &mut [u8],
pacer: &mut Pacer,
idle: &mut IdleWatch,
now_us: u64,
) -> Result<usize, QdnfError>
pub fn seal_paced( &mut self, aad: &[u8], plaintext: &mut [u8], out: &mut [u8], pacer: &mut Pacer, idle: &mut IdleWatch, now_us: u64, ) -> Result<usize, QdnfError>
Encrypt plaintext in place with transmission pacing and idle-watch validation.
Sourcepub fn open(
&mut self,
aad: &[u8],
sealed: &[u8],
out: &mut [u8],
) -> Result<usize, QdnfError>
pub fn open( &mut self, aad: &[u8], sealed: &[u8], out: &mut [u8], ) -> Result<usize, QdnfError>
Decrypt into out. Replay/window updates happen only after AEAD success.
Tries current recv key first; on AEAD failure only, tries previous.
Sourcepub fn install_update(
&mut self,
send_key: [u8; 32],
recv_key: [u8; 32],
generation: Generation,
) -> Result<(), QdnfError>
pub fn install_update( &mut self, send_key: [u8; 32], recv_key: [u8; 32], generation: Generation, ) -> Result<(), QdnfError>
Move current keys+space into previous (erasing any older previous) and install new keys with a fresh packet-number space. Generations must strictly increase. Nonce reuse is forbidden: spaces are not shared.
Trait Implementations§
Source§impl Drop for PacketProtection
impl Drop for PacketProtection
Auto Trait Implementations§
impl Freeze for PacketProtection
impl RefUnwindSafe for PacketProtection
impl Send for PacketProtection
impl Sync for PacketProtection
impl Unpin for PacketProtection
impl UnsafeUnpin for PacketProtection
impl UnwindSafe for PacketProtection
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more