Package com.itextpdf.signatures
Class IssuingCertificateRetriever
java.lang.Object
com.itextpdf.signatures.IssuingCertificateRetriever
- All Implemented Interfaces:
-
IIssuingCertificateRetriever
IIssuingCertificateRetriever default implementation.
-
Constructor Summary
ConstructorsConstructorDescriptionCreatesIssuingCertificateRetrieverinstance.IssuingCertificateRetriever(IResourceRetriever resourceRetriever) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKnownCertificates(Collection<Certificate> certificates) Adds certificates collection to known certificates storage, which is used for issuer certificates retrieval.voidaddKnownCertificates(Collection<Certificate> certificates, CertificateOrigin dataOrigin) Adds certificates collection to known certificates storage, which is used for issuer certificates retrieval.voidaddTrustedCertificates(Collection<Certificate> certificates) Add trusted certificates collection to trusted certificates storage.buildCertificateChains(X509Certificate certificate) This method tries to rebuild certificate issuer chain.buildCertificateChains(X509Certificate[] certificate) This method tries to rebuild certificate issuer chain.getCertificateOrigin(Certificate certificate) Gets certificate origin for providedCertificate.Retrieves the certificate chain for the certificate that should be used to verify the signature on the CRL response using CRL Authority Information Access (AIA) Extension and known certificates.Certificate[][]Retrieves the certificate chaind for the certificates that could be used to verify the signature on the CRL response using CRL Authority Information Access (AIA) Extension and known certificates.protected InputStreamgetIssuerCertByURI(String uri) Get CA issuers certificates represented asInputStream.Gets the resource retriever currently being used in this CA issuer certificates retriever.GetsTrustedCertificatesStoreto be used to provide more complex trusted certificates configuration.booleanisCertificateTrusted(Certificate certificate) Check if provided certificate is present in trusted certificates storage.protected Collection<Certificate>parseCertificates(InputStream certsData) Parses certificates represented as byte array.retrieveIssuerCertificate(Certificate certificate) Retrieve issuer certificate for the provided certificate.retrieveMissingCertificates(Certificate[] chain) Retrieves all possible chains using certificate Authority Information Access (AIA) Extension, known certificates and trust anchors.Retrieves OCSP responder certificate candidates either from the response certs or trusted store in case responder certificate isn't found in /Certs.voidsetTrustedCertificates(Collection<Certificate> certificates) Sets trusted certificate list to be used as certificates trusted for any possible usage.withResourceRetriever(IAdvancedResourceRetriever resourceRetriever) Sets a resource retriever for this CA issuer certificates retriever.
-
Constructor Details
-
IssuingCertificateRetriever
public IssuingCertificateRetriever()CreatesIssuingCertificateRetrieverinstance. -
IssuingCertificateRetriever
Deprecated.CreatesIssuingCertificateRetrieverinstance.- Parameters:
-
resourceRetriever- an @{link com.itextpdf.styledxmlparser.resolver.resource.IResourceRetriever} instance to use for performing http requests.
-
-
Method Details
-
retrieveMissingCertificates
Retrieves all possible chains using certificate Authority Information Access (AIA) Extension, known certificates and trust anchors.- Specified by:
-
retrieveMissingCertificatesin interfaceIIssuingCertificateRetriever - Parameters:
-
chain- certificate chain to restore with at least signing certificate. - Returns:
- all possible chains of trust or maximum chains that could be restored in case missing certificates cannot be retrieved from AIA extension, known certificates and trust anchors.
-
buildCertificateChains
This method tries to rebuild certificate issuer chain. The result contains all possible chains starting with the given certificate based on issuer names and public keys.- Parameters:
-
certificate-X509Certificatefor which issuer chains shall be built - Returns:
- all possible issuer chains
-
buildCertificateChains
This method tries to rebuild certificate issuer chain. The result contains all possible chains starting with the given certificate array based on issuer names and public keys.- Parameters:
-
certificate-X509Certificatearray for which issuer chains shall be built - Returns:
- all possible issuer chains
-
withResourceRetriever
public IssuingCertificateRetriever withResourceRetriever(IAdvancedResourceRetriever resourceRetriever) Sets a resource retriever for this CA issuer certificates retriever.This method allows you to provide a custom implementation of
IAdvancedResourceRetrieverto be used for fetching CA issuer certificates. By default,DefaultResourceRetrieveris used.- Parameters:
-
resourceRetriever- the custom resource retriever to be used for fetching CA issuer certificates - Returns:
-
the current instance of
IssuingCertificateRetriever
-
getResourceRetriever
Gets the resource retriever currently being used in this CA issuer certificates retriever.- Returns:
- resource retriever
-
retrieveIssuerCertificate
Retrieve issuer certificate for the provided certificate.- Parameters:
-
certificate-Certificatefor which issuer certificate shall be retrieved - Returns:
-
issuer certificate.
nullif there is no issuer certificate, or it cannot be retrieved.
-
retrieveOCSPResponderByNameCertificate
Retrieves OCSP responder certificate candidates either from the response certs or trusted store in case responder certificate isn't found in /Certs.- Parameters:
-
ocspResp- basic OCSP response to get responder certificate for - Returns:
- retrieved OCSP responder candidates or an empty set in case none were found.
-
getCrlIssuerCertificates
Retrieves the certificate chain for the certificate that should be used to verify the signature on the CRL response using CRL Authority Information Access (AIA) Extension and known certificates.- Specified by:
-
getCrlIssuerCertificatesin interfaceIIssuingCertificateRetriever - Parameters:
-
crl- CRL response to retrieve issuer for. - Returns:
- certificates retrieved from CRL AIA extension or an empty list in case certificates cannot be retrieved.
-
getCrlIssuerCertificatesByName
Retrieves the certificate chaind for the certificates that could be used to verify the signature on the CRL response using CRL Authority Information Access (AIA) Extension and known certificates.- Specified by:
-
getCrlIssuerCertificatesByNamein interfaceIIssuingCertificateRetriever - Parameters:
-
crl- CRL response to retrieve issuer for. - Returns:
- certificates retrieved from CRL AIA extension or an empty list in case certificates cannot be retrieved.
-
setTrustedCertificates
Sets trusted certificate list to be used as certificates trusted for any possible usage. In case more specific trusted is desired to be configuredgetTrustedCertificatesStore()method is expected to be used.- Specified by:
-
setTrustedCertificatesin interfaceIIssuingCertificateRetriever - Parameters:
-
certificates- certificate list to be used as certificates trusted for any possible usage.
-
addTrustedCertificates
Add trusted certificates collection to trusted certificates storage.- Parameters:
-
certificates- certificatesCollectionto be added
-
addKnownCertificates
Adds certificates collection to known certificates storage, which is used for issuer certificates retrieval.- Parameters:
-
certificates- certificatesCollectionto be added
-
addKnownCertificates
public void addKnownCertificates(Collection<Certificate> certificates, CertificateOrigin dataOrigin) Adds certificates collection to known certificates storage, which is used for issuer certificates retrieval.Additionally, adds stores the provided origin for all these certificates.
- Parameters:
-
certificates- certificatesCollectionto be added -
dataOrigin-RevocationDataOriginfrom which these certificates come from
-
getCertificateOrigin
Gets certificate origin for providedCertificate.- Parameters:
-
certificate-Certificatefor which origin is requested - Returns:
-
RevocationDataOriginfor the certificate
-
getTrustedCertificatesStore
GetsTrustedCertificatesStoreto be used to provide more complex trusted certificates configuration.- Returns:
-
TrustedCertificatesStorestorage
-
isCertificateTrusted
Check if provided certificate is present in trusted certificates storage.- Parameters:
-
certificate-Certificateto be checked - Returns:
-
trueif certificate is present in trusted certificates storage,falseotherwise
-
getIssuerCertByURI
Get CA issuers certificates represented asInputStream.- Parameters:
-
uri-URLURI, which is expected to be used to get issuer certificates from. Usually CA Issuers value from Authority Information Access (AIA) certificate extension. - Returns:
-
CA issuer certificate (or chain) bytes, represented as
InputStream. - Throws:
-
IOException- if an I/O error occurs.
-
parseCertificates
protected Collection<Certificate> parseCertificates(InputStream certsData) throws CertificateException Parses certificates represented as byte array.- Parameters:
-
certsData- stream which contains one or more X509 certificates. - Returns:
- a (possibly empty) collection of the certificates read from the given byte array.
- Throws:
-
CertificateException- if parsing error occurs.
-
withResourceRetriever(com.itextpdf.io.resolver.resource.IAdvancedResourceRetriever)