pdfsig(1)
β¨ pdfsig β¨
okay bestie, sit down, hydrate, because today we're talking about pdfsig β the manual page 1 tool from the PDF squad, aka the Portable Document Format digital signatures tool. she verifies, she signs, she slays. π
π«Ά SYNOPSIS π«Ά
pdfsig [options] [PDF-file] [Output-file]
π DESCRIPTION π
So like, what does pdfsig actually do? She verifies the digital signatures in a PDF document. that's the main character job. π
And she doesn't just say "yep, signed" and dip β she shows you everything:
- the identity of each signer (the
commonNamefield and the full distinguished name of the signer certificate) - the time and date of the signature
- the hash algorithm used for signing
- the type of the signature as stated in the PDF
- the signed ranges, plus a statement about whether the total document is signed
And plot twist β she can also sign PDF documents. that's the -add-signature or -sign options. iconic. π
Where do the trusted certs come from, you ask? pdfsig uses the trusted certificates stored either in the Network Security Services (NSS) Database or in GnuPG's S/MIME system (gpgsm).
She also uses the Online Certificate Status Protocol (OCSP) β like, go read http://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol if you wanna know more β to look up the certificate online and check if it has been revoked. Unless you passed -no-ocsp, in which case she's not doing that, obviously.
π¦ Where does she look for the NSS Database?
If the NSS backend is used, the NSS Database is searched for in these locations, in this order:
- If the
-nssdiroption is specified, the directory specified by this option. (you said it, she listens π ) - The NSS Certificate database in the default Firefox profile. i.e.
$HOME/.mozilla/firefox/*.default* - System's NSS Certificate database in
/etc/pki/nssdb - User's NSS Certificate database in
$HOME/.pki/nssdb
πΈ And for the GPG girlies?
If the GPG backend is used, the S/MIME certificate is read from $GNUPGHOME, defaulting to $HOME/.gnupg.
π OPTIONS π
-nssdir [prefix]directoryβ Specify the database directory containing the certificate and key database files. Seecertutil(1)-doption for details of the prefix. If you don't specify it, the other search locations described up in DESCRIPTION get used instead.-nss-pwd passwordβ Specify the password needed to access the NSS database (if any). like, only if there is one, bestie.-nocertβ Do not validate the certificate. skipping the vibe check, fr fr.-no-ocspβ Do not perform online OCSP certificate revocation check (local Certificate Revocation Lists (CRL) are still used). so the online part is off, but the local CRLs are still doing their thing. π«Ά-assert-signer fpr_or_fileβ This option checks whether the signature covering the full document been made with the specified key. The key is either specified as a fingerprint or a file listing fingerprints. The fingerprint must be given or listed in compact format (no colons or spaces in between). Iffpr_or_filespecifies a file, empty lines are ignored as well as all lines starting with a hash sign. Only available for GnuPG backend.-no-appearanceβ Do not add appearance information when signing existing fields (signer name and date). no aesthetic, just vibes. π-aiaβ Enable the use of Authority Information Access (AIA) extension to fetch missing certificates to build the certificate chain.-dumpβ Dump all signatures into current directory in their native format. Most likely it is either a unpadded or zero-padded CMS/PKCS7 bundle.-add-signatureβ Add a new signature to the document. βοΈ-new-signature-field-name nameβ Specifies the field name to be used when adding a new signature. A random ID will be used by default.-sign fieldβ Sign the document in the specified signature field present in the document (must be unsigned). Field can be specified by field name (string) or the n-th signature field in the document (integer).-nick nicknameβ Use the certificate with the given nickname for signing (NSS backend). If nickname starts withpkcs11:, it's treated as PKCS#11 URI (NSS backend). If the nickname is given as a fingerprint, it will be the certificate used (GPG backend).-backend backendβ Use the specified backend for cryptographic signatures.-kpw passwordβ Use the given password for the signing key (this might be missing if the key isn't password protected).-digest algorithmβ Use the given digest algorithm for signing (default:SHA256).-reason reasonβ Set the given reason string for the signature (default: no reason set).-enable-pgpβ Enable pgp signatures in the GnuPG backend. Only available for GnuPG backend.-etsiβ Create a signature of typeETSI.CAdES.detachedinstead ofadbe.pkcs7.detached.-list-nicksβ List available nicknames in the NSS database. π§-list-backendsβ List available backends for cryptographic signatures.-vβ Print copyright and version information.-hβ Print usage information. (-helpand--helpare equivalent.)
π EXAMPLES π
okay now the fun part, let's actually run her:
1. pdfsig signed_file.pdf
Displays signature info for signed_file.pdf.
2.
pdfsig input.pdf output.pdf -add-signature -nss-pwd password -nick my-cert -reason 'for fun!'
Creates a new pdf named output.pdf with the contents of input.pdf signed by the 'my-cert' certificate.
3.
pdfsig input.pdf output.pdf -add-signature -nss-pwd password -nick 'pkcs11:token=smartcard0;object=Second%20certificate;type=cert'
Same, but uses a PKCS#11 URI as defined in IETF RFC 7512 to select the certificate to be used for signing. fancy!! π₯
4.
pdfsig input.pdf output.pdf -sign 0 -nss-pwd password -nick my-cert -reason 'for fun!'
Creates a new pdf named output.pdf with the contents of input.pdf signed by the 'my-cert' certificate. input.pdf must have an already existing un-signed signature field. no field, no signature, so make sure it's there.
π AUTHOR π
The pdfsig software and documentation are copyright 1996-2004 Glyph & Cog, LLC and copyright 2005-2015 The Poppler Developers - http://poppler.freedesktop.org
π SEE ALSO π
pdfdetach(1)pdffonts(1)pdfimages(1)pdfinfo(1)pdftocairo(1)pdftohtml(1)pdftoppm(1)pdftops(1)pdftotext(1)pdfseparate(1)pdfunite(1)certutil(1)
and that's the whole page, bestie!! this lil slice of manual-page perfection is dated 28 October 2015 and lives under the name pdfsig(1). go forth, verify those signatures, and remember: signed ranges don't lie. πβ¨ππ¦
π¦ where this page comes from
- alpine 3.23: poppler-doc 25.12.0-r0 Β· GPL-2.0-or-later
- alpine 3.24: poppler-doc 25.12.0-r1 Β· GPL-2.0-or-later
- fedora 44: poppler-utils 26.01.0-3.fc44 Β· (GPL-2.0-only OR GPL-3.0-only) AND GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
- ubuntu resolute: poppler-utils 26.01.0-2build2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu resolute: poppler-utils 26.01.0-2ubuntu0.2
- ubuntu resolute: poppler-utils 26.01.0-2ubuntu0.3 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: poppler-utils 26.07.0-2ubuntu1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: poppler-utils 26.07.0-2ubuntu1.1 Β· GPL-2.0-only OR GPL-3.0-only
- Copyright 2011 The Poppler Developers - http://poppler.freedesktop.org
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms