Package be.fgov.ehealth.technicalconnector.ra.utils

# Class KeyStoreManager

java.lang.Object
be.fgov.ehealth.technicalconnector.ra.utils.KeyStoreManager

public class KeyStoreManager extends Object
Provides methods to manipulate its `KeyStore` member.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `KeyStoreManager()`
  Create an empty PKCS12 KeyStore.
  `KeyStoreManager(String storeType)`
  Creates a empty KeyStore based on the given storeType.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAuthenticationChain(char[] passwd, X509Certificate... chain)`
  Add the X509Certificate chain to the keystore, the alias of the actuele certificate is "authentication".
  `void`
  `addAuthenticationKeyPair(KeyPair entry, char[] passwd)`
  Add the authentication keypair to the keystore, a dummy X509Certificate will be generated.
  `void`
  `addEncryptionToken(KeyPair entry, char[] passwd, X509Certificate etkCert)`
  Add the EncryptionToken to the keystore, the alias will be the hex value of the serialnumber.
  `void`
  `load(char[] passwd, byte[] content)`
  Load content from another keystore of the same type into the new one.
  `void`
  `store(String location, char[] passwd)`
  Store the keystore to the given location with the given password.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### KeyStoreManager

    public KeyStoreManager()
    Create an empty PKCS12 KeyStore.

  - ### KeyStoreManager

    public KeyStoreManager(String storeType)
    Creates a empty KeyStore based on the given storeType.

- ## Method Details

  - ### load

    public void load(char[] passwd, byte[] content)
    Load content from another keystore of the same type into the new one.

  - ### addAuthenticationChain

    public void addAuthenticationChain(char[] passwd, X509Certificate... chain) throws TechnicalConnectorException
    Add the X509Certificate chain to the keystore, the alias of the actuele certificate is "authentication".
    Throws:
      `TechnicalConnectorException`

  - ### addEncryptionToken

    public void addEncryptionToken(KeyPair entry, char[] passwd, X509Certificate etkCert) throws TechnicalConnectorException
    Add the EncryptionToken to the keystore, the alias will be the hex value of the serialnumber.
    Throws:
      `TechnicalConnectorException`

  - ### addAuthenticationKeyPair

    public void addAuthenticationKeyPair(KeyPair entry, char[] passwd) throws TechnicalConnectorException
    Add the authentication keypair to the keystore, a dummy X509Certificate will be generated.
    Throws:
      `TechnicalConnectorException`

  - ### store

    public void store(String location, char[] passwd) throws TechnicalConnectorException
    Store the keystore to the given location with the given password.
    Throws:
      `TechnicalConnectorException`