TPDFlibExternalSigningKey
Security and signatures
Description
Abstract base class for a signing key held outside the process, such as on a smart card or an HSM
Subclass it and override the abstract members to feed appliance-backed keys into the Enterprise signing pipeline; the bundled Enterprise PKCS#11 client TPDFlibPKCS11Client descends from it
Syntax
Delphi
TPDFlibExternalSigningKey= Class
Protected
Function GetExternalKeyType: Cardinal; Virtual; Abstract;
Function GetExternalLastError: AnsiString; Virtual; Abstract;
Function GetExternalConnected: Boolean; Virtual; Abstract;
Function GetExternalCertificateDER: AnsiString; Virtual; Abstract;
Public
Function Connect: Boolean; Virtual; Abstract;
Function SignHash(Const Digest: AnsiString; DigestAlgorithm,
SignatureAlgorithm: Integer; Out Signature: AnsiString): Boolean; Virtual; Abstract;
Function SignEdDSA(Const Message: AnsiString;
Out Signature: AnsiString): Boolean; Virtual; Abstract;
Property KeyType: Cardinal Read GetExternalKeyType;
Property LastError: AnsiString Read GetExternalLastError;
Property Connected: Boolean Read GetExternalConnected;
Property CertificateDER: AnsiString Read GetExternalCertificateDER;
End;Parameters
| Connect | Opens the session and resolves the key and certificate |
|---|---|
| SignHash | Signs a digest with the appliance key |
| SignEdDSA | Signs a message under RFC 8032 EdDSA, which signs the message itself |
| KeyType | The PKCS#11 key type as a PL_EXTERNAL_KEY_* constant |
| Connected / LastError | Session state and the last backend error text |
| CertificateDER | DER of the signing certificate once connected |
Return values
Connect is called before the first signature; CertificateDER feeds the detached-CMS builder whilst the Sign methods serve the digest events of a sign process
The Enterprise edition registers a ready-made implementation through TPDFlibPKCS11Client; custom subclasses follow the same contract