Digital signatures
Let users sign PDFs with PAdES and a PKCS#12 certificate, draw handwritten signatures and verify signatures in an Electron window with NexPDF.
License module
Digital signing needs the signatures module (Business tier and above). Adding signature fields
needs forms, and electronic (drawn) signatures need annotations (Indie tier and above).
The Sign mode
The Sign mode (signatures) has:
| Tool | What it does |
|---|---|
| Signature field | Adds an empty signature field, in the Forms mode |
| Digital signature | Signs with PAdES using a .p12 or .pfx certificate (RSA or ECDSA) |
| Electronic signature | Draws or types a handwritten signature and places it on the page |
| Verify | Checks every signature of the document |
The digital signature dialog takes the certificate and its password, the reason and location, an optional visible signature on the current page, an optional trusted timestamp (TSA URL) and optional revocation data for long-term validation (LTV). Without a certificate file it creates a self-signed certificate, which is only suitable for testing.
The side panel shows each signature with its signer, revocation status and PAdES level, and says when the document was changed after it was signed.
Offer it
{
"modeConfig": { "availableModes": ["viewer", "signatures"] },
"annotationsConfig": { "availableTools": ["signature"] }
}Pass the configuration as the path of a JSON file; see Viewing pages.
From code
The document API
signs in the main process: doc.sign(p12, password, options) with a PKCS#12 file, and
doc.prepareExternalSignature, externalSignatureData and completeExternalSignature for an HSM,
smart card or cloud key, as in the Node.js SDK. The options take
level (B-B, B-T, B-LT or B-LTA). sign makes no network calls, so it signs at B-B; for
B-T, B-LT and B-LTA use await doc.signOnline(p12, password, { level, tsaUrl }) or
completeExternalSignatureOnline, which reach the TSA and the OCSP and CRL servers with the main
process's fetch. A renderer can ask for them through handleSigning and the preload script. See
Long-term signatures.
verifySignatures(bytes) from documents() verifies signed files (module signatures). Each entry now
also has pades_level (B-B, B-T, B-LT or B-LTA) and document_timestamp (true for a
document timestamp, whose signer is the timestamp authority).
Keep the signed file
Save the signed document with File, Save As… or pdf.save(path), and do not edit it afterwards:
Verify reports changes made after signing. Timestamps and LTV data need the user's machine to
reach the TSA and the OCSP and CRL servers.
Long-term archival
For PAdES B-LTA, document timestamps and archive timestamp renewal, see Long-term signatures.