Package com.itextpdf.signatures
Class CrlClientOnline
- java.lang.Object
-
- com.itextpdf.signatures.CrlClientOnline
-
- All Implemented Interfaces:
ICrlClient
public class CrlClientOnline extends java.lang.Object implements ICrlClient
An implementation of the CrlClient that fetches the CRL bytes from an URL.
-
-
Field Summary
Fields Modifier and Type Field Description private static IBouncyCastleFactory
BOUNCY_CASTLE_FACTORY
private static org.slf4j.Logger
LOGGER
The Logger instance.protected java.util.List<java.net.URL>
urls
The URLs of the CRLs.
-
Constructor Summary
Constructors Constructor Description CrlClientOnline()
Creates a CrlClientOnline instance that will try to find a single CRL by walking through the certificate chain.CrlClientOnline(java.lang.String... crls)
Creates a CrlClientOnline instance using one or more URLs.CrlClientOnline(java.net.URL... crls)
Creates a CrlClientOnline instance using one or more URLs.CrlClientOnline(java.security.cert.Certificate[] chain)
Creates a CrlClientOnline instance using a certificate chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addUrl(java.lang.String url)
Adds an URL to the list of CRL URLsprotected void
addUrl(java.net.URL url)
Adds an URL to the list of CRL URLsprotected java.io.InputStream
getCrlResponse(java.security.cert.X509Certificate cert, java.net.URL urlt)
Get CRL response represented asInputStream
.java.util.Collection<byte[]>
getEncoded(java.security.cert.X509Certificate checkCert, java.lang.String url)
Fetches the CRL bytes from an URL.int
getUrlsSize()
Get an amount of URLs provided for this CRL.
-
-
-
Field Detail
-
BOUNCY_CASTLE_FACTORY
private static final IBouncyCastleFactory BOUNCY_CASTLE_FACTORY
-
LOGGER
private static final org.slf4j.Logger LOGGER
The Logger instance.
-
urls
protected java.util.List<java.net.URL> urls
The URLs of the CRLs.
-
-
Constructor Detail
-
CrlClientOnline
public CrlClientOnline()
Creates a CrlClientOnline instance that will try to find a single CRL by walking through the certificate chain.
-
CrlClientOnline
public CrlClientOnline(java.lang.String... crls)
Creates a CrlClientOnline instance using one or more URLs.- Parameters:
crls
- the CRLs as Strings
-
CrlClientOnline
public CrlClientOnline(java.net.URL... crls)
Creates a CrlClientOnline instance using one or more URLs.- Parameters:
crls
- the CRLs as URLs
-
CrlClientOnline
public CrlClientOnline(java.security.cert.Certificate[] chain)
Creates a CrlClientOnline instance using a certificate chain.- Parameters:
chain
- a certificate chain
-
-
Method Detail
-
getEncoded
public java.util.Collection<byte[]> getEncoded(java.security.cert.X509Certificate checkCert, java.lang.String url) throws java.security.cert.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 interfaceICrlClient
- 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:
java.security.cert.CertificateEncodingException
- if an encoding error occurs inX509Certificate
.- See Also:
ICrlClient.getEncoded(java.security.cert.X509Certificate, java.lang.String)
-
getCrlResponse
protected java.io.InputStream getCrlResponse(java.security.cert.X509Certificate cert, java.net.URL urlt) throws java.io.IOException
Get CRL response represented asInputStream
.- Parameters:
cert
-X509Certificate
certificate to get CRL response forurlt
-URL
link, which is expected to be used to get CRL response from- Returns:
- CRL response bytes, represented as
InputStream
- Throws:
java.io.IOException
- if an I/O error occurs
-
addUrl
protected void addUrl(java.lang.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(java.net.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
-
-