Feature notes: PKIX / CMS implementation notes
inherits from TstAbstractKeyIndex
Abstract base for certificate key-index components whose identifier is unique per key: at most one stored key can match a given identifier (e.g. a certificate thumbprint or issuer+serial). Applications do not use this class directly; pick a concrete descendant (TstKeyIndexCertThumbprint, TstKeyIndexTBSThumbprint, TstKeyIndexSerialIssuer, ...) and attach it to a TstKeyManager so that key lookups by that identifier resolve to one key. The constructor sets Duplicates to dupIgnore, so a second key with the same identifier is silently dropped from the index.
constructor Create(AOwner: TComponent); override;
class function Unique: Boolean; override;
class function KeyPair: Boolean; override;
inherits from TstAbstractKeyIndex
Abstract base for certificate key-index components whose identifier is NOT unique per key: several stored keys may share the same identifier (e.g. a subject Distinguished Name or a cert-type classification). Applications do not use this class directly; pick a concrete descendant (TstKeyIndexSubjectName, TstKeyIndexCertType, TstKeyIndexSubjectClearTextName, ...) and attach it to a TstKeyManager. The constructor enables startup caching and accepts duplicates, so a lookup can return a set of matching keys rather than exactly one.
constructor Create(AOwner: TComponent); override;
class function Unique: Boolean; override;
class function KeyPair: Boolean; override;
inherits from TstBaseKeyIndexCertUnique
Base class (Custom prefix, no palette registration) for the certificate thumbprint index. Its identifier is DigestAlgorithm applied to the DER of the whole certificate, so applications use a descendant (TstKeyIndexCertThumbprint) when they want to look up a stored key by the fingerprint of its certificate -- e.g. matching a peer certificate seen on the wire to a locally held private key. Instantiate the Custom base only to subclass it; drop the registered TstKeyIndexCertThumbprint on a form.
procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;
class function Unequivocal: Boolean; override;
property DigestAlgorithm: tHashAlgorithm read fDigestAlgorithm write SetDigestAlgorithm;
inherits from TstCustomKeyIndexCertThumbprint
(no public members)
inherits from TstCustomKeyIndexCertThumbprint
class function Description: string; override;
inherits from TstBaseKeyIndexCertUnique
Base class (Custom prefix, no palette registration) for the "TBS thumbprint" index: the identifier is the certificate's iCertificate.TBSThumbprint -- a fingerprint over the to-be-signed portion of the certificate, computed with whatever hash the certificate's own signatureAlgorithm uses. Applications use the registered descendant (TstKeyIndexTBSThumbprint) when they want to match a stored key by a fingerprint that stays stable even if only the outer signature encoding changes; the accepted hash(es) are restricted through AllowedDigestAlgorithms. Instantiate the Custom base only to subclass it.
constructor Create(AOwner: TComponent); override;
procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;
class function Unequivocal: Boolean; override;
property AllowedDigestAlgorithms: tHashAlgorithms read fAllowedDigestAlgorithms write SetAllowedDigestAlgorithms;
inherits from TstCustomKeyIndexTBSThumbprint
(no public members)
inherits from TstCustomKeyIndexTBSThumbprint
class function Description: string; override;
inherits from TstBaseKeyIndexCertNonUnique
Base class (Custom prefix, no palette registration) for the subject-DN index: the identifier is the DER encoding of the certificate's subject Distinguished Name. Applications use the registered descendant (TstKeyIndexSubjectName) when they want to look up a stored key by exact subject name -- e.g. finding the private key whose certificate names a given subject. Several certificates may share one subject, so results are ordered by validity (see DoCompareEqual) with the longest-lived certificate preferred. Instantiate only to subclass.
class function Unequivocal: Boolean; override;
inherits from TstCustomKeyIndexSubjectName
(no public members)
inherits from TstCustomKeyIndexSubjectName
class function Description: string; override;
inherits from TstBaseKeyIndexCertNonUnique
Abstract base for indexes whose identifier is derived from the public key itself (public-key value or subjectPublicKey identifier), so the SAME identifier is produced whether the stored item is the private key or its matching public key/certificate. Applications use a descendant (TstKeyIndexPublicKey, TstKeyIndexSubjectPublicKeyIdentifier) when they hold one half of a key pair and need to find the other -- e.g. locate the private key for a public key extracted from a received certificate. Do not instantiate directly.
class function KeyPair: Boolean; override;
inherits from TstBaseKeyIndexSubjectKeyPair
Base class (Custom prefix, no palette registration) for the subjectKeyIdentifier index: the identifier is the RFC 5280 key identifier (a SHA-1 hash of the public key by default) rather than the raw key value. Because it descends from the key-pair base, the SAME identifier is produced whether the stored item is the private key, the public key or the certificate. Applications use the registered descendant (TstKeyIndexSubjectPublicKeyIdentifier) to resolve a key from an authorityKeyIdentifier/subjectKeyIdentifier seen in a certificate or CMS structure. Match also accepts the alternative identifier (PublicKeyIdentifier2) for bare keys. Instantiate only to subclass.
procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;
class function Unequivocal: Boolean; override;
inherits from TstCustomKeyIndexSubjectPublicKeyIdentifier
(no public members)
inherits from TstCustomKeyIndexSubjectPublicKeyIdentifier
class function Description: string; override;
inherits from TstBaseKeyIndexSubjectKeyPair
Base class (Custom prefix, no palette registration) for the public-key index: the identifier is the DER of the raw subjectPublicKey (the key value itself), covering RSA/DSA/EC as well as the ML-DSA/ML-KEM/composite/SLH-DSA families via GetCertOrSPKIFromKey. Applications use the registered descendant (TstKeyIndexPublicKey) when they must correlate a private key, public key and certificate purely by matching key material -- for instance finding the private key that goes with a public key parsed from a signature or certificate. Instantiate only to subclass.
class function Unequivocal: Boolean; override;
inherits from TstCustomKeyIndexPublicKey
(no public members)
inherits from TstCustomKeyIndexPublicKey
class function Description: string; override;
inherits from TstBaseKeyIndexCertUnique
Base class (Custom prefix, no palette registration) for the issuer+serial index keyed as an authorityKeyIdentifier: the identifier is the DER of an iAuthorityKeyIdentifier holding the certificate's issuer name and serial number. Applications use the registered descendant (TstKeyIndexSerialIssuer) to resolve a key from an authorityKeyIdentifier extension -- e.g. locating the CA/issuer key a certificate points at. See TstCustomKeyIndexSerialIssuerCMS for the CMS IssuerAndSerialNumber variant used by SignedData/EnvelopedData. Instantiate only to subclass.
class function Unequivocal: Boolean; override;
function GetSerialIssuerFromKey(const aPubl: iUnknown): iAuthorityKeyIdentifier;
inherits from TstCustomKeyIndexSerialIssuer
(no public members)
inherits from TstCustomKeyIndexSerialIssuer
class function Description: string; override;
inherits from TstCustomKeyIndexSerialIssuer
Base class (Custom prefix, no palette registration) for the CMS issuer+serial index: like TstCustomKeyIndexSerialIssuer but the identifier is the DER of a CMS iIssuerAndSerialNumber (RFC 5652) rather than an authorityKeyIdentifier. Applications use the registered descendant (TstKeyIndexSerialIssuerCMS) so that a SignerInfo/RecipientInfo that names its certificate by IssuerAndSerialNumber resolves directly to the matching stored key. Instantiate only to subclass.
function GetSerialIssuerFromKey(const aPubl: iUnknown): iIssuerAndSerialNumber;
inherits from TstCustomKeyIndexSerialIssuerCMS
(no public members)
inherits from TstCustomKeyIndexSerialIssuerCMS
class function Description: string; override;
inherits from TstBaseKeyIndexCertUnique
Base class (Custom prefix, no palette registration) for the clear-text subject index: instead of the DER subject name, the identifier is a human-readable "/CN=.../O=..." string built from the certificate's subject, limited to the attributes chosen in IndexedAttributes. Applications use the registered descendant (TstKeyIndexSubjectClearTextName) when they want to look up a stored key by a readable name fragment (typically just the Common Name) rather than by an exact binary DN -- a lookup succeeds when every requested attribute is present among the certificate's attributes, so it acts as a subset/contains match. Several certificates may share a name; results are ordered by validity. Instantiate only to subclass. Base class (Custom prefix, no palette registration) for the OCSP CertID index: the identifier is the DER of an RFC 6960 CertID, which is the exact value an OCSP request names a certificate by. An OCSP responder can therefore take the CertID straight out of the request it received and ask the key manager for the certificate, with no knowledge of which CA issued it - so ONE responder can serve any number of CAs, which is what an issuer-and-serial index cannot do: that identifier needs the issuer's NAME, and a CertID carries only a hash of it.
THE FOUR FIELDS, and where each comes from when indexing a stored certificate. They are computed exactly as TstAbstractOcsp.BuildCertID computes them for a request, because an identifier that did not agree with the client's would never match:
hashAlgorithm SHA-1, the RFC 5019 interoperable default. A CertID's hash algorithm is the CLIENT's choice, and one certificate has one identifier here, so this index answers for SHA-1 CertIDs. Every lightweight client sends SHA-1; RFC 5019 s2.1 requires it. issuerNameHash SHA-1 over the DER of the certificate's own issuer DN.
issuerKeyHash the certificate's authorityKeyIdentifier keyIdentifier. This is the one field a certificate does not carry directly - it is a hash of the ISSUER's public key - and the AKI is where the issuer put exactly that (RFC 5280 s4.2.1.1 method 1, and what this library writes). A certificate with no AKI is therefore NOT INDEXABLE here rather than indexed under an empty hash: a silent mismatch would look like a certificate nobody has.
serialNumber copied from the certificate.
Instantiate only to subclass; applications add the registered descendant TstKeyIndexOcspCertID.
class function Unequivocal: Boolean; override;
function GetCertIDFromKey(const aPubl: iUnknown): iCertID;
inherits from TstCustomKeyIndexOcspCertID
(no public members)
inherits from TstCustomKeyIndexOcspCertID
class function Description: string; override;
inherits from TstBaseKeyIndexCertNonUnique
constructor Create(AOwner: TComponent); override;
class function Unequivocal: Boolean; override;
function AttributeToText(const aAttr: iAttributeTypeAndValue): string;
function NameToText(const aName: iRDNSequence): string; overload;
function NameToText(const aName : iRDNSequence; const aAttrs: tAttrValueEnumSet) : string; overload;
property IndexedAttributes: tAttrValueEnumSet read fIndexedAttributes write SetIndexedAttributes;
inherits from TstCustomKeyIndexSubjectClearTextName
(no public members)
inherits from TstCustomKeyIndexSubjectClearTextName
class function Description: string; override;
inherits from TstBaseKeyIndexCertNonUnique
Base class (Custom prefix, no palette registration) for the cert-type index: the identifier is a textual "CT/..." descriptor built from the certificate's signature algorithm, public-key algorithm, key usage and extended key usage (selected by IndexedCertType). Applications use the registered descendant (TstKeyIndexCertType) to look up keys by CAPABILITY rather than identity -- e.g. "give me any key whose certificate permits digitalSignature and TLS server authentication". The identifier syntax supports & (all-of) and | (any-of) operators over the listed values. Instantiate only to subclass.
class function Unequivocal: Boolean; override;
function CertTypeToText(const aCert: iCertificate): string; overload;
function CertTypeToText(const aCert: iCertificate; const aICT : tIndexedCertTypes) : string; overload;
function CertTypesToText(const aSignatureAlgorithms: array of string; const aPublicKeyAlgorithms: array of string; const aKeyUsage : tKeyUsage; const aExtKeyUsage : array of string) : string;
property IndexSignatureAlgorithm: Boolean read GetIndexSignatureAlgorithm write SetIndexSignatureAlgorithm;
property IndexPublicKeyAlgorithm: Boolean read GetIndexPublicKeyAlgorithm write SetIndexPublicKeyAlgorithm;
property IndexKeyUsage: Boolean read GetIndexKeyUsage write SetIndexKeyUsage;
property IndexExtKeyUsage: Boolean read GetIndexExtKeyUsage write SetIndexExtKeyUsage;
property IndexedCertType: tIndexedCertTypes read fIndexedCertType write SetIndexedCertType;
inherits from TstCustomKeyIndexCertType
(no public members)
inherits from TstCustomKeyIndexCertType
class function Description: string; override;