Package eu.europa.esig.dss.spi.x509
Class CommonCertificateSource
java.lang.Object
eu.europa.esig.dss.spi.x509.CommonCertificateSource
- All Implemented Interfaces:
CertificateSource
,Serializable
- Direct Known Subclasses:
CommonTrustedCertificateSource
,KeyStoreCertificateSource
,SignatureCertificateSource
public class CommonCertificateSource extends Object implements CertificateSource
This source of certificates handles any non trusted certificates. (ex: intermediate certificates used in building
certification chain)
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CommonCertificateSource()
The default constructor to generate a certificates source with an independent certificates pool.CommonCertificateSource(CertificatePool certPool)
The default constructor with mandatory certificates pool. -
Method Summary
Modifier and Type Method Description CertificateToken
addCertificate(CertificateToken token)
This method adds an external certificate to the encapsulated pool and to the source.protected CertificatePool
getCertificatePool()
List<CertificateToken>
getCertificates()
Retrieves the unmodifiable list of all certificate tokens from this source.CertificateSourceType
getCertificateSourceType()
This method returns the certificate source type associated to the implementation class.CertificateToken
getCertificateTokenByDigest(Digest digest)
Returns containedCertificateToken
corresponding to the provideddigest
int
getNumberOfCertificates()
This method returns the number of stored certificates in this sourceboolean
isTrusted(CertificateToken certificateToken)
This method checks if a given certificate is trustedboolean
removeCertificate(CertificateToken certificate)
This method is used internally to remove a certificate from theCertificatePool
.
-
Constructor Details
-
CommonCertificateSource
public CommonCertificateSource()The default constructor to generate a certificates source with an independent certificates pool. -
CommonCertificateSource
The default constructor with mandatory certificates pool.- Parameters:
certPool
- the certificate pool to use
-
-
Method Details
-
getCertificateSourceType
Description copied from interface:CertificateSource
This method returns the certificate source type associated to the implementation class.- Specified by:
getCertificateSourceType
in interfaceCertificateSource
- Returns:
- the certificate origin
-
getCertificatePool
-
addCertificate
This method adds an external certificate to the encapsulated pool and to the source. If the certificate is already present in the pool its source type is associated to the token.- Specified by:
addCertificate
in interfaceCertificateSource
- Parameters:
token
- the certificate to add- Returns:
- the corresponding certificate token
-
getCertificates
Retrieves the unmodifiable list of all certificate tokens from this source.- Specified by:
getCertificates
in interfaceCertificateSource
- Returns:
- all certificates from this source
-
removeCertificate
This method is used internally to remove a certificate from theCertificatePool
.- Parameters:
certificate
- the certificate to be removed- Returns:
- true if removed
-
getNumberOfCertificates
public int getNumberOfCertificates()This method returns the number of stored certificates in this source- Returns:
- number of certificates in this instance
-
getCertificateTokenByDigest
Returns containedCertificateToken
corresponding to the provideddigest
- Parameters:
digest
-Digest
to find the CertificateToken- Returns:
CertificateToken
-
isTrusted
Description copied from interface:CertificateSource
This method checks if a given certificate is trusted- Specified by:
isTrusted
in interfaceCertificateSource
- Parameters:
certificateToken
- the certificate to be tested- Returns:
- true if the certificate is trusted
-