pub struct SFrameEncryptor { /* private fields */ }Expand description
Stateful per-sender SFrame encryptor handle.
Cloning a handle, or requesting another one for the same (epoch, leaf_index) via crate::SFrameSession::encryptor, shares the same
underlying counter - it does not create an independent one. This
makes it safe to hold multiple handles (e.g. one per thread) for the same
sender without risking AEAD nonce reuse.
Implementations§
Source§impl SFrameEncryptor
impl SFrameEncryptor
Sourcepub fn encrypt(
&mut self,
plaintext: &[u8],
extra_aad: &[u8],
) -> Result<Vec<u8>, SFrameError>
pub fn encrypt( &mut self, plaintext: &[u8], extra_aad: &[u8], ) -> Result<Vec<u8>, SFrameError>
Encrypts plaintext and returns the complete SFrame payload:
header ‖ ciphertext ‖ GCM-tag.
extra_aad is bound into the AEAD tag (e.g. an RTP header) but is not
carried in the returned payload; the receiver supplies the same slice to
SFrameDecryptor::decrypt.
Safe to call concurrently from multiple handles sharing this sender’s state: the counter is allocated under a lock, so concurrent calls never allocate the same value twice.
Trait Implementations§
Source§impl Clone for SFrameEncryptor
impl Clone for SFrameEncryptor
Source§fn clone(&self) -> SFrameEncryptor
fn clone(&self) -> SFrameEncryptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SFrameEncryptor
impl RefUnwindSafe for SFrameEncryptor
impl Send for SFrameEncryptor
impl Sync for SFrameEncryptor
impl Unpin for SFrameEncryptor
impl UnsafeUnpin for SFrameEncryptor
impl UnwindSafe for SFrameEncryptor
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
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> 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> ⓘ
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> ⓘ
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