Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.Mobile.CertConfig

Feature notes: TLS implementation notes (RFC map)

Classes, interfaces and records

classeCertConfig

inherits from Exception

Raised while opening the files named in the configuration: a certificate the key store would not accept, or a PFX that will not open.

(no public members)

classTsmCustomCertConfig

inherits from TComponent

constructor Create(AOwner: TComponent); override;
Create: Base constructor. Allocates the internal PFX-filename, PFX-password and certificate-filename string lists and sets NoDialogs to True when the project defines NO_GUI (False otherwise). Apps normally drop the concrete TsmCertConfigIni/TsmCertConfigReg descendant on a form rather than calling this directly; call it only when creating the component in run-time code. » member page
destructor Destroy; override;
Destroy: Frees the internal PFX/cert string lists. Standard component teardown; apps do not call this directly (it runs when the owner form or an explicit Free destroys the component). » member page
procedure Activate;
Activate: Calls PerformLoad, PerformSetup, PerformSave, PerformOpenFiles. Call Activate if the component is created in run time code. If the component is created as part of form streaming, Activate will be called automatically, if ActiveRuntime is set to True at design time. » member page
procedure ActivateClean;
ActivateClean: Ignores any pre-existing settings and calls PerformSetup, PerformSave, PerformOpenFiles. » member page
function GetMyCertificate: iCertificate;
GetMyCertificate: Convenience accessor that returns the first "my" certificate from the linked KeysAndCerts server -- it clears that server's MyCertList and adds a single entry, which the collection binds to the first certificate actually held in the store, then hands back that entry's iCertifica... Full description »
procedure AddPFXFile(const aFileName, aPassword: string);
AddPFXFile: Adds an item to PFXFileNames and to PFXPasswords. Use this method in a OnNoPFXSelected event to set up the configuration when the NoDialogs property is set to True. » member page
property PFXFileName: string read GetPfxFilename write SetPfxFilename;
PFXFileName: Single-file convenience view of the PFX list -- reading returns the first configured PFX path (empty if none), writing replaces the whole list with just this one file. Use it when the app loads exactly one PFX holding the local key/cert; for multiple PFX files use AddPFXFile / PFXFileNames instead. » member page
property PFXPassword: string read GetPfxPassword write SetPfxPassword;
PFXPassword: Single-file convenience view of the PFX-password list, paired with PFXFileName -- reading returns the first password (empty if none), writing replaces the list with just this one. Set it alongside PFXFileName when configuring a single PFX programmatically (e.g. in NoDialogs mode). » member page
property PFXFileNames[aIndex: Integer]: string read GetPfxFilenames write SetPfxFilenames;
PFXFileNames: Indexed access to each configured PFX file path when more than one is in use (populated by AddPFXFile, the open dialog, or persisted settings). Iterate 0..PFXFileNameCount-1 to read/rewrite individual paths; the write accessor updates an existing slot, so grow the list via AddPFXFile first. » member page
property PFXFileNameCount: Integer read GetPFXFileNameCount;
PFXFileNameCount: Number of PFX files currently configured. Use it as the loop bound over PFXFileNames/PFXPasswords, or to check whether any PFX was selected/loaded at all. » member page
property PFXPasswords[aIndex: Integer]: string read GetPfxPasswords write SetPfxPasswords;
PFXPasswords: Indexed access to the password for each PFX file, positionally matching PFXFileNames. Read/rewrite the password for a given PFX (e.g. to de-obfuscate before use); the write accessor updates an existing slot, so add entries via AddPFXFile which appends a filename/password pair together. » member page
property PFXPasswordCount: Integer read GetPFXPasswordCount;
PFXPasswordCount: Number of PFX passwords held, normally equal to PFXFileNameCount. Useful as a sanity check that every configured PFX has a matching password. » member page
property CertFileNames: TStrings read fCertFileNames write SetCertFileNames;
CertFileNames: List of plain (non-PFX) certificate files -- DER/PEM .cer, .der or .crt -- imported into KeysAndCerts as trusted/chain certificates that carry no private key. Assign it (or populate it in an OnNoPFXSelected handler) to supply CA/intermediate certs the local key alone does not include. » member page

