Package net.maritimeconnectivity.pki
Class KeystoreHandler
- java.lang.Object
-
- net.maritimeconnectivity.pki.KeystoreHandler
-
public class KeystoreHandler extends Object
Class that contains functions for handling keystores
-
-
Constructor Summary
Constructors Constructor Description KeystoreHandler(PKIConfiguration pkiConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Certificate
getMCPCertificate(String alias)
Returns an MCP certificate from the truststorePublicKey
getPubKey(String alias)
Returns the public key of the sub CA certificate with the given aliasKeyStore.PrivateKeyEntry
getSigningCertEntry(String alias)
Loads the MCP certificate used for signing from the (jks) keystore Note that if this KeyStoreHandler has been instantiated with anP11PKIConfiguration
object you will need to call the function P11PKIConfiguration.providerLogin() before calling this function.KeyStore
getTrustStore()
Returns the truststore defined in PKIConfiguration.
-
-
-
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 anP11PKIConfiguration
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
-
-