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 CertificateTokenaddCertificate(CertificateToken token)This method adds an external certificate to the encapsulated pool and to the source.protected CertificatePoolgetCertificatePool()List<CertificateToken>getCertificates()Retrieves the unmodifiable list of all certificate tokens from this source.CertificateSourceTypegetCertificateSourceType()This method returns the certificate source type associated to the implementation class.CertificateTokengetCertificateTokenByDigest(Digest digest)Returns containedCertificateTokencorresponding to the provideddigestintgetNumberOfCertificates()This method returns the number of stored certificates in this sourcebooleanisTrusted(CertificateToken certificateToken)This method checks if a given certificate is trustedbooleanremoveCertificate(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:CertificateSourceThis method returns the certificate source type associated to the implementation class.- Specified by:
getCertificateSourceTypein 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:
addCertificatein 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:
getCertificatesin 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 containedCertificateTokencorresponding to the provideddigest- Parameters:
digest-Digestto find the CertificateToken- Returns:
CertificateToken
-
isTrusted
Description copied from interface:CertificateSourceThis method checks if a given certificate is trusted- Specified by:
isTrustedin interfaceCertificateSource- Parameters:
certificateToken- the certificate to be tested- Returns:
- true if the certificate is trusted
-