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
ConstructorsConstructorDescriptionDefault constructorListCertificateSource(CertificateSource certificateSource) This constructor allows to instantiate an object of the class with oneCertificateSourceListCertificateSource(List<CertificateSource> certificateSources) This constructor allows to instantiate an object of the class with a list ofCertificateSource -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CertificateSource certificateSource) This method allows to add a certificate source to the listvoidaddAll(ListCertificateSource listCertificateSource) Allows to add a list of embedded certificate sources to the list of certificate sourcesvoidaddAll(List<CertificateSource> certificateSources) Allows to add a list of certificate sourceseu.europa.esig.dss.model.x509.CertificateTokenaddCertificate(eu.europa.esig.dss.model.x509.CertificateToken certificate) This method allows to manually add any certificate to the source.booleanChecks if the ListCertificateSource contains only trusted CertificateSourcesbooleanThis method verifies if the current list of certificate sources contains a trusted certificate sourceSet<eu.europa.esig.dss.model.x509.CertificateToken> findTokensFromCertRef(CertificateRef certificateRef) Returns Set ofCertificateTokens for the providedCertificateRefSet<eu.europa.esig.dss.model.x509.CertificateToken> findTokensFromRefs(CertificateRef certificateRef) Deprecated.since DSS 5.13.Set<eu.europa.esig.dss.model.x509.CertificateToken> Deprecated.since DSS 5.13.Set<eu.europa.esig.dss.spi.x509.CertificateSourceEntity> Deprecated.since DSS 5.13.Set<eu.europa.esig.dss.model.x509.CertificateToken> getByCertificateDigest(eu.europa.esig.dss.model.Digest digest) Set<eu.europa.esig.dss.model.x509.CertificateToken> getByCertificateIdentifier(SignerIdentifier signerIdentifier) Deprecated.since DSS 5.13.Set<eu.europa.esig.dss.model.x509.CertificateToken> getByPublicKey(PublicKey publicKey) Set<eu.europa.esig.dss.model.x509.CertificateToken> getBySignerIdentifier(SignerIdentifier signerIdentifier) This method returns the Set of certificates with theCertificateIdentifierSet<eu.europa.esig.dss.model.x509.CertificateToken> getBySki(byte[] ski) This method returns the foundCertificateTokenfrom allCertificateSourcefor the given subject key identifier (SHA-1 of the public key).Set<eu.europa.esig.dss.model.x509.CertificateToken> getBySubject(eu.europa.esig.dss.model.x509.X500PrincipalHelper subject) This method returns the foundCertificateTokenfrom allCertificateSourcefor the givenX500PrincipalHelper.List<eu.europa.esig.dss.model.x509.CertificateToken> Retrieves the unmodifiable list of all certificate tokens from this source.eu.europa.esig.dss.enumerations.CertificateSourceTypeThis method returns the certificate source type associated to the implementation class.Set<eu.europa.esig.dss.enumerations.CertificateSourceType> getCertificateSourceType(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method return the differentCertificateSourceTypewhere the certificate is foundList<eu.europa.esig.dss.spi.x509.CertificateSourceEntity> Returns a list of certificates grouped by their public keysintThis method returns the number of foundCertificateTokenin all sourcesintThis method returns the number of foundCertificateSourceEntityin all sourcesintThis method returns the number of setCertificateSourcesReturns an unmodifiable list of embeddedCertificateSourcesbooleanThis method checks in all sources if all embedded certificate are self-signedbooleanisCertificateSourceEqual(CertificateSource certificateSource) This method checks if the current and the givenCertificateSources contain the same certificate tokensbooleanisCertificateSourceEquivalent(CertificateSource certificateSource) This method checks if the current and the givenCertificateSources contain the same public keysbooleanisEmpty()This method checks if the embed sources is emptybooleanisKnown(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method checks if a given certificate is known in the current sourcebooleanisTrusted(eu.europa.esig.dss.model.x509.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 ofCertificateSources to add
-
add
This method allows to add a certificate source to the list- Parameters:
certificateSource-CertificateSource
-
getSources
Returns an unmodifiable list of embeddedCertificateSources- Returns:
- a list of
CertificateSources
-
getAllCertificateTokens
Deprecated.since DSS 5.13. Use#getCertificatesmethod insteadReturns a set of all containing certificate tokens- Returns:
- set of
CertificateTokens
-
getAllEntities
Deprecated.since DSS 5.13. Use#getEntitiesmethod insteadReturns a set of all containingCertificateSourceEntity- Returns:
- set of
CertificateSourceEntitys
-
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
public eu.europa.esig.dss.model.x509.CertificateToken addCertificate(eu.europa.esig.dss.model.x509.CertificateToken certificate) Description copied from interface:CertificateSourceThis method allows to manually add any certificate to the source. The type of the source is automatically set par each specific implementation.- Specified by:
addCertificatein interfaceCertificateSource- Parameters:
certificate- the certificate you have to trust- Returns:
- the corresponding certificate token
-
getCertificateSourceType
public eu.europa.esig.dss.enumerations.CertificateSourceType 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
-
getCertificates
Description copied from interface:CertificateSourceRetrieves the unmodifiable list of all certificate tokens from this source.- Specified by:
getCertificatesin interfaceCertificateSource- Returns:
- all certificates from this source
-
isTrusted
public boolean isTrusted(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method checks in all sources in the given certificate is trusted- Specified by:
isTrustedin interfaceCertificateSource- Parameters:
certificateToken- theCertificateTokento be checked- Returns:
- true if the certificate is trusted
-
isKnown
public boolean isKnown(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) Description copied from interface:CertificateSourceThis method checks if a given certificate is known in the current source- Specified by:
isKnownin 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:
isAllSelfSignedin interfaceCertificateSource- Returns:
- true if all certificates from all sources are self-signed
-
isCertificateSourceEqual
Description copied from interface:CertificateSourceThis method checks if the current and the givenCertificateSources contain the same certificate tokens- Specified by:
isCertificateSourceEqualin interfaceCertificateSource- Parameters:
certificateSource-CertificateSourceto compare- Returns:
- TRUE if both certificate sources contains the same certificate tokens, FALSE otherwise
-
isCertificateSourceEquivalent
Description copied from interface:CertificateSourceThis method checks if the current and the givenCertificateSources contain the same public keys- Specified by:
isCertificateSourceEquivalentin interfaceCertificateSource- Parameters:
certificateSource-CertificateSourceto compare- Returns:
- TRUE if both certificate sources contains the same public keys, FALSE otherwise
-
getCertificateSourceType
public Set<eu.europa.esig.dss.enumerations.CertificateSourceType> getCertificateSourceType(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method return the differentCertificateSourceTypewhere the certificate is found- Parameters:
certificateToken- theCertificateTokento be found- Returns:
- a Set with the different sources
-
getByPublicKey
- Specified by:
getByPublicKeyin interfaceCertificateSource- Parameters:
publicKey- thePublicKeyto find in the sources- Returns:
- a Set of found
CertificateToken
-
getBySki
This method returns the foundCertificateTokenfrom allCertificateSourcefor the given subject key identifier (SHA-1 of the public key).- Specified by:
getBySkiin interfaceCertificateSource- Parameters:
ski- the subject key identifier to find in the sources- Returns:
- a Set of found
CertificateToken
-
findTokensFromCertRef
public Set<eu.europa.esig.dss.model.x509.CertificateToken> findTokensFromCertRef(CertificateRef certificateRef) Description copied from interface:CertificateSourceReturns Set ofCertificateTokens for the providedCertificateRef- Specified by:
findTokensFromCertRefin interfaceCertificateSource- Parameters:
certificateRef- aCertificateRef- Returns:
- Set of
CertificateTokens
-
getEntities
Description copied from interface:CertificateSourceReturns a list of certificates grouped by their public keys- Specified by:
getEntitiesin interfaceCertificateSource- Returns:
- a list of
CertificateSourceEntitys
-
getBySubject
public Set<eu.europa.esig.dss.model.x509.CertificateToken> getBySubject(eu.europa.esig.dss.model.x509.X500PrincipalHelper subject) This method returns the foundCertificateTokenfrom allCertificateSourcefor the givenX500PrincipalHelper.- Specified by:
getBySubjectin interfaceCertificateSource- Parameters:
subject- theX500PrincipalHelperto find in the sources- Returns:
- a Set of found
CertificateToken
-
getBySignerIdentifier
public Set<eu.europa.esig.dss.model.x509.CertificateToken> getBySignerIdentifier(SignerIdentifier signerIdentifier) Description copied from interface:CertificateSourceThis method returns the Set of certificates with theCertificateIdentifier- Specified by:
getBySignerIdentifierin interfaceCertificateSource- Parameters:
signerIdentifier- the certificate identifier to match- Returns:
- If no match is found then an empty set is returned.
-
getByCertificateIdentifier
@Deprecated public Set<eu.europa.esig.dss.model.x509.CertificateToken> getByCertificateIdentifier(SignerIdentifier signerIdentifier) Deprecated.since DSS 5.13. Use#getBySignerIdentifier(signerIdentifier)method insteadThis method returns the foundCertificateTokenfrom allCertificateSourcefor the givenSignerIdentifier.- Parameters:
signerIdentifier- theSignerIdentifierto find in the sources- Returns:
- a Set of found
CertificateToken
-
getByCertificateDigest
public Set<eu.europa.esig.dss.model.x509.CertificateToken> getByCertificateDigest(eu.europa.esig.dss.model.Digest digest) - Specified by:
getByCertificateDigestin interfaceCertificateSource- Parameters:
digest- theDigestto find in the sources- Returns:
- a Set of found
CertificateToken
-
findTokensFromRefs
@Deprecated public Set<eu.europa.esig.dss.model.x509.CertificateToken> findTokensFromRefs(CertificateRef certificateRef) Deprecated.since DSS 5.13. Use#findTokensFromCertRef(certificateRef)method instead.This method returns the foundCertificateTokenfrom allCertificateSourcefor the givencertificateRef.- Parameters:
certificateRef- theCertificateRefto find in the sources- Returns:
- a Set of found
CertificateToken
-
getNumberOfSources
public int getNumberOfSources()This method returns the number of setCertificateSources- Returns:
- the number of found
CertificateSource
-
getNumberOfCertificates
public int getNumberOfCertificates()This method returns the number of foundCertificateTokenin all sources- Returns:
- the number of found
CertificateToken
-
getNumberOfEntities
public int getNumberOfEntities()This method returns the number of foundCertificateSourceEntityin all sources- Returns:
- the number of found
CertificateSourceEntity
-