Back to Devexpress

PdfLtvResult Class

officefileapi-devexpress-dot-pdf-66b37161.md

latest4.4 KB
Original Source

PdfLtvResult Class

Contains information about LTV certificate verification.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
public class PdfLtvResult
vb
Public Class PdfLtvResult

Remarks

The following example executes an LTV check for a signature from the “Signed_file.pdf” file:

csharp
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();
                    }
                }
            }
        }
    }
}
vb
Imports DevExpress.Pdf

Namespace ConsoleApp
    Friend Class Program
        Shared Sub Main(ByVal args() As String) 
            VerifyLTV()
        End Sub
        Public Shared Sub VerifyLTV()
            Using documentSigner As New PdfDocumentSigner("Signed_file.pdf")
                Dim options As New PdfLtvOptions() With {
                    .TryFetchCrlOnline = True,
                    .TryFetchOcspOnline = True,
                    .VerifyEntireCertificateChain = True
                }
                Dim result = documentSigner.VerifyLtv(options)
                For Each entry In result
                    Console.WriteLine("Signature Name: {0}", entry.SignatureFieldName)
                    Console.WriteLine("Certificate in chain: {0}", entry.CertificateRevocationResults.Count)
                    For Each revocation In entry.CertificateRevocationResults
                        Console.WriteLine("Certificate {0}", revocation.Key.Subject)
                        Console.WriteLine("Is certificate revoked?: {0}", revocation.Value.IsCrlRevoked)
                        If revocation.Value.IsCrlRevoked Then
                            Console.WriteLine("Is CRL found online?: {0}", revocation.Value.IsCrlFoundOnline)
                        End If
                        Console.WriteLine("OCSP Response Status: {0}", revocation.Value.OcspRevocationStatus)
                        If revocation.Value.OcspRevocationStatus <> PdfOcspRevocationStatus.None Then
                            Console.WriteLine("Is OCSP found online?: {0}", revocation.Value.IsOcspFoundOnline)
                        End If
                        Console.WriteLine()
                    Next revocation
                Next entry
            End Using
        End Sub
    End Class
End Namespace

Inheritance

Object PdfLtvResult

See Also

PdfLtvResult Members

DevExpress.Pdf Namespace