Package eu.europa.esig.dss.spi.x509
Class ListCertificateSource
java.lang.Object
eu.europa.esig.dss.spi.x509.ListCertificateSource
- All Implemented Interfaces:
CertificateSource
,Serializable
This class operates on several
CertificateSource
with the composite
design pattern.- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructorListCertificateSource
(CertificateSource certificateSource) This constructor allows to instantiate an object of the class with oneCertificateSource
ListCertificateSource
(List<CertificateSource> certificateSources) This constructor allows to instantiate an object of the class with a list ofCertificateSource
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(CertificateSource certificateSource) This method allows to add a certificate source to the listvoid
addAll
(ListCertificateSource listCertificateSource) Allows to add a list of embedded certificate sources to the list of certificate sourcesvoid
addAll
(List<CertificateSource> certificateSources) Allows to add a list of certificate sourcesaddCertificate
(CertificateToken certificate) This method allows to manually add any certificate to the source.boolean
Checks if the ListCertificateSource contains only trusted CertificateSourcesboolean
This method verifies if the current list of certificate sources contains a trusted certificate sourcefindTokensFromCertRef
(CertificateRef certificateRef) Returns Set ofCertificateToken
s for the providedCertificateRef
getByCertificateDigest
(Digest digest) getByPublicKey
(PublicKey publicKey) getBySignerIdentifier
(SignerIdentifier signerIdentifier) This method returns the Set of certificates with theCertificateIdentifier
getBySki
(byte[] ski) This method returns the foundCertificateToken
from allCertificateSource
for the given subject key identifier (SHA-1 of the public key).getBySubject
(X500PrincipalHelper subject) This method returns the foundCertificateToken
from allCertificateSource
for the givenX500PrincipalHelper
.Retrieves the unmodifiable list of all certificate tokens from this source.This method returns the certificate source type associated to the implementation class.getCertificateSourceType
(CertificateToken certificateToken) This method return the differentCertificateSourceType
where the certificate is foundReturns a list of certificates grouped by their public keysint
This method returns the number of foundCertificateToken
in all sourcesint
This method returns the number of foundCertificateSourceEntity
in all sourcesint
This method returns the number of setCertificateSource
sReturns an unmodifiable list of embeddedCertificateSource
sboolean
This method checks in all sources if all embedded certificate are self-signedboolean
isCertificateSourceEqual
(CertificateSource certificateSource) This method checks if the current and the givenCertificateSource
s contain the same certificate tokensboolean
isCertificateSourceEquivalent
(CertificateSource certificateSource) This method checks if the current and the givenCertificateSource
s contain the same public keysboolean
isEmpty()
This method checks if the embed sources is emptyboolean
isKnown
(CertificateToken certificateToken) This method checks if a given certificate is known in the current sourceboolean
isTrusted
(CertificateToken certificateToken) This method checks in all sources in the given certificate is trusted
-
Constructor Details
-
ListCertificateSource
public ListCertificateSource()Default constructor -
ListCertificateSource
This constructor allows to instantiate an object of the class with oneCertificateSource
- Parameters:
certificateSource
-CertificateSource
-
ListCertificateSource
This constructor allows to instantiate an object of the class with a list ofCertificateSource
- Parameters:
certificateSources
- a list ofCertificateSource
-
-
Method Details
-
addAll
Allows to add a list of embedded certificate sources to the list of certificate sources- Parameters:
listCertificateSource
-ListCertificateSource
-
addAll
Allows to add a list of certificate sources- Parameters:
certificateSources
- a list ofCertificateSource
s to add
-
add
This method allows to add a certificate source to the list- Parameters:
certificateSource
-CertificateSource
-
getSources
Returns an unmodifiable list of embeddedCertificateSource
s- Returns:
- a list of
CertificateSource
s
-
isEmpty
public boolean isEmpty()This method checks if the embed sources is empty- Returns:
- true if no source has been added
-
areAllCertSourcesTrusted
public boolean areAllCertSourcesTrusted()Checks if the ListCertificateSource contains only trusted CertificateSources- Returns:
- TRUE if all embedded CertificateSources are trusted, FALSE otherwise
-
containsTrustedCertSources
public boolean containsTrustedCertSources()This method verifies if the current list of certificate sources contains a trusted certificate source- Returns:
- TRUE if the list certificate source contains a trusted certificate source, FALSE otherwise
-
addCertificate
Description copied from interface:CertificateSource
This method allows to manually add any certificate to the source. The type of the source is automatically set par each specific implementation.- Specified by:
addCertificate
in interfaceCertificateSource
- Parameters:
certificate
- the certificate you have to trust- Returns:
- the corresponding certificate token
-
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
-
getCertificates
Description copied from interface:CertificateSource
Retrieves the unmodifiable list of all certificate tokens from this source.- Specified by:
getCertificates
in interfaceCertificateSource
- Returns:
- all certificates from this source
-
isTrusted
This method checks in all sources in the given certificate is trusted- Specified by:
isTrusted
in interfaceCertificateSource
- Parameters:
certificateToken
- theCertificateToken
to be checked- Returns:
- true if the certificate is trusted
-
isKnown
Description copied from interface:CertificateSource
This method checks if a given certificate is known in the current source- Specified by:
isKnown
in interfaceCertificateSource
- Parameters:
certificateToken
- the certificate to be tested- Returns:
- true if the certificate is part of the current source
-
isAllSelfSigned
public boolean isAllSelfSigned()This method checks in all sources if all embedded certificate are self-signed- Specified by:
isAllSelfSigned
in interfaceCertificateSource
- Returns:
- true if all certificates from all sources are self-signed
-
isCertificateSourceEqual
Description copied from interface:CertificateSource
This method checks if the current and the givenCertificateSource
s contain the same certificate tokens- Specified by:
isCertificateSourceEqual
in interfaceCertificateSource
- Parameters:
certificateSource
-CertificateSource
to compare- Returns:
- TRUE if both certificate sources contains the same certificate tokens, FALSE otherwise
-
isCertificateSourceEquivalent
Description copied from interface:CertificateSource
This method checks if the current and the givenCertificateSource
s contain the same public keys- Specified by:
isCertificateSourceEquivalent
in interfaceCertificateSource
- Parameters:
certificateSource
-CertificateSource
to compare- Returns:
- TRUE if both certificate sources contains the same public keys, FALSE otherwise
-
getCertificateSourceType
This method return the differentCertificateSourceType
where the certificate is found- Parameters:
certificateToken
- theCertificateToken
to be found- Returns:
- a Set with the different sources
-
getByPublicKey
- Specified by:
getByPublicKey
in interfaceCertificateSource
- Parameters:
publicKey
- thePublicKey
to find in the sources- Returns:
- a Set of found
CertificateToken
-
getBySki
This method returns the foundCertificateToken
from allCertificateSource
for the given subject key identifier (SHA-1 of the public key).- Specified by:
getBySki
in interfaceCertificateSource
- Parameters:
ski
- the subject key identifier to find in the sources- Returns:
- a Set of found
CertificateToken
-
findTokensFromCertRef
Description copied from interface:CertificateSource
Returns Set ofCertificateToken
s for the providedCertificateRef
- Specified by:
findTokensFromCertRef
in interfaceCertificateSource
- Parameters:
certificateRef
- aCertificateRef
- Returns:
- Set of
CertificateToken
s
-
getEntities
Description copied from interface:CertificateSource
Returns a list of certificates grouped by their public keys- Specified by:
getEntities
in interfaceCertificateSource
- Returns:
- a list of
CertificateSourceEntity
s
-
getBySubject
This method returns the foundCertificateToken
from allCertificateSource
for the givenX500PrincipalHelper
.- Specified by:
getBySubject
in interfaceCertificateSource
- Parameters:
subject
- theX500PrincipalHelper
to find in the sources- Returns:
- a Set of found
CertificateToken
-
getBySignerIdentifier
Description copied from interface:CertificateSource
This method returns the Set of certificates with theCertificateIdentifier
- Specified by:
getBySignerIdentifier
in interfaceCertificateSource
- Parameters:
signerIdentifier
- the certificate identifier to match- Returns:
- If no match is found then an empty set is returned.
-
getByCertificateDigest
- Specified by:
getByCertificateDigest
in interfaceCertificateSource
- Parameters:
digest
- theDigest
to find in the sources- Returns:
- a Set of found
CertificateToken
-
getNumberOfSources
public int getNumberOfSources()This method returns the number of setCertificateSource
s- Returns:
- the number of found
CertificateSource
-
getNumberOfCertificates
public int getNumberOfCertificates()This method returns the number of foundCertificateToken
in all sources- Returns:
- the number of found
CertificateToken
-
getNumberOfEntities
public int getNumberOfEntities()This method returns the number of foundCertificateSourceEntity
in all sources- Returns:
- the number of found
CertificateSourceEntity
-