pub struct Sealer { /* private fields */ }Expand description
Per-worker AEAD handle. Holds a small cache of per-file subkeys so a multi-file transfer does not run HKDF on every chunk.
Implementations§
Source§impl Sealer
impl Sealer
Sourcepub fn seal(
&mut self,
file_id: u32,
chunk: u64,
epoch: u32,
aad: &[u8],
buf: &mut [u8],
) -> Result<[u8; 16]>
pub fn seal( &mut self, file_id: u32, chunk: u64, epoch: u32, aad: &[u8], buf: &mut [u8], ) -> Result<[u8; 16]>
Encrypt buf in place and return the authentication tag.
aad must be the exact frame header bytes: the header is authenticated
but not encrypted, so a peer cannot redirect a chunk to a different
file or offset without the tag failing.
Sourcepub fn open(
&mut self,
file_id: u32,
chunk: u64,
epoch: u32,
aad: &[u8],
buf: &mut [u8],
tag: &[u8; 16],
) -> Result<()>
pub fn open( &mut self, file_id: u32, chunk: u64, epoch: u32, aad: &[u8], buf: &mut [u8], tag: &[u8; 16], ) -> Result<()>
Decrypt buf in place, verifying tag against aad.
pub fn is_passthrough(&self) -> bool
pub fn overhead(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sealer
impl RefUnwindSafe for Sealer
impl Send for Sealer
impl Sync for Sealer
impl Unpin for Sealer
impl UnsafeUnpin for Sealer
impl UnwindSafe for Sealer
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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