pub struct EncryptedWriter { /* private fields */ }
Implementations§
Source§impl EncryptedWriter
impl EncryptedWriter
pub fn new(kind: CipherKind, key: &[u8], salt: &[u8]) -> Self
Sourcepub fn poll_write<S>(
&mut self,
cx: &mut Context<'_>,
stream: &mut S,
buf: &[u8],
) -> Poll<Result<usize>>
pub fn poll_write<S>( &mut self, cx: &mut Context<'_>, stream: &mut S, buf: &[u8], ) -> Poll<Result<usize>>
Write buf to stream, return num_bytes_written
An AEAD encrypted TCP stream starts with a randomly generated salt to derive the per-session subkey, followed by any number of encrypted chunks. Each chunk has the following structure:
[encrypted payload length][length tag][encrypted payload][payload tag]
More details in the wiki
Auto Trait Implementations§
impl Freeze for EncryptedWriter
impl RefUnwindSafe for EncryptedWriter
impl Send for EncryptedWriter
impl Sync for EncryptedWriter
impl Unpin for EncryptedWriter
impl UnwindSafe for EncryptedWriter
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