Module jpms_dss_spi

Class ListCertificateSource

java.lang.Object
eu.europa.esig.dss.spi.x509.ListCertificateSource
All Implemented Interfaces:
CertificateSource, Serializable

public class ListCertificateSource extends Object implements CertificateSource
This class operates on several CertificateSource with the composite design pattern.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor
    This constructor allows to instantiate an object of the class with one CertificateSource
    This constructor allows to instantiate an object of the class with a list of CertificateSource
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(CertificateSource certificateSource)
    This method allows to add a certificate source to the list
    void
    addAll(ListCertificateSource listCertificateSource)
    Allows to add a list of embedded certificate sources to the list of certificate sources
    void
    addAll(List<CertificateSource> certificateSources)
    Allows to add a list of certificate sources
    eu.europa.esig.dss.model.x509.CertificateToken
    addCertificate(eu.europa.esig.dss.model.x509.CertificateToken certificate)
    This method allows to manually add any certificate to the source.
    boolean
    Checks if the ListCertificateSource contains only trusted CertificateSources
    boolean
    This method verifies if the current list of certificate sources contains a trusted certificate source
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    Returns Set of CertificateTokens for the provided CertificateRef
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    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)
    This method returns the found CertificateToken from all CertificateSource for the given Digest.
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    Deprecated.
    since DSS 5.13.
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    This method returns the found CertificateToken from all CertificateSource for the given PublicKey.
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    This method returns the Set of certificates with the CertificateIdentifier
    Set<eu.europa.esig.dss.model.x509.CertificateToken>
    getBySki(byte[] ski)
    This method returns the found CertificateToken from all CertificateSource for 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 found CertificateToken from all CertificateSource for the given X500PrincipalHelper.
    List<eu.europa.esig.dss.model.x509.CertificateToken>
    Retrieves the unmodifiable list of all certificate tokens from this source.
    eu.europa.esig.dss.enumerations.CertificateSourceType
    This 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 different CertificateSourceType where the certificate is found
    List<eu.europa.esig.dss.spi.x509.CertificateSourceEntity>
    Returns a list of certificates grouped by their public keys
    int
    This method returns the number of found CertificateToken in all sources
    int
    This method returns the number of found CertificateSourceEntity in all sources
    int
    This method returns the number of set CertificateSources
    Returns an unmodifiable list of embedded CertificateSources
    boolean
    This method checks in all sources if all embedded certificate are self-signed
    boolean
    This method checks if the current and the given CertificateSources contain the same certificate tokens
    boolean
    This method checks if the current and the given CertificateSources contain the same public keys
    boolean
    This method checks if the embed sources is empty
    boolean
    isKnown(eu.europa.esig.dss.model.x509.CertificateToken certificateToken)
    This method checks if a given certificate is known in the current source
    boolean
    isTrusted(eu.europa.esig.dss.model.x509.CertificateToken certificateToken)
    This method checks in all sources in the given certificate is trusted

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListCertificateSource

      public ListCertificateSource()
      Default constructor
    • ListCertificateSource

      public ListCertificateSource(CertificateSource certificateSource)
      This constructor allows to instantiate an object of the class with one CertificateSource
      Parameters:
      certificateSource - CertificateSource
    • ListCertificateSource

      public ListCertificateSource(List<CertificateSource> certificateSources)
      This constructor allows to instantiate an object of the class with a list of CertificateSource
      Parameters:
      certificateSources - a list of CertificateSource
  • Method Details

    • addAll

      public void addAll(ListCertificateSource listCertificateSource)
      Allows to add a list of embedded certificate sources to the list of certificate sources
      Parameters:
      listCertificateSource - ListCertificateSource
    • addAll

      public void addAll(List<CertificateSource> certificateSources)
      Allows to add a list of certificate sources
      Parameters:
      certificateSources - a list of CertificateSources to add
    • add

      public void add(CertificateSource certificateSource)
      This method allows to add a certificate source to the list
      Parameters:
      certificateSource - CertificateSource
    • getSources

      public List<CertificateSource> getSources()
      Returns an unmodifiable list of embedded CertificateSources
      Returns:
      a list of CertificateSources
    • getAllCertificateTokens

      @Deprecated public Set<eu.europa.esig.dss.model.x509.CertificateToken> getAllCertificateTokens()
      Deprecated.
      since DSS 5.13. Use #getCertificates method instead
      Returns a set of all containing certificate tokens
      Returns:
      set of CertificateTokens
    • getAllEntities

      @Deprecated public Set<eu.europa.esig.dss.spi.x509.CertificateSourceEntity> getAllEntities()
      Deprecated.
      since DSS 5.13. Use #getEntities method instead
      Returns a set of all containing CertificateSourceEntity
      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: 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 interface CertificateSource
      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: CertificateSource
      This method returns the certificate source type associated to the implementation class.
      Specified by:
      getCertificateSourceType in interface CertificateSource
      Returns:
      the certificate origin
    • getCertificates

      public List<eu.europa.esig.dss.model.x509.CertificateToken> getCertificates()
      Description copied from interface: CertificateSource
      Retrieves the unmodifiable list of all certificate tokens from this source.
      Specified by:
      getCertificates in interface CertificateSource
      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:
      isTrusted in interface CertificateSource
      Parameters:
      certificateToken - the CertificateToken to 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: CertificateSource
      This method checks if a given certificate is known in the current source
      Specified by:
      isKnown in interface CertificateSource
      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 interface CertificateSource
      Returns:
      true if all certificates from all sources are self-signed
    • isCertificateSourceEqual

      public boolean isCertificateSourceEqual(CertificateSource certificateSource)
      Description copied from interface: CertificateSource
      This method checks if the current and the given CertificateSources contain the same certificate tokens
      Specified by:
      isCertificateSourceEqual in interface CertificateSource
      Parameters:
      certificateSource - CertificateSource to compare
      Returns:
      TRUE if both certificate sources contains the same certificate tokens, FALSE otherwise
    • isCertificateSourceEquivalent

      public boolean isCertificateSourceEquivalent(CertificateSource certificateSource)
      Description copied from interface: CertificateSource
      This method checks if the current and the given CertificateSources contain the same public keys
      Specified by:
      isCertificateSourceEquivalent in interface CertificateSource
      Parameters:
      certificateSource - CertificateSource to 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 different CertificateSourceType where the certificate is found
      Parameters:
      certificateToken - the CertificateToken to be found
      Returns:
      a Set with the different sources
    • getByPublicKey

      public Set<eu.europa.esig.dss.model.x509.CertificateToken> getByPublicKey(PublicKey publicKey)
      This method returns the found CertificateToken from all CertificateSource for the given PublicKey.
      Specified by:
      getByPublicKey in interface CertificateSource
      Parameters:
      publicKey - the PublicKey to find in the sources
      Returns:
      a Set of found CertificateToken
    • getBySki

      public Set<eu.europa.esig.dss.model.x509.CertificateToken> getBySki(byte[] ski)
      This method returns the found CertificateToken from all CertificateSource for the given subject key identifier (SHA-1 of the public key).
      Specified by:
      getBySki in interface CertificateSource
      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: CertificateSource
      Returns Set of CertificateTokens for the provided CertificateRef
      Specified by:
      findTokensFromCertRef in interface CertificateSource
      Parameters:
      certificateRef - a CertificateRef
      Returns:
      Set of CertificateTokens
    • getEntities

      public List<eu.europa.esig.dss.spi.x509.CertificateSourceEntity> getEntities()
      Description copied from interface: CertificateSource
      Returns a list of certificates grouped by their public keys
      Specified by:
      getEntities in interface CertificateSource
      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 found CertificateToken from all CertificateSource for the given X500PrincipalHelper.
      Specified by:
      getBySubject in interface CertificateSource
      Parameters:
      subject - the X500PrincipalHelper to 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: CertificateSource
      This method returns the Set of certificates with the CertificateIdentifier
      Specified by:
      getBySignerIdentifier in interface CertificateSource
      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 instead
      This method returns the found CertificateToken from all CertificateSource for the given SignerIdentifier.
      Parameters:
      signerIdentifier - the SignerIdentifier to 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)
      This method returns the found CertificateToken from all CertificateSource for the given Digest.
      Specified by:
      getByCertificateDigest in interface CertificateSource
      Parameters:
      digest - the Digest to 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 found CertificateToken from all CertificateSource for the given certificateRef.
      Parameters:
      certificateRef - the CertificateRef to find in the sources
      Returns:
      a Set of found CertificateToken
    • getNumberOfSources

      public int getNumberOfSources()
      This method returns the number of set CertificateSources
      Returns:
      the number of found CertificateSource
    • getNumberOfCertificates

      public int getNumberOfCertificates()
      This method returns the number of found CertificateToken in all sources
      Returns:
      the number of found CertificateToken
    • getNumberOfEntities

      public int getNumberOfEntities()
      This method returns the number of found CertificateSourceEntity in all sources
      Returns:
      the number of found CertificateSourceEntity