tda-dsc-signer
A GTK4 app and CLI that signs PDFs, MCA style forms included, with an Indian DSC token on Linux. How it works and exactly what is verified.
On this page
A government style form, an Indian USB token and a Linux desktop: three things nobody had introduced to each other. tda-dsc-signer is the introduction. It signs PDFs with a DSC token on Linux from a native GTK4 window or the command line, and it talks to the token over PKCS#11, with no Java and no browser plugin in the middle.

The first commit is dated 3 October 2026, and version 0.1.0 was released the next day. The code is public, GPL-3.0-or-later, and packaged on the AUR.
Two ways to sign with a DSC token on Linux
A Digital Signature Certificate lives on a small USB token. The private key stays inside it. To sign, a program loads the vendor’s PKCS#11 library, asks which certificates are present, logs in with your PIN and hands the token something to sign. So the job is mostly diplomacy between a PDF library, a smart card stack and a driver you did not write.
| General mode | MCA mode | |
|---|---|---|
| For | any PDF | forms with empty signature fields |
| You choose | page, box, signer | which matched fields to sign |
| Visible | yes, or invisible | inside the field |
In general mode you draw a box, pick the signer, enter the PIN and save. Several boxes with different signers can go in one run.

The same work from a terminal:
tda-dsc-signer # the window
tda-dsc-signer list # certificates on attached tokens, no PIN needed
tda-dsc-signer fields FORM.pdf # which field wants which token
tda-dsc-signer sign FORM.pdf --all-fieldsThe input file is never overwritten, and an existing output is refused unless you force it.
The field name knows who should sign
MCA style forms name their signature fields sigfield<N>_<PAN>. An Indian DSC carries the SHA-256 of the holder’s PAN as the certificate’s subject serial number. Put those two facts next to each other and the matching writes itself:
def pan_hash(pan):
return hashlib.sha256(pan.upper().encode()).hexdigest()flowchart TD
A["Field name ends in a PAN"] --> B["SHA-256 of that PAN"]
C["Each certificate on the attached tokens"] --> D["Its subject serial number"]
B --> E{"Same value?"}
D --> E
E -->|"one is equal"| F["Field is ticked: you may sign it"]
E -->|"all differ"| G["Field stays empty: someone else must sign"]The saved file goes to the next director, who repeats the exercise, so the signatures chain one run after another. Signing a PAN named field with a certificate that does not match is refused before any login to the token, unless you override it explicitly.
Note
What is matched is exactly this: the certificate against the PAN in the field name.
The vendor driver gets its own process
The vendor library is native code of unknown temperament, so it is loaded only inside a separate Python process, one per driver. It never enters the process that draws your window.
flowchart TD
subgraph app["The app process"]
UI["GTK4 window or CLI"]
end
subgraph helper["Helper process, one per driver"]
S["Checks, login, PDF signing"]
L["Vendor PKCS#11 library"]
S --> L
end
UI <-->|"JSON lines over stdin and stdout"| helper
L <--> T["USB token: the key stays inside"]That one pipe carries four verbs: ping, enumerate, present, sign. Requests are never logged, because one of them carries the PIN. Drivers that like to print to standard output are redirected away from the protocol.
Each request has a timeout. A hung helper is killed and started again on the next call, and a sign request is never sent twice. The helper also takes an exclusive lock per driver before loading it, because two programs cannot share one: the second silently sees no token. A second copy of the signer gets a clear “driver busy” error naming the holder.
Everything odd about flaky drivers lives in one file. The one I verified against sleeps about seven seconds on its first call and sometimes returns an empty answer to a lookup that should succeed. So lookups retry. Login never does.
One signing action, one login
Everything that can fail without logging in (parsing, page numbers, output path, field checks) runs first. Why spend a PIN attempt on a typo in a file name?
sequenceDiagram
participant A as App
participant H as Helper
participant T as Token
A->>H: sign request with file, certificate and PIN
H->>H: check the PDF, output path and fields
alt a check fails
H-->>A: typed error, no login made
else all checks pass
H->>T: log in, exactly once
H->>T: find the key and sign, lookups may retry
H-->>A: finished file, moved into place
A->>A: verify the saved signature
endA token counts wrong PINs, and the counter is not forgiving. The signer behaves accordingly:
| Situation | What the signer does |
|---|---|
| An ordinary signing action | one login, never retried |
| The token reports it is locked | refuses before any attempt |
| The token reports a final try | asks for explicit confirmation |
| A quick retry after a wrong PIN | asks first, even from another process |
The record behind the retry rule is a small file per token holding a time and a count, never the PIN. The tool keeps its own memory of wrong PINs, so that caution does not depend on the token warning you.
Saving a PIN is off by default. If you turn it on, per token, it stays in memory for the session or goes to the system keyring. There is no plaintext fallback.

Separate answers, not one green tick
After signing, the app reports separate rows for whether the document is unmodified, whether the signature is valid and whether the issuer is trusted. One green tick for the lot would be friendlier and far less informative.
The only trust anchor is the CCA India 2022 root, pinned by SHA-256 and checked on every load, written to a private trust database that no browser shares.
Verified and not verified
Read this before trusting any of the above. Verified: signing and verifying with an InnaIT token on real hardware, PKCS#11 signing against SoftHSM and a fake token GUI harness, and the trust bundle hashes. Not verified: whether the MCA portal accepts the output and which format it expects, and any token other than InnaIT.
Important
The tool bundles no vendor driver. Other tokens are probed through whichever driver you install, and they may or may not work. It is independent software, not affiliated with the Ministry of Corporate Affairs, the CCA or any certifying authority, and you are responsible for checking that a signed file meets the recipient’s requirements.
The tests do not need a real token: SoftHSM provides a throwaway one, and the GUI runs against fake tokens on a private virtual display, so no real PIN is anywhere near them.
Install and where it stands
Clone the repository and run make install with Python 3.12 or newer, GTK4, poppler-glib, PyGObject, pcsclite, ccid, git, make, uv and your token vendor’s driver present.
Tip
Token not detected? tda-dsc-signer doctor checks the smart card service, USB, the driver and driver locks (the hardware rows are written for the InnaIT token), then prints the fix without ever running it for you.
The step by step version is in using a DSC USB token on Linux. The latest release at the time of writing, 0.1.1 from 29 October 2026, updates locked dependencies.
For a much smaller first package from the same author, there is a program that prints a name. It had a gentler relationship with hardware.