Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.SSH.PublicKeyList

Feature notes: SSH implementation notes

Classes, interfaces and records

interfaceiKeyContainer

inherits from iBaseInterface

function GetKey: iUnknown; function Compare(const aBuf: tBytes): Boolean; property Key: iUnknown read GetKey;

classtKeyContainer

inherits from tObjectMapping

implements iKeyContainer

constructor Create(const aBuf: tBytes; const aKey: iUnknown); destructor Destroy; override;

classTstSSHPublicKeyList — component reference

inherits from TstCustomMPKey

implements iGetRSAKey, iGetDSSKey, iGetECDSAKey, iGetEdDSAKey

constructor Create(aOwner: TComponent); override;
Standard constructor. An application usually gets an instance by dropping the component on a form (owned/freed by that form) rather than calling this directly; the instance is then referenced from an SSH server or client via a published property (e.g. SSHServer.ClientKeys, or ServerRSAKey on eith... Full description »
destructor Destroy; override;
Destructor. If there are unsaved changes and AutoSave allows it (see ShouldSaveKeys), the key list is flushed back to PublicKeyFileName before the internal list and lock are released. Applications almost never call this directly; the owner frees the component. » member page
procedure SetPublicKey(const aIdentifier: OctetString; const aKey : iUnknown);
Adds or replaces the public key associated with aIdentifier (typically an SSH user name, UTF-8 encoded) in the list, marking it Modified. Full description »
function GetKeyText(const aIdentifier: OctetString): string;
Returns the stored key for aIdentifier serialized as text in the configured public-key format (RSAPublicKeyFormat / DSSPublicKeyFormat), with a Subject header set to the identifier. Use this to display or export an authorized-peer entry, e.g. to show which key is on file for a user or to write out an authorized_keys-style line. Returns an empty string if the identifier is unknown. » member page
procedure SetPublicKeyText(const aIdentifier: OctetString; const aKey : string);
Parses aKey (a public key in text form, RSA tried first then DSS) and registers it under aIdentifier via SetPublicKey. Use this when your app receives an authorized key as text (pasted, read from a config line, sent over a management channel) rather than as a live key interface. » member page
function LoadPublicKeyFromStream(const aIdentifier: OctetString; aStrm : TStream) : Boolean; override;
Verifies that the raw key blob in aStrm matches the key stored for aIdentifier. The match is robust to key type and to however the store was populated: it re-derives the stored key's canonical SSH wire form from the key object (ssh-rsa / ssh-dss / ecdsa-sha2-* / ssh-ed25519 / ssh-ed448) and compa... Full description »
procedure SaveKeys;
Serializes the entire in-memory key list and writes it out through SetPublicKeyStream (to PublicKeyFileName), clearing the Modified flag. Full description »
property ShouldSaveKeys: Boolean read GetShouldSaveKeys;
True when there are pending in-memory changes (Modified) that AutoSave is configured to persist and a writable PublicKeyFileName is set. Read-only; the component consults it internally to decide whether to flush on destroy or disable. An app can check it to know whether SaveKeys would do anything. » member page
property Modified: Boolean read fModified write SetModified;
True when the key list has been changed in memory since it was last loaded or saved. Set automatically by SetPublicKey; you rarely write it directly. Drives the auto-save-on-destroy/disable behavior together with AutoSave. » member page
property Enabled;
Inherited on/off switch. Toggling Enabled is what actually (re)loads the key list from PublicKeyFileName or, when turned off, saves and clears it (see SetEnabled). At design time Enabled maps to EnabledDesignTime, at run time to EnabledRunTime, so a design-time-populated list need not be active in the deployed app. » member page
property EnabledDesignTime;
Whether the list loads its keys while running inside the IDE designer. Set this if you want the authorized keys visible/active at design time; it is independent of the deployed run-time state. » member page
property EnabledRunTime;
Whether the list loads its keys at run time in the deployed application. This is the flag an SSH server persists/restores for its ClientKeys store so the authorized-key file is actually consulted for logins. » member page
property PublicKeyFileName;
Path to the file that backs this key list. Keys are loaded from it when the list is enabled and written back to it on save. On a server this is the authorized-client-keys file; on a client it can hold known host keys. An empty name means the list stays purely in memory and cannot be saved. » member page
property RSAPublicKeyFormat: tDSIIFPublicKeyFormatList read fRSAPublicKeyFormat write SetRSAPublicKeyFormat;
Format descriptor controlling how RSA (integer-factorization) public keys are read from and written to the backing file/text. Adjust only if you need a specific on-disk RSA key encoding; the defaults interoperate with standard SSH RSA public keys. » member page
property DSSPublicKeyFormat: tDSIDLPublicKeyFormatList read fDSSPublicKeyFormat write SetDSSPublicKeyFormat;
Format descriptor controlling how DSS (discrete-log) public keys are read from and written to the backing file/text. Full description »
property AutoSave: Boolean read fAutoSave write SetAutoSave default True;
When True (the default), in-memory changes are written back to PublicKeyFileName automatically when the list is disabled or the component is destroyed. Set to False if your app wants to control persistence explicitly via SaveKeys, or to keep run-time additions transient. » member page