NoiseStream

Wraps a normal Stream to add encryption based on the Noise_XX_25519_ChaChaPoly_BLAKE2b protocol.

Members

Functions

finalize
void finalize()

Flushes and finalizes the stream. Finalize has to be called on certain types of streams. No writes are possible after a call to finalize().

flush
void flush()

Flushes the stream and makes sure that all data is being written to the output device.

peek
const(ubyte)[] peek()

Returns a temporary reference to the data that is currently buffered. The returned slice typically has the size leastSize() or 0 if dataAvailableForRead() returns false. Streams that don't have an internal buffer will always return an empty slice. Note that any method invocation on the same stream potentially invalidates the contents of the returned buffer.

read
void read(ubyte[] dst)

Fills the preallocated array 'bytes' with data from the stream.

write
void write(ubyte[] bytesConst)

Writes an array of bytes to the stream.

write
void write(InputStream stream, ulong nbytes)

Not implemented.

Properties

dataAvailableForRead
bool dataAvailableForRead [@property getter]

Queries if there is data available for immediate, non-blocking read.

empty
bool empty [@property getter]

Returns true iff the end of the input stream has been reached.

leastSize
ulong leastSize [@property getter]

Returns the maximum number of bytes that are known to remain in this stream until the end is reached. After leastSize() bytes have been read, the stream will either have reached EOS and empty() returns true, or leastSize() returns again a number > 0.

Meta