Add LTV information to PDF signatures in C#
Long-term validation (LTV) data helps signed PDFs remain verifiable after certificate status information changes or certificate authorities rotate infrastructure.
Use this workflow after creating a signature that has a certificate chain with online revocation information. Nutrient .NET SDK collects certificates and revocation data and embeds them in the document security store.
This guide shows how to:
- Sign a PDF with a P12/PFX certificate
- Add LTV information to the signed PDF
- Save the updated document as an incremental update
This sample requires network access to certificate revocation resources, such as Online Certificate Status Protocol (OCSP) responders or certificate revocation lists (CRLs). Self-signed development certificates usually don’t provide usable revocation endpoints.
Prepare the project
Register the SDK license before running signing operations. For setup details, refer to the getting started with .NET SDK guide.
using System;using GdPicture14;
void CheckStatus(GdPictureStatus status, string operation){ if (status != GdPictureStatus.OK) { throw new InvalidOperationException($"{operation} failed. Status: {status}"); }}
LicenseManager license = new LicenseManager();license.RegisterKEY(""); // Set your license keySign the PDF
Load the input PDF, configure the signing certificate, and create a timestamped PAdES signature. LTV works best when the signing certificate chain exposes revocation information.
using GdPicturePDF pdf = new GdPicturePDF();
CheckStatus(pdf.LoadFromFile(@"input.pdf", false), "LoadFromFile");CheckStatus(pdf.SetSignatureCertificateFromP12(@"certificate.pfx", "Nutrient answers all your document needs"), "SetSignatureCertificateFromP12");CheckStatus(pdf.SetSignatureInfo("Nutrient", "LTV signing sample", "Toulouse", "sales@nutrient.io"), "SetSignatureInfo");CheckStatus(pdf.SetSignatureTimestampInfo("http://timestamp.digicert.com", "", ""), "SetSignatureTimestampInfo");CheckStatus(pdf.SetSignaturePAdESLevel(PdfSignaturePAdESLevel.PAdESBaselineT), "SetSignaturePAdESLevel");CheckStatus(pdf.ApplySignature(@"signed.pdf", PdfSignatureMode.PdfSignatureModeAdobeCADES, true), "ApplySignature");SetSignaturePAdESLevel selects the PAdES baseline level for the signature. PAdES B-T adds a signature timestamp and creates a suitable starting point for adding validation material.
Add LTV information
Reload the signed PDF and add validation material for its signatures:
using GdPicturePDF signedPdf = new GdPicturePDF();
CheckStatus(signedPdf.LoadFromFile(@"signed.pdf", false), "LoadFromFile");CheckStatus(signedPdf.SetSignatureLtvInformation(@"ltv-enabled.pdf"), "SetSignatureLtvInformation");SetSignatureLtvInformation embeds certificates and revocation information in the PDF. The output document contains the original signature plus the added validation material.
Error handling
Check every GdPictureStatus value returned by the signing methods. Common failures include an invalid certificate password, a missing certificate chain, unavailable revocation endpoints, and blocked network access.
Conclusion
This workflow signs a PDF and then upgrades the signed output with LTV material for longer-lived validation.