Digital signatures can look complicated from the outside: certificates, hashes, PKI, timestamps, trust chains and several different PDF standards.
But the core idea is surprisingly simple.
For a PL/SQL developer, it helps to think about digital signing as a sequence of deterministic cryptographic operations performed on a document.
What is a digital signature?
A digital signature proves two important things:
- Integrity — the document has not been modified after signing.
- Authenticity — the signature was created using the private key associated with the signer.
Unlike a scanned handwritten signature or an image placed on a PDF page, a digital signature is cryptographically connected to the document content.
Change even a single byte covered by the signature and the cryptographic verification will no longer match.
Step 1: Calculate the document hash
The first operation is hashing.
A cryptographic hash function such as SHA-256 processes the document and produces a fixed-size value called a digest.
Conceptually:
PDF document → SHA-256 → document hash
The hash acts like a cryptographic fingerprint.
It is practically impossible to reconstruct the original document from the hash, and two different documents should not produce the same digest.
Most importantly, changing the document changes its hash.
Step 2: Sign the hash
The signer owns a cryptographic key pair:
- a private key, which must remain secret;
- a public key, which can be distributed.
The signing operation uses the private key to create a signature over the document digest and associated signature data.
With RSA, for example, the result is an RSA/SHA-256 digital signature.
The private key itself is never stored inside the PDF.
Step 3: Add the certificate
How does somebody verifying the PDF know whose public key to use?
This is where an X.509 certificate comes in.
The certificate contains the signer’s public key together with identity and issuer information. It is normally issued by a Certificate Authority and participates in a PKI — Public Key Infrastructure.
The PDF signature contains the information required to identify the signing certificate.
A validator can then verify both the cryptographic signature and the certificate chain.
Step 4: Build the PDF signature
PDF signing has one interesting complication: the signature must be stored inside the PDF that is being signed.
A PDF signature therefore reserves a location for the signature and defines a ByteRange.
The ByteRange specifies which parts of the PDF are included in the digest while excluding the signature container itself.
In simplified form:
PDF bytes → SHA-256 → signature → inserted into reserved PDF signature field
The PDF can also contain a visible signature appearance, but this is only presentation. The real security comes from the cryptographic signature.
PAdES
For PDF documents, one of the most important standards is PAdES — PDF Advanced Electronic Signatures.
PAdES defines how digital signatures are represented and extended inside PDF documents.
A basic PAdES B-B signature combines the PDF signature structure with a CMS-based cryptographic signature and the signer’s certificate information.
More advanced PAdES levels can add trusted timestamps and long-term validation information.
For example:
PAdES B-B → basic digital signature
PAdES B-T → signature + trusted timestamp
Long-term profiles can additionally preserve information required to validate the signature years later.
Verification is the reverse process
When a PDF viewer validates the document, it essentially performs the opposite operations.
It calculates the hash of the signed PDF ByteRange, verifies the cryptographic signature using the public key from the certificate, checks the certificate chain and may also check revocation status and timestamps.
If the calculated digest matches the signed digest, the document content has not changed.
That is the foundation of PDF digital signatures.
The surrounding standards may be complex, but the cryptographic core remains straightforward:
hash the document, sign the hash with a private key, attach the certificate, and provide enough information for another system to verify everything independently.
For PL/SQL developers working with documents directly inside Oracle, understanding this flow is the first step toward implementing database-native PDF signing without treating the digital signature as a black box.
