PdfDocumentSigner.VerifyLtv(PdfLtvOptions) Method
Returns Long Term Validation (LTV) records about the state of the signature certificate.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
Declaration
Parameters
Name | Type | Description |
---|---|---|
options | PdfLtvOptions | A PdfLtvOptions object that specifies an LTV information request. |
Returns
Type | Description |
---|---|
IEnumerable<PdfLtvResult> | A collection of |
Remarks
LTV (Long Term Validation) supplies a record of certificate state at the time it was signed. To verify a certificate, the signature must include a digital timestamp. Use the PdfPkcs7Signature.IsDocumentTimeStamp to check whether this is true. Note that certificate verification requires the OCSP or CRL responder to have its certificates online. Set PdfLtvOptions.TryFetchCrlOnline and PdfLtvOptions.TryFetchOcspOnline to true
to obtain the certificate status in an OCSP/CRL response when you call the VerifyLtv
method.
The following example executes an LTV check for a signature from the “Signed_file.pdf” file:
using DevExpress.Office.DigitalSignatures;
namespace ConsoleApp {
internal class Program {
static void Main(string[] args) {
VerifyLTV();
}
public static void VerifyLTV(){
using (PdfDocumentSigner documentSigner = new PdfDocumentSigner("Signed_file.pdf")){
PdfLtvOptions options = new PdfLtvOptions(){
TryFetchCrlOnline = true,
TryFetchOcspOnline = true,
VerifyEntireCertificateChain = true,
};
var result = documentSigner.VerifyLtv(options);
foreach (var entry in result){
Console.WriteLine("Signature Name: {0}", entry.SignatureFieldName);
Console.WriteLine("Certificate in chain: {0}", entry.CertificateRevocationResults.Count);
foreach(var revocation in entry.CertificateRevocationResults){
Console.WriteLine("Certificate {0}", revocation.Key.Subject);
Console.WriteLine("Is certificate revoked?: {0}", revocation.Value.IsCrlRevoked);
if (revocation.Value.IsCrlRevoked)
Console.WriteLine("Is CRL found online?: {0}", revocation.Value.IsCrlFoundOnline);
Console.WriteLine("OCSP Response Status: {0}", revocation.Value.OcspRevocationStatus);
if (revocation.Value.OcspRevocationStatus != PdfOcspRevocationStatus.None)
Console.WriteLine("Is OCSP found online?: {0}", revocation.Value.IsOcspFoundOnline);
Console.WriteLine();
}
}
}
}
}
}