Skip to main content

LtvVerificationStatus Class

Contains Long Term Validation (LTV) verification results for a signature.

Declaration

public class LtvVerificationStatus extends JavaObject

Remarks

Call the PdfSignatureValidator.verifyLtv(verifyEntireCertificateChain, tryFetchCrlOnline, tryFetchOcspOnline) method to get LTV verification results for all signatures in a document.

Refer to the following help topic for additional information: Validate PDF Signatures — PDF Document API for Java.

Example

Check Certificate Revocation and Verify LTV Information

The following code snippet checks the revocation status of the Signature1 field signing certificate in Document.pdf and verifies LTV information for all signatures:

import java.io.*;
import java.nio.file.*;
import java.security.cert.X509Certificate;
import java.time.OffsetDateTime;
import java.util.Map;
import com.devexpress.docs.pdf.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (InputStream documentStream = Files.newInputStream(Path.of("Document.pdf"))) {
            PdfSignatureValidator validator = new PdfSignatureValidator(documentStream);
            Pkcs7Signature signature = validator.getPkcs7Signature("Signature1");

            // Check whether the certificate was revoked at the timestamp time (or now if there is no timestamp).
            OffsetDateTime checkDate = signature.getTimeStampDate() != null
                    ? signature.getTimeStampDate() : OffsetDateTime.now();
            SignatureCertificateRevocationStatus revocationStatus =
                    signature.checkCertificateRevocation(checkDate, true, true);
            System.out.println("CRL revoked: " + revocationStatus.getIsCrlRevoked());
            System.out.println("OCSP status: " + revocationStatus.getOcspRevocationStatus());

            // Verify LTV information for all signatures.
            for (LtvVerificationStatus ltvStatus : validator.verifyLtv(true, false, false)) {
                System.out.println("LTV for " + ltvStatus.getSignatureFieldName() + ":");
                for (Map.Entry<X509Certificate, SignatureCertificateRevocationStatus> item :
                        ltvStatus.getCertificateRevocationStatuses().entrySet())
                    System.out.println("  " + item.getKey().getSubjectX500Principal().getName()
                            + ": " + item.getValue().getOcspRevocationStatus());
            }
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
com.devexpress.system.JavaObject
LtvVerificationStatus
See Also

LtvVerificationStatus(PdfLtvResult pdfLtvResult)

Initializes a new instance of the LtvVerificationStatus class with the specified LTV verification result.

Declaration

public LtvVerificationStatus(PdfLtvResult pdfLtvResult)

Parameters

Name Type Description
pdfLtvResult com.devexpress.pdf.PdfLtvResult

An LTV verification result.

Exceptions

Type Description
ArgumentNullException

Thrown if the pdfLtvResult parameter is null.

Remarks

You do not need to call the LtvVerificationStatus(pdfLtvResult) constructor. The PdfSignatureValidator.verifyLtv(verifyEntireCertificateChain, tryFetchCrlOnline, tryFetchOcspOnline) method creates LtvVerificationStatus objects and returns one object for each signature.

Methods

getCertificateRevocationStatuses() Method

Returns the revocation status of signature certificates.

Declaration

public Map<X509Certificate,SignatureCertificateRevocationStatus> getCertificateRevocationStatuses()

Returns

Type Description
java.util.Map<java.security.cert.X509Certificate,SignatureCertificateRevocationStatus>

A map that maps each verified certificate to its revocation status.

Remarks

If you pass false as the verifyEntireCertificateChain parameter of the PdfSignatureValidator.verifyLtv(verifyEntireCertificateChain, tryFetchCrlOnline, tryFetchOcspOnline) method, the map contains the signing certificate only.

getSignatureFieldName() Method

Returns the full name of the signature field.

Declaration

public String getSignatureFieldName()

Returns

Type Description
String

The signature field name.