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
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 sourcesaddCertificate(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 sourcefindTokensFromCertRef(CertificateRef certificateRef) Returns Set ofCertificateTokens for the providedCertificateRefgetByCertificateDigest(Digest digest) getByPublicKey(PublicKey publicKey) getBySignerIdentifier(SignerIdentifier signerIdentifier) This method returns the Set of certificates with theCertificateIdentifiergetBySki(byte[] ski) This method returns the foundCertificateTokenfrom allCertificateSourcefor the given subject key identifier (SHA-1 of the public key).getBySubject(X500PrincipalHelper subject) This method returns the foundCertificateTokenfrom allCertificateSourcefor 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 differentCertificateSourceTypewhere the certificate is foundReturns 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(CertificateToken certificateToken) This method checks if a given certificate is known in the current sourcebooleanisTrusted(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
-
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: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
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
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
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
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
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
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
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.
-
getByCertificateDigest
- Specified by:
getByCertificateDigestin interfaceCertificateSource- Parameters:
digest- theDigestto 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
-