Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

stChaCha20Poly1305

Classes, interfaces and records

interfaceiChaCha20Poly1305Parameters

inherits from iCompoundMode

Marker interface (no members of its own) so consumers can recognise the ChaCha20-Poly1305 compound mode without mistaking it for GCM.

(no public members)

classtChaCha20Poly1305

inherits from tCipherMAC

implements iCompoundMode, iChaCha20Poly1305Parameters

iCompoundMode is listed explicitly (in addition to the marker descendant) so that `instance as iCompoundMode` succeeds: in Delphi, implementing a derived interface does NOT register the ancestor's GUID for QueryInterface.

constructor CreateClone(aCipher: tCipher); override; class function BlockSize: Integer; override;
Always returns 1.
class function Mode: tCipherMode; override;
Returns the value of cmCTR.
class function Algorithm: tCipherAlg; override;
Returns the value of caChaCha20.
class function AlgorithmName: string; override;
Always returns the string 'ChaCha20-Poly1305'.
class function IVLength: Integer; override;
Always returns 12.
class function MaxKeySize: Integer; override;
Always returns 32.
class function MinKeySize: Integer; override;
Always returns 32.
function Decrypt(var aBuf; var aCount: Integer): Boolean; override; function DecryptToBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer) : Boolean; override; function Encrypt(var aBuf; var aCount: Integer): Boolean; override; function EncryptToBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer) : Boolean; override; function EncryptToNil(const aBuf; aCount: Integer): Boolean; override; procedure GetFinalBuf(var aMac; aCount: Integer); override; procedure GetVectorBuf(var aIV; aCount: Integer); override; procedure SetUp(const aKey; aCount: Integer); override; function SetVectorBuf(const aIV; aCount: Integer): Boolean; override; class procedure Test; property Mac;

classtSSHChaCha20Poly1305

inherits from tChaCha20Poly1305

implements iSSHParameters, iSetPadding

chacha20-poly1305@openssh.com (OpenSSH PROTOCOL.chacha20poly1305). A 512-bit key = K_2 (first 32 bytes, payload + Poly1305) || K_1 (second 32 bytes, the length field). Per packet the nonce is the SSH sequence number (8-byte BE); the 4-byte packet_length is ChaCha20(K_1) encrypted, the payload is ChaCha20(K_2, counter>=1) encrypted, and a raw Poly1305 (key = ChaCha20(K_2, counter 0)[0..31]) authenticates enc_length || enc_payload. Self-framing stream cipher: implements iSSHParameters directly (no block padding) and iSetPadding as a no-op so the transport's padding casts are harmless.

class function MaxKeySize: Integer; override;
Always returns 64.
class function MinKeySize: Integer; override;
Always returns 64.
class function IVLength: Integer; override;
Always returns 0.
class function Mode: tCipherMode; override;
Returns the value of cmSSHChaCha.
procedure SetUp(const aKey; aCount: Integer); override; function EncryptStr(const aBuf: OctetString): OctetString; override; function DecryptToBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer): Boolean; override; function InternalVerifyFinalBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer): Boolean; override; function GetMessageCounter: Int64;
Returns the current value of the fSeqNo field.
procedure SetMessageCounter(Value: Int64); function GetMACLength: Integer;
Returns the current value of the fMACLen field.
procedure SetMACLength(Value: Integer); function GetMessageLength: Int64;
Returns the current value of the fMsgLen field.
procedure SetMessageLength(Value: Int64); function GetHashAlgorithm: tHashAlgorithm;
Returns the value of haNull.
procedure SetHashAlgorithm(Value: tHashAlgorithm); function GetHashClass: tHashClass;
Always returns nil.
procedure SetHashClass(Value: tHashClass); function GetHMACKey: iSecretKey;
Always returns nil.
procedure SetHMACKey(const Value: iSecretKey); function GetPRNG: iRawRandom;
Returns the current value of the fPRNG field.
procedure SetPRNG(const Value: iRawRandom); function GetRemainingCipherTextInputLength: Integer; procedure Initialize; procedure RemovePadding(aPadding: tBlockPadding);
iSetPadding (no-op: this stream cipher self-frames)
procedure SetPadding(aPadding: tBlockPadding); function GetPaddingMode: tBlockPaddingMode;
Returns the value of bpmNone.
procedure SetPaddingMode(const Value: tBlockPaddingMode);