Struct box_stream::BoxDuplex [] [src]

pub struct BoxDuplex<S> { /* fields omitted */ }

Wraps a duplex stream, encrypting all writes and decrypting all reads.

Methods

impl<S> BoxDuplex<S>
[src]

[src]

Create a new duplex stream, wrapping inner and the supplied keys and nonces for encryption and decryption.

[src]

Gets a reference to the underlying stream.

[src]

Gets a mutable reference to the underlying stream.

It is inadvisable to directly write to or read from the underlying stream.

[src]

Unwraps this BoxDuplex, returning the underlying stream.

Trait Implementations

impl<R: AsyncRead> AsyncRead for BoxDuplex<R>
[src]

[src]

Read bytes from the wrapped reader and decrypt them. End of stream is signalled by returning Ok(0) even though this function was passed a buffer of nonzero length.

Errors

In addition to propagating all errors from the wrapped reader, a BoxReader produces the following error kinds:

  • ErrorKind::InvalidData: If data could not be decrypted, or if a header declares an invalid length. Possible error values are INVALID_LENGTH, UNAUTHENTICATED_HEADER, UNAUTHENTICATED_PACKET. ErrorKind::UnexpectedEof: If a call to the inner reader returned Ok(0) although it was given a buffer of nonzero length. This is an error since end of file must be signalled via a special header in a box stream. The error value for this is UNAUTHENTICATED_EOF.

[src]

Determines if this AsyncReader can work with buffers of uninitialized memory. Read more

[src]

Attempt to read from the AsyncRead into vec using vectored IO operations. Read more

impl<W: AsyncWrite> AsyncWrite for BoxDuplex<W>
[src]

[src]

Attempt to write bytes from buf into the object. Read more

[src]

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more

[src]

Attempt to close the object. Read more

[src]

Attempt to write bytes from vec into the object using vectored IO operations. Read more

Auto Trait Implementations

impl<S> Send for BoxDuplex<S> where
    S: Send

impl<S> Sync for BoxDuplex<S> where
    S: Sync