How to Bulk Sign PDFs with a DSC Token
Sign hundreds of invoices or certificates with your USB DSC token without opening each file: what you need, the steps, PIN-prompt fixes and how to verify.
To bulk sign PDFs with a DSC, you need three things: a signing certificate on a USB token, the token's driver installed on a Windows PC, and software that can sign a batch of files in one pass. Signing one file at a time in a PDF reader works for a handful of documents. Past that, use a bulk signer that watches a folder, signs every PDF placed in it with your token, and saves the signed copies to an output folder. This guide covers both methods, explains why automated signing often hangs on the PIN prompt, and shows how to check that the signatures are valid.
What you need before you start
A signing DSC from a licensed Certifying Authority. In India, Digital Signature Certificates are issued by Certifying Authorities licensed by the Controller of Certifying Authorities (CCA). Class 3 is the class in use today for document signing. If you were issued a pair of certificates (one for signing and one for encryption), use the signing certificate.
A USB crypto token holding the certificate. CCA rules require the private key for these certificates to be generated and kept on a hardware cryptographic module validated to FIPS 140 Level 2 or higher, which in practice means a USB token. The key never leaves the token, so every signature has to be made by the token itself. That's why the token must be plugged in and unlocked with its PIN.
The token's driver (middleware). Each token model ships a driver that lets Windows and signing software talk to it. Common tokens include the Feitian ePass2003 and its rebrands such as the HyperPKI HYP2003. If Windows doesn't show your certificate under the token's utility, fix that first. No signing tool can work until the certificate is visible.
A Windows PC that stays logged in while signing. This sounds trivial, but it's the most common reason automated signing fails. The section on PIN prompts below explains why.
Method 1: sign one PDF at a time in a PDF reader
For a few files a day, a PDF reader that supports certificate signatures is enough. In Adobe Acrobat or Acrobat Reader, open the PDF and use the certificate signing tool (in current versions, All tools → Use a certificate → Digitally sign). Then draw the box where the signature should appear, choose your token certificate from the list and enter the PIN.
This method is reliable but slow. For each document you open the file, place the signature, pick the certificate, type the PIN, save under a new name and close. If each file takes even 45 seconds, a batch of 200 month-end invoices is two and a half hours of one person's time, and a single mistake (wrong page, wrong certificate) means redoing a file.
Method 2: bulk sign with a folder-watch signer
A bulk signer removes the per-file work. You set it up once with:
- an input folder, where unsigned PDFs are placed (by a person, or by your billing or ERP system exporting invoices)
- an output folder, where signed copies are written
- the certificate to use, picked from the token
- the signature appearance: page, position and the text shown in the visible signature stamp
After that, the steps are:
- Plug in the token and make sure the signing app is running in your logged-in Windows session.
- Copy or export the batch of PDFs into the input folder.
- The signer picks up each file, signs it with the token and writes the signed PDF to the output folder.
- Check the activity log or report for files that failed (for example, a password-protected PDF), fix those and drop them in again.
If different people or departments sign different documents, look for support for several signing profiles, each with its own input folder, output folder and certificate, running side by side on the same machine.
This is how our own bulk PDF signer, 0signer, works. It runs from the Windows system tray, watches one or more folder pairs, signs with hardware tokens such as the HyperPKI HYP2003 through PKCS#11, lets you place the visible signature stamp, and keeps a log of every file it signed.
Some tools offer template-based batch signing instead, where you pick a set of files and apply a saved signature layout. That works well when a person starts each batch. A folder watch suits documents that arrive continuously from another system.
Why automated signing hangs on the PIN prompt
The most common complaint about automated DSC signing is that it simply stops: no error, no signed files. The cause is usually where the signing program runs.
Many automation tools run as a Windows Service. Services run in a separate session with no visible desktop. When the program asks the token to sign, the token's driver tries to show its PIN dialog. In a service session nobody can see or answer that dialog, so signing waits forever.
There are two ways around this:
- Run the signer inside the logged-in user's session, for example as a tray application started by a Scheduled Task at log-on, instead of as a service. The token's PIN dialog then has a desktop to appear on.
- Sign through the token's PKCS#11 interface with the PIN supplied once, so the driver doesn't show a dialog for every file. PKCS#11 is the standard programming interface most tokens provide. Windows also has its own CSP/CNG route, which is the usual fallback when PKCS#11 isn't available.
If your current tool asks for the PIN on every document, or hangs when nobody is logged in, one of these two is almost always the reason.
How to check the signed PDFs
Signed doesn't mean valid to the person receiving the file. Check a sample from every batch.
- Open a signed PDF in Adobe Acrobat or Reader and look at the signature panel. Adobe's help explains how to validate all signatures in a document and read the status of each one.
- A green tick means the signature is valid and the document hasn't changed since it was signed.
- A "validity unknown" warning usually means Acrobat couldn't trace your certificate back to a root it trusts, not that the signature is broken. Acrobat trusts certificates that chain to the Adobe Approved Trust List or to certificates you've added to your trusted list. Indian DSCs chain to the CCA's root certificate, which the CCA publishes on its website. Adobe documents how to add a certificate to your trusted certificates and mark it as a trusted root. Only do this for a root you have downloaded from the official source, because Acrobat will then trust everything issued under it.
- A red cross means the file was changed after signing, or the certificate was revoked or expired at signing time. Re-sign the original file.
Ask the people who receive your documents what they see, too. If a client's auditor sees "validity unknown", send them the same note about trusting the CCA root.
Are bulk-signed PDFs legally valid?
Yes. A PDF signed with your DSC is the same whether you sign it by hand in a reader or a bulk signer signs it with your token. The Information Technology Act, 2000 provides for authenticating electronic records with a digital signature (section 3) and gives legal recognition to electronic signatures (section 5). What matters is that the certificate was valid and belonged to the authorised signatory when the document was signed.
Two practical cautions:
- Only sign what you would have signed by hand. A folder-watch signer signs whatever lands in the folder, so restrict who and what can write to the input folder.
- Keep the token physically secure. Anyone who has the token and the PIN can sign as you.
Frequently asked questions
Can I bulk sign PDFs with a DSC without Adobe Acrobat?
Yes. Bulk signing tools talk to your USB token directly through its driver, so you don't need Acrobat to sign. You will still want a PDF reader such as Acrobat Reader to check sample signatures, because that's what most recipients will use to open the files.
Why does my DSC ask for the PIN on every PDF?
The token driver asks for the PIN each time a program opens a new signing session. Signing tools that use the token's PKCS#11 interface can open one session for the whole batch, so you enter the PIN once. Tools that sign through generic Windows dialogs often prompt per file.
Why does automated signing stop with no error?
Usually the signing program is running as a Windows Service. The token's PIN dialog can't appear in a service session, so the signing request waits forever. Running the signer inside a logged-in user session, such as a tray app started at log-on, fixes this.
Is a bulk-signed PDF as valid as one signed manually?
Yes. The signature is made by the same certificate and token either way. Validity depends on the certificate being valid, issued to the right signatory and not revoked when the document was signed, not on how many files were signed together.
Why does Adobe show "signature validity is unknown" for my DSC?
Acrobat couldn't trace your certificate to a root on its trusted lists. Indian DSCs chain to the CCA's root certificate. Adding that root from the CCA's website to Acrobat's trusted certificates, marked as a trusted root, usually turns the status green.
Sources
- Controller of Certifying Authorities, Classes of certificates
- Controller of Certifying Authorities, Guidelines on cryptographic algorithms and key storage (CCA-CRYPTO)
- Controller of Certifying Authorities, Information Technology Act, 2000 (PDF)
- Adobe, Validate digital signatures in Adobe Acrobat
- Adobe, Set certificate trust level in Acrobat
- Adobe, Adobe Approved Trust List and trust services