Class LtvVerification

java.lang.Object
com.itextpdf.signatures.LtvVerification

public class LtvVerification extends Object
Add verification according to PAdES-LTV (part 4).
Author:
Paulo Soares
  • Constructor Details

    • LtvVerification

      public LtvVerification (PdfDocument document)
      The verification constructor. This class should only be created with PdfStamper.getLtvVerification() otherwise the information will not be added to the Pdf.
      Parameters:
      document - The PdfDocument to apply the validation to.
    • LtvVerification

      public LtvVerification (PdfDocument document, String securityProviderCode)
      The verification constructor. This class should only be created with PdfStamper.getLtvVerification() otherwise the information will not be added to the Pdf.
      Parameters:
      document - The PdfDocument to apply the validation to.
      securityProviderCode - Security provider to use
  • Method Details

    • addVerification

      public boolean addVerification (String signatureName, IOcspClient ocsp, ICrlClient crl, LtvVerification.CertificateOption certOption, LtvVerification.Level level, LtvVerification.CertificateInclusion certInclude) throws IOException, GeneralSecurityException
      Add verification for a particular signature.
      Parameters:
      signatureName - the signature to validate (it may be a timestamp)
      ocsp - the interface to get the OCSP
      crl - the interface to get the CRL
      certOption - options as to how many certificates to include
      level - the validation options to include
      certInclude - certificate inclusion options
      Returns:
      true if a validation was generated, false otherwise
      Throws:
      GeneralSecurityException - when requested cryptographic algorithm or security provider is not available
      IOException - signals that an I/O exception has occurred
    • addVerification

      public boolean addVerification (String signatureName, Collection ocsps, Collection crls, Collection certs) throws IOException, GeneralSecurityException
      Adds verification to the signature.
      Parameters:
      signatureName - name of the signature
      ocsps - collection of DER-encoded BasicOCSPResponses
      crls - collection of DER-encoded CRLs
      certs - collection of DER-encoded certificates
      Returns:
      boolean
      Throws:
      IOException - signals that an I/O exception has occurred
      GeneralSecurityException - when requested cryptographic algorithm or security provider is not available
    • merge

      public void merge()
      Merges the validation with any validation already in the document or creates a new one.
    • convertToHex

      public static String convertToHex (byte[] bytes)
      Converts an array of bytes to a String of hexadecimal values
      Parameters:
      bytes - a byte array
      Returns:
      the same bytes expressed as hexadecimal values