An
IExternalSigner that signs with a key on a PKCS#11 device - a smart card, a USB token or a
hardware security module - through the vendor's PKCS#11 library, on Windows, Linux and macOS.
Inheritance HierarchySystemObject
ExpertPdf.Anywhere.PDFSecurityPkcs11Signer
Namespace: ExpertPdf.Anywhere.PDFSecurityAssembly: ExpertPdf.Anywhere (in ExpertPdf.Anywhere.dll) Version: 22.0
Syntaxpublic sealed class Pkcs11Signer : IExternalSigner,
IDisposable
Public NotInheritable Class Pkcs11Signer
Implements IExternalSigner, IDisposable
The Pkcs11Signer type exposes the following members.
Constructors
Properties| | Name | Description |
|---|
 | Certificates |
Gets the signing certificate and its issuers, each DER-encoded.
|
Top
Methods| | Name | Description |
|---|
 | Dispose |
Closes the session on the token.
|
 | Sign |
Signs the request's digest on the token.
|
Top
RemarksThe signer opens a session on the token, logs in with the PIN and finds the private key: by its label, or
the only signing key on the token when no label is given. The certificate is the token's certificate for that
key, unless the certificates are given; the issuer certificates are added from the token and the system
stores.
The session stays open until the signer is disposed. Signing happens when the document is saved, so
dispose of the signer after the save. Several signers can use the same library at once.
Exampleusing (Pkcs11Signer signer = new Pkcs11Signer("/usr/lib/softhsm/libsofthsm2.so", "1234", null, null))
{
PdfSecurityManager manager = new PdfSecurityManager();
manager.Sign("input.pdf", "signed.pdf", signer, "Signature1", "Approved", "Office", "",
0, new RectangleF(40, 40, 220, 70), null);
}Using signer As New Pkcs11Signer("/usr/lib/softhsm/libsofthsm2.so", "1234", Nothing, Nothing)
Dim manager As New PdfSecurityManager()
manager.Sign("input.pdf", "signed.pdf", signer, "Signature1", "Approved", "Office", "",
0, New RectangleF(40, 40, 220, 70), Nothing)
End Using
See Also