C# Class Incog.Messaging.IncogStream

Incog Pipe Stream defines the data protocol for reading and writing strings on our stream.
显示文件 Open project: SimWitty/Incog Class Usage Examples

Public Methods

Method Description
IncogStream ( Stream stream, SecureString passphrase ) : System

Initializes a new instance of the IncogStream class.

IncogStream ( Stream stream, SecureString passphrase, double entropy ) : System

Initializes a new instance of the IncogStream class.

ReadBytes ( ) : byte[]

Read a byte array from the underlying stream.

ReadString ( ) : string

Read a string from the underlying stream.

WriteBytes ( byte bytes ) : int

Write a byte array to the underlying buffer.

WriteString ( string text ) : int

Write a string to the underlying buffer.

Private Methods

Method Description
ReadUInt16 ( ) : ushort

Read a 2-byte unsigned integer, unencrypted, from the stream. If either the first or second byte is missing (-1), then 0 is returned.

WriteUInt16 ( ushort value ) : void

Write a 2-byte unsigned integer, unencrypted, to the stream.

Method Details

IncogStream() public method

Initializes a new instance of the IncogStream class.
public IncogStream ( Stream stream, SecureString passphrase ) : System
stream Stream The stream to write to and read from.
passphrase System.Security.SecureString The secure string used to encrypt messages written to the stream and decrypt messages read from the stream.
return System

IncogStream() public method

Initializes a new instance of the IncogStream class.
public IncogStream ( Stream stream, SecureString passphrase, double entropy ) : System
stream Stream The stream to write to and read from.
passphrase System.Security.SecureString The secure string used to encrypt messages written to the stream and decrypt messages read from the stream.
entropy double The approximate Shannon Entropy value (between 1.00 and 7.80) to spoof.
return System

ReadBytes() public method

Read a byte array from the underlying stream.
public ReadBytes ( ) : byte[]
return byte[]

ReadString() public method

Read a string from the underlying stream.
public ReadString ( ) : string
return string

WriteBytes() public method

Write a byte array to the underlying buffer.
public WriteBytes ( byte bytes ) : int
bytes byte The byte array to write to the buffer.
return int

WriteString() public method

Write a string to the underlying buffer.
public WriteString ( string text ) : int
text string The text string to write to the buffer. The string will be converted to Unicode.
return int