pub struct Opener<A: Aead> { /* private fields */ }Expand description
Opens messages from one Sealer, refusing replays and reordering.
Implementations§
Source§impl<A: Aead> Opener<A>
impl<A: Aead> Opener<A>
Sourcepub fn new(key: &[u8], fixed: [u8; 4]) -> Result<Self>
pub fn new(key: &[u8], fixed: [u8; 4]) -> Result<Self>
An opener for the sender whose fixed field is fixed.
Sourcepub fn next_counter(&self) -> u64
pub fn next_counter(&self) -> u64
The lowest counter the next open will accept.
Sourcepub fn open(
&mut self,
nonce: &[u8],
aad: &[u8],
in_out: &mut [u8],
tag: &[u8],
) -> Result<()>
pub fn open( &mut self, nonce: &[u8], aad: &[u8], in_out: &mut [u8], tag: &[u8], ) -> Result<()>
Verify and decrypt in_out in place.
Refuses a nonce with another sender’s fixed field, or a counter lower
than the last one opened plus one, before the AEAD runs. Counters may
skip forward, so a lost message does not stall the stream, but never go
back. On any failure the accepted counter does not advance, and
in_out holds no unauthenticated plaintext.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Opener<A>where
A: Freeze,
impl<A> RefUnwindSafe for Opener<A>where
A: RefUnwindSafe,
impl<A> Send for Opener<A>where
A: Send,
impl<A> Sync for Opener<A>where
A: Sync,
impl<A> Unpin for Opener<A>where
A: Unpin,
impl<A> UnsafeUnpin for Opener<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for Opener<A>where
A: UnwindSafe,
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