pub struct StreamSealer { /* private fields */ }Expand description
Encrypts a payload as a sequence of independently authenticated chunks.
Implementations§
Source§impl StreamSealer
impl StreamSealer
Sourcepub fn new(recipient: &PublicKeyBundle) -> Result<(Self, Vec<u8>)>
pub fn new(recipient: &PublicKeyBundle) -> Result<(Self, Vec<u8>)>
Begin a stream to recipient. Returns the sealer and the header bytes
(QST2) that must be written before the chunks.
§Errors
Error::RandomnessUnavailable if the OS RNG fails.
Sourcepub fn seal_chunk(&mut self, plaintext: &[u8], last: bool) -> Result<Vec<u8>>
pub fn seal_chunk(&mut self, plaintext: &[u8], last: bool) -> Result<Vec<u8>>
Encrypt one chunk. Set last on the final chunk. Returns the framed
chunk bytes to write.
§Errors
Error::StreamFinished if called after a last chunk or once the
2^32-chunk limit is reached; Error::MessageTooLarge if a single
chunk’s ciphertext would exceed the 32-bit frame length.
Auto Trait Implementations§
impl Freeze for StreamSealer
impl RefUnwindSafe for StreamSealer
impl Send for StreamSealer
impl Sync for StreamSealer
impl Unpin for StreamSealer
impl UnsafeUnpin for StreamSealer
impl UnwindSafe for StreamSealer
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