Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

stCipherStream

Classes, interfaces and records

recordtHeader

Magic: tMagic; Alg: tCipherAlg; Mode: tCipherMode; Padding: tBlockPaddingMode; NonceLen: Byte; Nonce: array [0..15] of Byte; Reserved: array [0..2] of Byte; MsgCtrLen: Byte; FirstMsgCtr: array [0..7] of Byte;

classtEncryptStream

inherits from tStream

tEncryptStream provides uni-directional write access to a cipher text stream.

constructor Create(aDataStream: tStream; aCipher : iCipher); destructor Destroy; override; function Read(var Buffer; Count: Longint): Longint; override;
Always returns 0.
function Write(const Buffer; Count: Longint): Longint; override; function WriteHeader(aRandomNonce: Boolean = False): Boolean; function Seek(Offset: Longint; Origin: Word): Longint; override; function SafeCopyFrom(aSource : TStream; aCount : Int64; const aBufSize : Integer = cDefaultBufSize; aWriteSize: Boolean = False) : Int64; function SafeCopyFromWithSize(aSource : TStream; aCount : Int64; const aBufSize : Integer = cDefaultBufSize) : Int64;
Delegates to SafeCopyFrom, forwarding aSource, aCount, aBufSize and True, and returns its result.
function Done: Integer; property Cipher: iCipher read fCipher write SetCipher; property DataStream: tStream read fDataStream write SetDataStream;

classtDecryptStream

inherits from TStream

tDecryptStream provides uni-directional read access to a cipher text stream.

constructor Create(aDataStream: tStream; aCipher : iCipher = nil); constructor CreateOwnStream(aDataStream: tStream; aCipher : iCipher = nil; aSize : Int64 = 0); destructor Destroy; override; function Read(var Buffer; Count: Longint): Longint; override; function Write(const Buffer; Count: Longint): Longint; override;
Always returns 0.
function ReadHeader(aKey: iSecretKey; var aCC: tCipherClass): Boolean; overload; function ReadHeader(aKey: iSecretKey): Boolean; overload; function Seek(Offset: Longint; Origin: Word): Longint; override; function SafeCopyTo(aDest : TStream; aCount : Int64; const aBufSize : Integer = cDefaultBufSize; aReadSize: Boolean = False) : Int64; function SafeCopyToWithSize(aDest : TStream; const aBufSize: Integer = cDefaultBufSize) : Int64;
Delegates to SafeCopyTo, forwarding aDest, 0, aBufSize and True, and returns its result.
function Done: Integer; function GetInfo: tHeader;
Returns the current value of the fHeader field.
property Cipher: iCipher read fCipher write SetCipher; property DataStream: tStream read fDataStream write SetDataStream; property Authenticated: Boolean read fAuthenticated;
True once an authentication tag has been read and found correct. Until it is, nothing this stream has returned has been proved to be what was written. With VerifyBeforeRelease left alone it is True before Read returns its first octet.
property VerifyBeforeRelease: Boolean read fVerifyBeforeRelease write fVerifyBeforeRelease;
Default True: in an authenticated mode the whole message is read and its tag checked BEFORE Read returns anything, so no octet that fails authentication is ever handed to the caller, and a length or an offset taken from the plaintext cannot be acted on before it is proved genuine. Full description »

Types (enumerations, sets, aliases)

arraytMagic

  tMagic = array [0..3] of Byte;