PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Add Long Term Validation (LTV) data to an existing signature

Long-term validation refers to the process of verifying the authenticity and integrity of a digitally signed PDF document over an extended period of time. This involves checking the validity of the digital signature, the certificate used to sign the document, and any associated time-stamping or revocation information. Long-term validation is important to ensure that a document remains valid and trustworthy, even if the certificate used to sign it expires or is revoked. This can be accomplished through the use of a trusted third-party validation service or by maintaining a local copy of the certificate’s revocation list.

// Add Long Term Validation (LTV) data to an existing signature
using (FileStream fs = new FileStream("signed_document.pdf", FileMode.Open, FileAccess.Read))
{
   Document document = new Document(fs);
	  
   SignatureField signatureField = document.Fields["name_of_signature_field"] as SignatureField;
	  
   // load the data to fill up the list of certificates, certificate revocation lists, and certificate status protocols
   List<byte[]> certificates = new List<byte[]>(new []
   {
      File.ReadAllBytes("cert_0.dat"),
      File.ReadAllBytes("cert_1.dat"),
      File.ReadAllBytes("cert_2.dat"),
      File.ReadAllBytes("cert_3.dat")
   });

   List<byte[]> oCSPs = new List<byte[]>(
      File.ReadAllBytes("ocsp_1.dat")
   );

   List<byte[]> cRLs = new List<byte[]>(new []
   {
      File.ReadAllBytes("CRL_0.dat"),
      File.ReadAllBytes("CRL_1.dat"),
      File.ReadAllBytes("CRL_2.dat")
   });
	  
   signatureField.AddValidationInformation(certificates, oCSPs, cRLs); // add the LTV data

   using (FileStream outFs = new FileStream("ltv_enabled.pdf", FileMode.Create, FileAccess.Write))
   {
      document.Write(outFs, DocumentWriteMode.AppendUpdate); 
      // Note: it is important to use the AppendUpdate mode, otherwise the signature becomes invalid
   }
}
Download PDFKit.NET 5.0
We will send you a download link
  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.