Class KeystoreHandler


  • public class KeystoreHandler
    extends Object
    Class that contains functions for handling keystores
    • Constructor Detail

      • KeystoreHandler

        public KeystoreHandler​(PKIConfiguration pkiConfiguration)
    • Method Detail

      • getSigningCertEntry

        public KeyStore.PrivateKeyEntry getSigningCertEntry​(String alias)
        Loads the MCP certificate used for signing from the (jks) keystore Note that if this KeyStoreHandler has been instantiated with an P11PKIConfiguration object you will need to call the function P11PKIConfiguration.providerLogin() before calling this function. Likewise, when you are finished with using the private key handle returned by this function you should call P11PKIConfiguration.providerLogout().
        Parameters:
        alias - Alias of the signing certificate
        Returns:
        a PrivateKeyEntry of the signing certificate
      • getMCPCertificate

        public Certificate getMCPCertificate​(String alias)
        Returns an MCP certificate from the truststore
        Parameters:
        alias - Either ROOT_CERT_ALIAS or INTERMEDIATE_CERT_ALIAS
        Returns:
        a certificate
      • getTrustStore

        public KeyStore getTrustStore()
        Returns the truststore defined in PKIConfiguration.
        Returns:
        a truststore
      • getPubKey

        public PublicKey getPubKey​(String alias)
        Returns the public key of the sub CA certificate with the given alias
        Parameters:
        alias - Alias of a sub CA
        Returns:
        the public key of the specified sub CA