Class TrustStore


  • public class TrustStore
    extends java.lang.Object
    Singleton class providing a process wide trust store of Card Verifiable Certificates (CVC). The trust store is backed by a hashmap that maps the Certificate Holder Reference (CHR) to the certificate. The trust store itself does not validate certificates added to the store. This must be handled by the caller of the addTrustedCertificate() method.
    Author:
    asc
    • Constructor Detail

      • TrustStore

        public TrustStore()
    • Method Detail

      • getInstance

        public static TrustStore getInstance()
        Return the singleton instance of the trust store.
        Returns:
        the trust store instance
      • isEmpty

        public static boolean isEmpty()
        Return true if the trust store is empty.
        Returns:
        true if the trust store is empty.
      • getTrustedCertificate

        public CardVerifiableCertificate getTrustedCertificate​(PublicKeyReference id)
        Return the CV certificate with the Certificate Holder Reference (CHR) specified by the id parameter
        Parameters:
        id - the Certificate Holder Reference (CHR) of the requested certificate.
        Returns:
        The CV certificate or null if no certificate with matching CHR found.
      • addTrustedCertificate

        public void addTrustedCertificate​(CardVerifiableCertificate cert)
        Add a trusted certificate to the trust store. The trust store relies on the caller to establish trust in the certificate, i.e. by checking the validity of the certificate against a certificate already in the trust store.
        Parameters:
        cert - the certificate to add to the trust store.