Package org.forgerock.secrets.keystore
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 Summary
ConstructorsConstructorDescriptionHsmKeyStoreLoader(String configFilePath) Deprecated.HsmKeyStoreLoader(Provider hsmProvider) Initializes the HSM loader with the given PKCS#11 provider. - 
Method Summary
Modifier and TypeMethodDescriptionapply(char[] password) Applies this function to the input parametervalueand returns the result.static ProvidertoPkcs11Provider(String configFilePath) Creates and configures a new PKCS#11 provider for the given PKCS#11 configuration file.toPkcs11Provider(String providerName, String configFilePath) Creates and configures a new PKCS#11 provider for the given PKCS#11 configuration file and existing provider name. 
- 
Constructor Details
- 
HsmKeyStoreLoader
Initializes the HSM loader with the given PKCS#11 provider.- Parameters:
 hsmProvider- the provider object.
 - 
HsmKeyStoreLoader
Deprecated.useHsmKeyStoreLoader(Provider hsmProvider)instead so that management of the provider can be left to the caller.Initializes the HSM loader with a supported PKCS#11 provider for the current platform and the given PKCS#11 configuration file.- Parameters:
 configFilePath- the PKCS#11 configuration file path.- See Also:
 
 
 - 
 - 
Method Details
- 
apply
Description copied from interface:FunctionApplies this function to the input parametervalueand returns the result.- Specified by:
 applyin interfaceFunction<char[],KeyStore, KeyStoreException> - Parameters:
 password- The input parameter.- Returns:
 - The result of applying this function to 
value. - Throws:
 KeyStoreException
 - 
toPkcs11Provider
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 
Provideror an empty optional if no existing provider was found with the given name. 
 - 
toPkcs11Provider
Creates and configures a new PKCS#11 provider for the given PKCS#11 configuration file. It will be either an instance ofsun.security.pkcs11.SunPKCS11orcom.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.
 
 - 
 
HsmKeyStoreLoader(Provider hsmProvider)instead so that management of the provider can be left to the caller.