Technisch artikel

PDFlibPas: PAdES signing and validation in Delphi

losLab PDF Library biedt Delphi- en C++Builder-teams een PDF-engine met beschikbare broncode voor desktop-, server-, DLL-, ActiveX- en Dylib-workflows, inclusief ingebouwde PDF/A- en PDF/UA-controles, PAdES-ondertekening en keuze uit renderers zonder documenten via een externe PDF-service te sturen.

Dit artikel is bedoeld voor teams that need to create, inspect, and validate signed PDF workflows inside Delphi applications. Het behandelt PAdES signing and validation als productiegerichte documentengineering, niet als een losse componentaanroep.

Het praktische risico is dat signature creation and signature validation are often implemented separately, causing mismatched trust decisions when timestamps, revocation data, or incremental updates change. Daarom heeft de workflow een geschreven contract, observeerbare diagnose en representatieve regressiebestanden nodig.

Architectuurbeslissingen

Use one trust policy for signing and validation. accepted certificate stores, chain policy, timestamp source, and revocation source / PAdES profile, long-term validation requirements, and archive retention period

  • accepted certificate stores, chain policy, timestamp source, and revocation source
  • PAdES profile, long-term validation requirements, and archive retention period
  • whether warnings create a block, manual review, or documented waiver
  • how later document changes are restricted after the trusted revision

Implementatiepad

Validate the final signed revision, not the draft. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. prepare the document and collect validation prerequisites before signing
  2. apply the signature, timestamp, and revocation evidence according to policy
  3. validate the final signed file and classify every warning
  4. store trust evidence with the business record rather than only inside the PDF
  5. revalidate representative files when trust anchors or policy change

Validatiebewijs

Trust evidence for signed documents. Keep these fields with the output or support record.

  • signature status, byte range, digest algorithm, signer certificate, and chain result
  • timestamp token status, revocation source, DSS/VRI presence, and validation time
  • policy version, warning classification, and waiver decision
  • final signed file hash and validator result

Long-term validation needs supporting data

PAdES workflows need certificate-chain checks, timestamps, revocation data, DSS/VRI information, byte-range validation, and policy decisions for warnings. The final file must be validated after all signing bytes are written.

Customer-visible behavior

Users do not see internal call order. They see whether the file opens, validates, prints, edits, imports, or gets rejected. The workflow should translate PAdES signing and validation results into states users can act on.

  • prepare the document and collect validation prerequisites before signing
  • apply the signature, timestamp, and revocation evidence according to policy
  • validate the final signed file and classify every warning
  • a signature can be cryptographically intact but untrusted by current policy
  • revocation services may be unavailable when the document is signed

Engineering review notes for PAdES signing and validation

Use these review notes to make sure the feature has moved beyond a demo and can be defended during release, support, and customer escalation.

  • Decision: accepted certificate stores, chain policy, timestamp source, and revocation source. Implementation pressure point: apply the signature, timestamp, and revocation evidence according to policy. Acceptance evidence: policy version, warning classification, and waiver decision. Regression trigger: clock differences can make timestamp and certificate validity hard to explain
  • Decision: PAdES profile, long-term validation requirements, and archive retention period. Implementation pressure point: validate the final signed file and classify every warning. Acceptance evidence: final signed file hash and validator result. Regression trigger: a signature can be cryptographically intact but untrusted by current policy
  • Decision: whether warnings create a block, manual review, or documented waiver. Implementation pressure point: store trust evidence with the business record rather than only inside the PDF. Acceptance evidence: signature status, byte range, digest algorithm, signer certificate, and chain result. Regression trigger: revocation services may be unavailable when the document is signed

Randgevallen

  • a signature can be cryptographically intact but untrusted by current policy
  • revocation services may be unavailable when the document is signed
  • incremental updates after signing need a clear allowed-change policy
  • clock differences can make timestamp and certificate validity hard to explain

Delphi / C++Builder notes

PDFlibPas should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include PAdES, signature validation, timestamp, revocation, DSS, byte range.

Delphi-codevoorbeeld

De volgende Delphi-schets toont een praktische servicegrens voor dit onderwerp. Houd beleidscontroles, logging en validatie buiten het smalle productaanroepblok, zodat de workflow testbaar blijft.

procedure ValidatePadesPackage(const InputFile: string; const TrustPolicy: TTrustPolicy);
var
  Pdf: TPDFlib;
  ProcessId: Integer;
begin
  Pdf := TPDFlib.Create;
  try
    ProcessId := Pdf.NewSignProcessFromFile(InputFile, '');
    CheckByteRange(Pdf, ProcessId);
    ValidateCertificatePath(Pdf, ProcessId, TrustPolicy);
    Pdf.ReleaseSignProcess(ProcessId);
  finally
    Pdf.Free;
  end;
end;

Productiechecklist

  • Run the workflow on an empty file, a normal customer file, and a worst-case file
  • Open the generated PDF with the target viewer, validator, printer, or downstream application
  • Log product version, profile version, input hash, output path, elapsed time, and warning count
  • Keep passwords, certificates, temporary files, and customer data under explicit retention rules
  • Add regression documents when a customer file exposes a new edge case

Product documentation

PDFlibPas