Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.DSI.PkixKeyManager

Feature notes: PKIX / CMS implementation notes

Classes, interfaces and records

classTstCustomCertificateManager

inherits from TstKeyManager

function GetCertificate(const aIdentifier: OctetString): iCertificate; overload;
Look up an end-entity or CA certificate by identifier (typically a subject key identifier or issuer-and-serial). Applies the manager's revocation and policy filters, so a certificate that is expired, revoked or otherwise disallowed is reported as nil; use this when you want only certificates the manager currently considers usable. Searches all enabled indexes. » member page
function GetUnfilteredCertificate(const aIdentifier: OctetString): iCertificate; overload;
As GetCertificate but bypasses the IsIdentifierAllowed/IsKeyAllowed filters, returning the raw stored certificate even if it is expired or revoked. Use when you must inspect a certificate the filters would otherwise hide (e.g. diagnostics, or building a chain for display). » member page
function GetCertificate(const aIndexName : string; const aIdentifier: OctetString) : iCertificate; overload;
Overload that restricts the lookup to a single named index (e.g. one of RootIndexName/MyIndexName), rather than scanning every enabled index. Use when you know which store the certificate lives in and want to disambiguate. » member page
function GetUnfilteredCertificate(const aIndexName : string; const aIdentifier: OctetString) : iCertificate; overload;
Unfiltered, single-index variant of GetCertificate; returns the raw stored certificate from the named index without applying revocation/policy filters. » member page
function GetRSAPrivateKey(const aIdentifier: OctetString): iIFPrivateKey; overload;
Locate the RSA (integer-factorization) private key that matches the public key found under aIdentifier. Used when the app must sign or decrypt with a locally held RSA key, e.g. serving a TLS server certificate or decrypting a CMS EnvelopedData bag. Returns nil if no matching private key is stored. » member page
function GetRSAPrivateKey(const aCert: iCertificate): iIFPrivateKey; overload;
As above, but keyed directly by a certificate whose SPKI is an RSA public key; matches the private key against that certificate. Convenient when you already hold the iCertificate (e.g. inside ExportToPFXFile). » member page
function GetDSSPrivateKey(const aIdentifier: OctetString): iDLPrivateKey; overload;
Locate the DSA/ECDSA (discrete-log) private key matching the public key at aIdentifier. Used when signing with a locally held DL key (DSA or ECDSA). » member page
function GetDSSPrivateKey(const aCert: iCertificate): iDLPrivateKey; overload;
As above, keyed by a certificate whose SPKI is a discrete-log public key. » member page
function GetSignPrivateKey(const aIdentifier: OctetString): iSignPrivateKey; overload;
Locate any signing private key (RSA, DSA, ECDSA, EdDSA, ML-DSA, ...) matching aIdentifier, without the caller needing to know the algorithm family. This is the general entry point apps use to obtain the private key for producing a signature (e.g. TLS CertificateVerify, CMS SignedData). » member page
function GetSignPrivateKey(const aCert: iCertificate): iSignPrivateKey; overload;
As above, keyed by the certificate; also copies the certificate's attributes onto the returned key (SetAttributes), so the signature uses the algorithm parameters declared by that certificate. » member page
function GetKEMPrivateKey(const aCert: iCertificate): iMLKEMPrivateKey;
Retrieve the ML-KEM private key whose public key matches aCert's SPKI. Used by CMS EnvelopedData KEMRecipientInfo (RFC 9629) decryption. » member page
function GetCompositeKEMPrivateKey(const aCert: iCertificate): iCompositeMLKEMPrivateKey;
As GetKEMPrivateKey, for Composite-ML-KEM. » member page
function GetMPPrivateKey(const aIdentifier: OctetString): iMPPrivateKey; overload;
Return an iMPPrivateKey wrapper (tMPPrivateKeyIF or tMPPrivateKeyDL) that couples the stored private key with the iMPPublicKey found for aIdentifier in one object. Full description »
function GetMPPrivateKey(const aCert: iCertificate): iMPPrivateKey; overload;
As above, keyed by the certificate. ImportFromCMS/ImportFromPFXFile call this to classify each imported certificate: a non-nil result means the matching private key is present, so the cert belongs in the "My" store. » member page
function GetCACertificate(const aCert: iCertificate): iCertificate;
Given a certificate, find its issuer (CA) certificate by walking the manager's key-filter chains. Used to build or complete a certificate chain - e.g. when exporting a chain to CMS/PFX, or verifying a peer certificate up to a root. Returns nil once the top of the available chain is reached. » member page
function SetPrivateKey(aPrivateKey: iUnknown): Boolean;
Store a private key (any supported type) into the "My" store/index, i.e. register a key this endpoint owns and will use to authenticate itself. Typically called when provisioning the local identity for a TLS/CMS role. Returns True if the key was added (or already present). » member page
function SetCACertificate(const aCACert: iCertificate): Boolean;
Add a CA certificate to the Root store/index, making it an explicitly trusted anchor for path validation. Raises if aCACert is not a CA certificate. Use to seed the trust store with roots the app trusts. » member page
function GetPrivateCertificate(const aIdentifier: OctetString): iCertificate;
Return, from the "My" store, the certificate matching aIdentifier for which a corresponding private key is also held - i.e. one of this endpoint's own credentials. Use when selecting which local certificate to present (e.g. a TLS client/server certificate). » member page
function GetPrivateCACertificate: iCertificate;
Return the first CA certificate in the "My" store for which a private key is also held - i.e. this endpoint acts as a CA and can issue/sign with it. Use when the app itself operates as a certificate authority. » member page
function ImportFromCMS(var aContentInfo : iContentInfo; aExplicitTrust: Boolean; var aErrorMsg : string; var aErrorCodes : tPkixCertVerificationErrors; aAllowExpired : Boolean = False) : Boolean;
Import all certificates carried in a CMS SignedData structure into the manager, sorting them into chain order and filing each into the right store: own certs (private key present) go to "My", self-signed CAs to Root (only when aExplicitTrust), verified intermediates to Collected, and certs failin... Full description »
procedure ExportChainToCMS(var aContentInfo : iContentInfo; const aEndEntityCert: iCertificate; aSort : Boolean; aIncludeRoot : Boolean);
Build the certificate chain for aEndEntityCert (by repeatedly calling GetCACertificate) and append it into a CMS SignedData's certificate set, creating the iContentInfo if none is passed. Use to emit a chain for transmission or storage; aIncludeRoot controls whether the self-signed root is included, aSort is currently a no-op placeholder. » member page
function ImportFromPFXFile(const aFilename: string; const aPassword: UnicodeString) : Boolean;
Load a PKCS#12/PFX file: private keys are filed into the "My" store; each certificate is routed by whether we hold its private key (My), whether it is a CA (Root) or otherwise (Trusted). Full description »
function ExportToPFXFile(const aFilename : string; const aPassword : UnicodeString; const aEndEntityCert: iCertificate; aFriendlyName : UnicodeString = ''; aProviderName : UnicodeString = ''; aUsePBES2 : Boolean = True) : Boolean;
Export aEndEntityCert together with its private key (RSA only - fails if no RSA private key is held) and its CA chain to a password-protected PFX file. Full description »
property CollectedChainFilterName: string read fCollectedChainFilterName write SetCollectedChainFilterName;
Design-time link: the Name of the key-filter-chain component used to validate certificates collected during import (ImportFromCMS uses it to decide whether an intermediate goes to the Collected store or must be treated as untrusted). Set this to wire the manager to its chain-validation filter. » member page
property CollectedCRLFilterName: string read fCollectedCRLFilterName write SetCollectedCRLFilterName;
Design-time link naming a CRL filter component for collected certificates. The name is stored (and exposed to its property editor) but is not consumed by any method in this unit - the setter only records the string; revocation checking during import is driven by the CollectedChainFilterName chain. » member page
property RootStoreName: string read fRootStoreName write SetRootStoreName;
Name of the storage holding trusted root (self-signed CA) certificates - the trust anchors. SetCACertificate and PFX/CMS import file roots here. Set the Root/Trusted/My/Collected store+index names to bind this manager to the actual TstAbstractKeyStorage/index components that hold each category of key. » member page
property RootIndexName: string read fRootIndexName write SetRootIndexName;
Name of the index over the Root store (how root certs are looked up). » member page
property TrustedStoreName: string read fTrustedStoreName write SetTrustedStoreName;
Name of the storage for explicitly trusted non-root certificates (leaf/ intermediate certs the app decided to trust despite an untrusted issuer). » member page
property TrustedIndexName: string read fTrustedIndexName write SetTrustedIndexName;
Name of the index over the Trusted store. » member page
property MyStoreName: string read fMyStoreName write SetMyStoreName;
Name of the storage holding this endpoint's own certificates - those for which a matching private key is held (used to present a local identity). » member page
property MyIndexName: string read fMyIndexName write SetMyIndexName;
Name of the index over the My store. » member page
property OnInvalidCertificate: tSignatureVerificationFailureEvent read fOnInvalidCertificate write SetOnInvalidCertificate;
Cf. TstKeyFilterChain.OnInvalidCertificate NOTE: TstKeyFilterChain.OnInvalidCertificate occurs before TstCertificateManager.OnInvalidCertificate. Fires when path validation rejects a certificate, letting the app inspect the error codes and optionally set aExplicitTrust to accept it anyway (e.g. prompting the user to trust an unknown certificate). Leave unassigned to reject silently. » member page

classTstCertificateManager — component reference

inherits from TstCustomCertificateManager

(no public members)