classTsmCertConfigIni — component reference

inherits from TsmCustomCertConfig

property ActiveRuntime;
ActiveRuntime: Set this True at design time so the component runs its full Activate sequence (load ini, prompt/setup, save, import into KeysAndCerts) automatically when the owning form is streamed in at run time. Leave it False and call Activate yourself if you want to control the timing. » member page
property KeysAndCerts;
KeysAndCerts: Point this at the TsmStreamSecII (or other TsmCustomTLSInternalServer descendant) whose credential store should receive the PFX keys/certs this component loads. This is the credential source TLS uses for BOTH client and server roles, so an app links it here regardless of which side of the handshake it plays. » member page
property NoDialogs;
NoDialogs: Set True on headless/mobile or non-GUI apps so the component never pops the PFX/certificate open dialogs; instead configure the files programmatically (AddPFXFile / CertFileNames), typically from an OnNoPFXSelected handler. Always True when the project defines NO_GUI. » member page
property IniFileName: string read GetIniFileName write SetIniFileName;
IniFileName: Name of the ini file this component reads persisted PFX and certificate selections from and writes them back to. Set this when an app wants a specific ini name; leave it empty to default at run time to <exe name>Certs.ini next to the executable. » member page
property OnGetIniFilePath: tGetFilePathEvent read fOnGetIniFilePath write SetOnGetIniFilePath;
OnGetIniFilePath: Fired while resolving where the ini file lives (its default is the executable's directory). Handle it to redirect persistence to a writable per-user/app-data location, e.g. on systems where the program directory is read-only. » member page
property BeforeUsePassword;
BeforeUsePassword: Handle this to de-obfuscate (or otherwise transform) a PFX password just before it is used to open the file, typically to reverse whatever obfuscation you applied in AfterEnterPassword before it was stored in the ini file. » member page
property AfterSelectPFXFile;
AfterSelectPFXFile: Fired after the user picks a PFX file in the open dialog. Handle it e.g. to copy/move the selected PFX into your application's data directory and rewrite the path that gets persisted. » member page
property AfterSelectCertificate;
AfterSelectCertificate: Fired for each plain certificate file the user picks. Handle it e.g. to relocate the selected certificate into your app's data directory and adjust the stored path. » member page
property AfterEnterPassword;
AfterEnterPassword: Fired after the user types a PFX password. Handle it e.g. to obfuscate the password before it is written into the ini file (pair with BeforeUsePassword to reverse it). » member page
property AfterActivate;
AfterActivate: Fired once the credentials have been imported into KeysAndCerts. Handle it to verify, e.g. via GetMyCertificate, that a usable certificate/key was actually loaded before the app relies on it. » member page
property OnGetFileDirectory;
OnGetFileDirectory: Fired before the open dialogs are shown to supply their initial directory. Handle it to steer the user toward the folder where your PFX/certificate files are expected. » member page
property OnException;
OnException: Fired when loading/importing raises. Set the var Raise parameter False to swallow the error (e.g. continue without credentials) instead of letting it propagate. » member page
property OnPFXFileMissing;
OnPFXFileMissing: Fired when a persisted PFX path no longer exists on disk at import time. Handle it to prompt the user to re-select the file or to fall back to another credential source. » member page
property OnNoPFXPasswordEntered;
OnNoPFXPasswordEntered: Fired when the user dismisses the password prompt without entering a password. Handle it to warn the user or abort the setup. » member page
property OnNoPFXSelected;
OnNoPFXSelected: Fired when no PFX file gets selected -- either because NoDialogs is True or the user cancelled the open dialog. This is the hook a headless app uses to configure credentials programmatically via AddPFXFile and CertFileNames. » member page

classTsmCertConfigReg — component reference

inherits from TsmCustomCertConfig

constructor Create(AOwner: TComponent); override;
Create: Constructs the registry-backed cert-config component and seeds the registry location it persists to: RootKey defaults to HKEY_CURRENT_USER and Key to a StreamSec demo subkey path. Full description »
property ActiveRuntime;
ActiveRuntime: Set this True at design time so the component runs its full Activate sequence (load from registry, prompt/setup, save, import into KeysAndCerts) automatically when the owning form is streamed in at run time. Leave it False and call Activate yourself if you want to control the timing. » member page
property KeysAndCerts;
KeysAndCerts: Point this at the TsmStreamSecII (or other TsmCustomTLSInternalServer descendant) whose credential store should receive the PFX keys/certs this component loads. This is the credential source TLS uses for BOTH client and server roles, so an app links it here regardless of which side of the handshake it plays. » member page
property NoDialogs;
NoDialogs: Set True on headless or non-GUI apps so the component never pops the PFX/certificate open dialogs; instead configure the files programmatically (AddPFXFile / CertFileNames), typically from an OnNoPFXSelected handler. Always True when the project defines NO_GUI. » member page
property RootKey: HKEY read fRootKey write SetRootKey;
RootKey: The registry root hive under which persisted PFX and certificate selections are stored/read (defaults to HKEY_CURRENT_USER). Set it to HKEY_LOCAL_MACHINE for machine-wide credentials, keeping in mind that hive is typically writable only by an elevated process. » member page
property Key: string read fKey write SetKey;
Key: The registry subkey path (under RootKey) that holds the persisted PfxFilename/PfxPassword/CertFilenames values. Set this to your application's own key so credentials are not saved under the default StreamSec demo path. » member page
property BeforeUsePassword;
BeforeUsePassword: Handle this to de-obfuscate (or otherwise transform) a PFX password just before it is used to open the file, typically to reverse whatever obfuscation you applied in AfterEnterPassword before it was stored in the registry. » member page
property AfterSelectPFXFile;
AfterSelectPFXFile: Fired after the user picks a PFX file in the open dialog. Handle it e.g. to copy/move the selected PFX into your application's data directory and rewrite the path that gets persisted. » member page
property AfterSelectCertificate;
AfterSelectCertificate: Fired for each plain certificate file the user picks. Handle it e.g. to relocate the selected certificate into your app's data directory and adjust the stored path. » member page
property AfterEnterPassword;
AfterEnterPassword: Fired after the user types a PFX password. Handle it e.g. to obfuscate the password before it is written into the registry (pair with BeforeUsePassword to reverse it). » member page
property AfterActivate;
AfterActivate: Fired once the credentials have been imported into KeysAndCerts. Handle it to verify, e.g. via GetMyCertificate, that a usable certificate/key was actually loaded before the app relies on it. » member page
property OnGetFileDirectory;
OnGetFileDirectory: Fired before the open dialogs are shown to supply their initial directory. Handle it to steer the user toward the folder where your PFX/certificate files are expected. » member page
property OnException;
OnException: Fired when loading/importing raises. Set the var Raise parameter False to swallow the error (e.g. continue without credentials) instead of letting it propagate. » member page
property OnPFXFileMissing;
OnPFXFileMissing: Fired when a persisted PFX path no longer exists on disk at import time. Handle it to prompt the user to re-select the file or to fall back to another credential source. » member page
property OnNoPFXPasswordEntered;
OnNoPFXPasswordEntered: Fired when the user dismisses the password prompt without entering a password. Handle it to warn the user or abort the setup. » member page
property OnNoPFXSelected;
OnNoPFXSelected: Fired when no PFX file gets selected -- either because NoDialogs is True or the user cancelled the open dialog. This is the hook a headless app uses to configure credentials programmatically via AddPFXFile and CertFileNames. » member page

Types (enumerations, sets, aliases)

proctExceptionRaiseEvent

  tExceptionRaiseEvent = procedure (Sender: TObject; aE: Exception; var aRaise: Boolean) of object;

proctGetFilePathEvent

  tGetFilePathEvent = procedure (Sender: TObject; var aFilePath: string) of object;

proctModifyPasswordEvent

  tModifyPasswordEvent = procedure (Sender: TObject; var aPassword: string) of object;