Class HsmKeyStoreLoader

java.lang.Object
org.forgerock.secrets.keystore.HsmKeyStoreLoader
All Implemented Interfaces:
Function<char[],KeyStore,KeyStoreException>

public final class HsmKeyStoreLoader extends Object implements Function<char[],KeyStore,KeyStoreException>
A loader for the KeyStoreSecretStore that knows how to load standard PKCS#11 Hardware Security Module (HSM) providers on our supported platforms. Oracle and IBM JREs are currently supported.
See Also:
  • Constructor Details

  • Method Details

    • apply

      public KeyStore apply(char[] password) throws KeyStoreException
      Description copied from interface: Function
      Applies this function to the input parameter value and returns the result.
      Specified by:
      apply in interface Function<char[],KeyStore,KeyStoreException>
      Parameters:
      password - The input parameter.
      Returns:
      The result of applying this function to value.
      Throws:
      KeyStoreException
    • toPkcs11Provider

      public static Optional<Provider> toPkcs11Provider(String providerName, String configFilePath)
      Creates and configures a new PKCS#11 provider for the given PKCS#11 configuration file and existing provider name.
      Parameters:
      providerName - the name of an existing registered provider.
      configFilePath - the file path of the PKCS#11 configuration file.
      Returns:
      an optional of a new unregistered Provider or an empty optional if no existing provider was found with the given name.
    • toPkcs11Provider

      public static Provider toPkcs11Provider(String configFilePath)
      Creates and configures a new PKCS#11 provider for the given PKCS#11 configuration file. It will be either an instance of sun.security.pkcs11.SunPKCS11 or com.ibm.crypto.pkcs11impl.provider.IBMPKCS11Impl.
      Parameters:
      configFilePath - the file path of the PKCS#11 configuration file.
      Returns:
      a new unregistered Provider.
      Throws:
      IllegalStateException - if no PKCS#11 provider could be configured.