Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.SSH.BlockPadding

Feature notes: SSH implementation notes

Classes, interfaces and records

interfaceiSSHGetPaddingHash

The iSSHGetPaddingHash interface is implemented by ciphers that provide built in data integrity. The tSSHBlockPadding checks if the cipher implements this interface. If it does, the instance returned by GetHash is used for data integrity. Otherwise an instance of the class corresponding to the negotiated MAC option is used.

function GetHash: tHash;

classtHashNone

inherits from tHash

class function Algorithm: tHashAlgorithm; override;
Returns haNull, see tHashAlgorithm.
class function DigestSize: Integer; override;
Always returns 0.
procedure GetContext(Context: Pointer); override; procedure HashData(const Data; Count: Int64); override; procedure SetUpContext(Context: Pointer); override;

classtCustomHashOMAC

inherits from tHash

class function Algorithm: tHashAlgorithm; override;
Returns haDefault, see tHashAlgorithm.
class function DigestSize: Integer; override;
Always returns 16.
procedure GetContext(Context: Pointer); override; procedure HashData(const Data; Count: Int64); override; procedure SetUp; override; procedure SetUpContext(Context: Pointer); override;

classtRijndaelHashOMAC

inherits from tCustomHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'aes-128-omac@streamsec.com'.

classtRijndael192HashOMAC

inherits from tRijndaelHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'aes-192-omac@streamsec.com'.

classtRijndael256HashOMAC

inherits from tRijndaelHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'aes-256-omac@streamsec.com'.

classtTwoFishHashOMAC

inherits from tCustomHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'twofish-128-omac@streamsec.com'.

classtTwoFish192HashOMAC

inherits from tTwoFishHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'twofish-192-omac@streamsec.com'.

classtTwoFish256HashOMAC

inherits from tTwoFishHashOMAC

class function OID: ObjectIdentifier; override;
Always returns the string 'twofish-256-omac@streamsec.com'.

classtHashOMACInitialization

constructor Create(aCipherAlg: tCipherAlg; aClass: tHashClass); class procedure RegisterInitialization(aCipherAlg: tCipherAlg; aClass : tHashClass); class procedure UnregisterInitialization(const aIdentifier: ObjectIdentifier);

classtSSHBlockPadding

inherits from tBlockPaddingCompoundMode

constructor Create(aBlockEncryptor: iBlockEncryptor); override; destructor Destroy; override; class function Mode: tBlockPaddingMode; override;
Returns bpmSSH, see tBlockPaddingMode.
class function ModeName: string; override;
Always returns the string 'SSH'.
class function SupportsCipherMode(aMode: tCipherMode): Boolean; override; function BeforeDecrypt(var aSrc : pByteArray; var aSrcCount: Integer; var aDst : pByteArray; var aDstCount: Integer) : Boolean; override; function BeforeEncrypt(var aSrc : pByteArray; var aSrcCount: Integer; var aDst : pByteArray; var aDstCount: Integer) : Boolean; override; function BeforeEncryptToNil(var aBuf : pByteArray; var aCount: Integer): Boolean; override;
Always returns False.
procedure GetFinalBuf(var aMac; aCount: Integer); override; function VerifyFinalBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer) : Boolean; override;

classtSSHGCMBlockPadding

inherits from tBlockPaddingGCM

SSH AEAD: aes128-gcm@openssh.com / aes256-gcm@openssh.com + the RFC 5647 AEAD_AES_128_GCM / AEAD_AES_256_GCM. Reuses the GCM crypto of tBlockPaddingGCM (J0/invocation-counter/GHash/tag) and layers the SSH binary-packet framing: the 4-byte packet_length stays in the CLEAR and is the GCM AAD; the region padding_length || payload || padding is GCM-encrypted (its length a multiple of the 16-byte block, padding >= 4); a 16-byte tag follows. The 96-bit nonce is fixed(4) || invocation_counter(8); the counter increments once per packet (independently of the SSH sequence number). The padding_length byte is inside the ciphertext, so the real payload length is only known after decryption - MessageLength is set to packet_length (an upper bound for the caller's buffer) and VerifyFinalBuf reports the true length via aDstCount.

constructor Create(aBlockEncryptor: iBlockEncryptor); override; destructor Destroy; override; class function Mode: tBlockPaddingMode; override;
Returns bpmSSHGCM, see tBlockPaddingMode.
class function ModeName: string; override;
Always returns the string 'SSH-GCM'.
class function SupportsCipherMode(aMode: tCipherMode): Boolean; override;
Returns True if aMode equals cmSSHGCM; otherwise False.
function BeforeDecrypt(var aSrc : pByteArray; var aSrcCount: Integer; var aDst : pByteArray; var aDstCount: Integer) : Boolean; override; function BeforeEncrypt(var aSrc : pByteArray; var aSrcCount: Integer; var aDst : pByteArray; var aDstCount: Integer) : Boolean; override; procedure GetFinalBuf(var aMac; aCount: Integer); override; function VerifyFinalBuf(const aSrc; aSrcCount: Integer; var aDst; var aDstCount: Integer) : Boolean; override;