dsh-pdf-sign: PDF Signature Images, Stamping, and PKCS#7 Digital Signatures under DSH

Preface

When using agents in DeepSeek Harness (DSH) to process PDF contracts or approval forms, common requirements fall into two categories: the page needs a signature appearance that “looks like handwriting,” and the file itself needs a verifiable digital signature. The former can be achieved by overlaying an image on the page; the latter requires PKCS#7/CMS and a certificate private key, which is not the same as “just stamping an image.” Confusing the two leads to documents that look signed but fail cryptographic verification in readers.

Below is an introduction to the community plugin dsh-pdf-sign (GitHub repository JuntaoXiao/PDF-electronic-signature, maintained by JuntaoXiao). In DSH, it separates “generating signature images,” “PDF stamping (visual only),” and “digital signing with self-provided certificates” into independent tools, facilitating combination based on scenarios.

What is this

dsh-pdf-sign is a PDF electronic signature plugin for DeepSeek Harness (npm package name dsh-pdf-sign, current version 0.2.0, MIT License). After installation and restarting DSH, agents can call a set of tools prefixed with pdf_sign_: generating handwritten-style signature images, placing signature images or text blocks on PDFs, performing whole-file PKCS#7 detached signing with .p12, generating self-signed test certificates, and inspecting signature structures within PDFs.

The community directory SkillHub categorizes it as “Fun Dress-up”; functionally, it is closer to document signing and visual stamping rather than a UI dress-up plugin. The DSH ecosystem adopts an “everything is a plugin” approach; SkillHub is an independent community site with no official affiliation with DeepSeek or High-Flyer.

Core Features

The README deliberately separates capabilities to avoid conflating “looking signed” with “cryptographically verifiable”:

Tool Output Guarantee
pdf_signature_image Handwritten-style PNG/SVG generated from text like name None, image only
pdf_sign_stamp Ink on PDF page (signature image and/or typeset text) Visual Only
pdf_sign_digital PKCS#7/CMS detached signature for the whole file Cryptographic (/ByteRange + CMS)
pdf_sign_cert_generate Self-signed certificate + .p12 (for testing) Self-signed, not a trusted CA
pdf_sign_inspect Report of signature fields and structures in PDF Structural check only, does not verify chain

Key point: Stamping does not alter the PDF’s byte range signature; Digital Signing proves the file has not been tampered with after signing and links to a key holder, but only certificates issued by real CAs will display as trusted in readers. The plugin does not embed keys, CAs, or trust anchors.

pdf_signature_image uses a text seed to generate a stable handwritten effect (the same name generates the same pattern repeatedly), facilitating re-signing scenarios; platforms will try to use handwriting-friendly fonts such as KaiTi, STXingkai, Noto Serif CJK, etc.

pdf_sign_stamp supports anchors (e.g., bottom-right), transparency, rotation, and embedding system TrueType subsets for non-Latin scripts. If the signature image has an opaque background (common white background export), overlaying it will cover underlying content; you can use drop_background (white, auto, or #rrggbb) to remove the background and trim_image to crop to the ink, avoiding oversized placeholder boxes.

package.json indicates the runtime environment: Node.js >=20.0.0; DSH compatibility >=0.1.1-rc.1 <0.2.0, supporting web, tui, and desktop profiles.

Installation and Activation

The installation command comes from the repository README, using the web profile:

dsh plugin --profile web add dsh-pdf-sign

After execution, restart DSH, and the pdf_sign_* tools will be available for the agent to call. If you use other profiles, they must match your local DSH configuration; the above command follows the original documentation.

Before installation, it is recommended to review the GitHub Source Code and the MIT License yourself. The plugin runs under the current DSH process permissions, reading and writing the PDFs and certificate paths you pass in, and may call system OpenSSL (for self-signed certificate generation, etc.).

Typical Usage

The quick flow provided in the README is divided into three steps: first create the signature image, then stamp it, and finally (optionally) digitally sign.

1. Generate Signature Image

pdf_signature_image(text="Juntao Xiao", output_path="/abs/path/sig.png")

2. Stamp on the last page (Visual)

pdf_sign_stamp(pdf_path="/abs/path/contract.pdf",
               image_path="/abs/path/sig.png",
               text="Juntao Xiao", date_text="2026-09-20",
               anchor="bottom-right", width=200)

If output_path is not specified, it defaults to generating <name>-signed.pdf next to the source PDF.

3. Generate Test Certificate and Perform PKCS#7 Digital Signing

pdf_sign_cert_generate(common_name="Juntao Xiao", passphrase="secret",
                       output_dir="/abs/path/certs")
pdf_sign_digital(pdf_path="/abs/path/contract.pdf",
                 output_path="/abs/path/contract-signed.pdf",
                 p12_path="/abs/path/certs/signing-cert.p12",
                 passphrase="secret", reason="Approval")

Signatures generated with self-signed certificates usually display as “Untrusted but integrity verifiable”; production environments should use .p12/.pfx issued by their own CAs or institutions.

When stamping a signature image with a white background, you can explicitly remove the background, for example:

pdf_sign_stamp(pdf_path="contract.pdf", image_path="signature.png",
               drop_background="white")

To understand what signature fields already exist in a PDF, you can call pdf_sign_inspect; it only provides a structural report and does not replace full certificate chain verification.

Scenarios and Notes

Who it is for: Developers who need to automate “signature image generation + contract page stamping” within DSH workflows; scenarios where PKCS#7 signing steps need to be chained on the agent side and debugged using a self-signed environment.

Must distinguish: Visual stamping for display vs. digital signing for compliance/anti-tampering; the two can be used sequentially, but visual stamping cannot replace digital signing.

Transparency and Overlays: When a seal is placed over a signature image, an opaque background will erase the underlying ink; use drop_background and follow the instructions in the README to avoid silently covering with white.

Security: The plugin does not custody production private keys for you; passphrase and certificate paths are passed in by the caller. Self-signing is only suitable for testing.

Dependencies and Stack: The implementation is based on pdf-lib, @signpdf/*, etc. (see repository package.json); pdf_sign_cert_generate requires OpenSSL, which can be automatically found via Git on Windows.

Conclusion

dsh-pdf-sign clearly separates the boundaries of signature image generation, visual stamping, and PKCS#7 digital signing, facilitating step-by-step combination in DSH. Community Directory: https://www.skillhub.cn/plugins/JuntaoXiao/PDF-electronic-signature; Source Code and Full Parameter Table: https://github.com/JuntaoXiao/PDF-electronic-signature.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye