API Reference
StreamSec.DSI.KeyStorageFile
Key Storage File Unit
Classes, interfaces and records
classTstCustomKeyStorageFiles
inherits from TstAbstractKeyStorageMultiFormat
function SaveKeyToFile(const aFileName: string; const aKey : iUnknown) : Boolean; virtual;
Writes a single key (any iUnknown key interface: private key, public key/certificate, or an iMPKeyList compound) to aFileName, choosing the on-disk key format automatically.
Full description »
property PrivateKeyPassword;
Password used to decrypt/encrypt password-protected key files handled by this store (e.g. PKCS#12/.pfx or encrypted PVK). Set this at design or run time when the passphrase is known in advance; if left empty the store falls back to the OnPassword callback. Applies equally whichever protocol role the keys are later used in.
» member page
property OnPassword;
Callback fired on demand when a key file needs a passphrase and none was supplied via PrivateKeyPassword. An app assigns this to prompt the user (or fetch from a vault) at the moment a protected file is read or written. Preferred over a hard-coded PrivateKeyPassword when the secret should not live in the DFM/config.
» member page
inherits from TstCustomKeyStorageFiles
property Directory;
Directory scanned for key files. Set this to point the store at the folder holding your .pvk/.cer/.pfx/.p7c files; every matching file becomes a source of managed keys. Relative paths are resolved against the current directory when read, and ForceDirectories will create the folder on demand. This store works best when each file holds a single key -- use TstKeyStorageSingleFile for multi-key files.
» member page
property FileFilter;
Wildcard mask (default '*.*') restricting which files in Directory are enumerated as keys. Set it to e.g. '*.pfx' to limit the store to one file type and avoid trying to parse unrelated files.
» member page
property OnSuggestFileKeyFormat;
Handler invoked to propose the on-disk format(s) for a key being saved to a not-yet-existing file (see SaveKeyToFile). An app assigns this to steer format choice per file name (for example pick PKCS#12 for *.pfx); if left unassigned the store falls back to its enabled formats.
» member page
property OnGetNewKeyFileName;
Handler that supplies the file name to use when a newly added key must be persisted (the store has no inherent name for a fresh key). An app assigns this to name the file, e.g. from a certificate subject or a GUID; a bare name is placed under Directory. If unassigned, the store cannot invent a name and declines to store the new key to a file.
» member page
classtKeyStorageFiles
inherits from TstCustomKeyStorageFiles
class function Description: string; override;
Returns the value of rsUseKeyStorageFiles.
property Directory;
property FileFilter;
property OnSuggestFileKeyFormat;
property OnGetNewKeyFileName;
classTstCustomKeyStorageSingleFile
inherits from TstCustomKeyStorageFiles
function GetIdentifierForNewKey(const aKey: iUnknown) : OctetString; override;
Produces the internal identifier under which a key about to be stored will be filed. Apps rarely call this directly -- the key manager calls it while adding a key so the new entry gets a stable ID.
Full description »
property FileName: TFileName read fFileName write SetFileName;
Path of the one key file this store represents. Set this to a file that may hold several keys -- typically a PKCS#12/.pfx or PKCS#7/.p7c bundle and the store exposes every key in it as a managed key. Unlike TstKeyStorageFiles (a whole directory), this component targets exactly one file and supports multi-key files properly.
» member page
inherits from TstCustomKeyStorageSingleFile
(no public members)
classtKeyStorageSingleFile
inherits from TstCustomKeyStorageSingleFile
class function Description: string; override;
Returns the value of rsUseKeyStorageSingleFile.
Types (enumerations, sets, aliases)
tGetKeyFormatsFileEvent = procedure (Sender : TObject;
const aFileName: string;
aFormats : IInterfaceList) of object;
proctGetKeyFileNameEvent
tGetKeyFormatsIntfEvent = procedure (Sender : TObject;
const aKey : iUnknown; aFormats: IInterfaceList) of object;
tGetKeyFileNameEvent = procedure (Sender : TObject;
const aKey : iUnknown;
var aFileName: string) of object;