Class CrlClientOnline

java.lang.Object
com.itextpdf.signatures.CrlClientOnline
All Implemented Interfaces:
ICrlClient

public class CrlClientOnline extends Object implements ICrlClient
An implementation of the CrlClient that fetches the CRL bytes from an URL.
  • Field Details

    • urls

      protected List<URL> urls
      The URLs of the CRLs.
  • Constructor Details

    • CrlClientOnline

      public CrlClientOnline()
      Creates a CrlClientOnline instance that will try to find a single CRL by walking through the certificate chain.
    • CrlClientOnline

      public CrlClientOnline (String... crls)
      Creates a CrlClientOnline instance using one or more URLs.
      Parameters:
      crls - the CRLs as Strings
    • CrlClientOnline

      public CrlClientOnline (URL... crls)
      Creates a CrlClientOnline instance using one or more URLs.
      Parameters:
      crls - the CRLs as URLs
    • CrlClientOnline

      public CrlClientOnline (Certificate[] chain)
      Creates a CrlClientOnline instance using a certificate chain.
      Parameters:
      chain - a certificate chain
  • Method Details

    • getEncoded

      public Collection getEncoded (X509Certificate checkCert, String url) throws CertificateEncodingException
      Fetches the CRL bytes from an URL. If no url is passed as parameter, the url will be obtained from the certificate. If you want to load a CRL from a local file, subclass this method and pass an URL with the path to the local file to this method. An other option is to use the CrlClientOffline class.
      Specified by:
      getEncoded in interface ICrlClient
      Parameters:
      checkCert - The certificate which a CRL URL can be obtained from.
      url - A CRL url if you don't want to obtain it from the certificate.
      Returns:
      A collection of byte array each representing a crl. It may return null or an empty collection.
      Throws:
      CertificateEncodingException - if an encoding error occurs in X509Certificate.
      See Also:
    • getCrlResponse

      protected InputStream getCrlResponse (X509Certificate cert, URL urlt) throws IOException
      Get CRL response represented as InputStream.
      Parameters:
      cert - X509Certificate certificate to get CRL response for
      urlt - URL link, which is expected to be used to get CRL response from
      Returns:
      CRL response bytes, represented as InputStream
      Throws:
      IOException - if an I/O error occurs
    • addUrl

      protected void addUrl (String url)
      Adds an URL to the list of CRL URLs
      Parameters:
      url - an URL in the form of a String
    • addUrl

      protected void addUrl (URL url)
      Adds an URL to the list of CRL URLs
      Parameters:
      url - an URL object
    • getUrlsSize

      public int getUrlsSize()
      Get an amount of URLs provided for this CRL.
      Returns:
      int number of URLs