Package org.opends.server.extensions
Class FileBasedKeyManagerProvider
- java.lang.Object
-
- org.opends.server.api.KeyManagerProvider<FileBasedKeyManagerProviderCfg>
-
- org.opends.server.extensions.FileBasedKeyManagerProvider
-
- All Implemented Interfaces:
ConfigurationChangeListener<FileBasedKeyManagerProviderCfg>
public class FileBasedKeyManagerProvider extends KeyManagerProvider<FileBasedKeyManagerProviderCfg> implements ConfigurationChangeListener<FileBasedKeyManagerProviderCfg>
This class defines a key manager provider that will access keys stored in a file located on the Directory Server filesystem.
-
-
Constructor Summary
Constructors Constructor Description FileBasedKeyManagerProvider()Creates a new instance of this file-based key manager provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(FileBasedKeyManagerProviderCfg cfg)Applies the configuration changes to this change listener.booleancontainsAtLeastOneKey()Verifies that the keystore has at least one usable key.booleancontainsKeyWithAlias(String alias)Verifies that an alias is defined in the scope of this Key Manager.voidfinalizeKeyManagerProvider()Performs any finalization that may be necessary for this key manager provider.KeyManager[]getKeyManagers()Retrieves a set ofKeyManagerobjects that may be used for interactions requiring access to a key manager.voidinitializeKeyManagerProvider(FileBasedKeyManagerProviderCfg cfg)Initializes this key manager provider based on the information in the provided key manager provider configuration.booleanisConfigurationAcceptable(FileBasedKeyManagerProviderCfg cfg, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this key manager provider.booleanisConfigurationChangeAcceptable(FileBasedKeyManagerProviderCfg cfg, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.
-
-
-
Method Detail
-
initializeKeyManagerProvider
public void initializeKeyManagerProvider(FileBasedKeyManagerProviderCfg cfg) throws ConfigException, InitializationException
Description copied from class:KeyManagerProviderInitializes this key manager provider based on the information in the provided key manager provider configuration.- Specified by:
initializeKeyManagerProviderin classKeyManagerProvider<FileBasedKeyManagerProviderCfg>- Parameters:
cfg- The key manager provider configuration that contains the information to use to initialize this key manager provider.- Throws:
ConfigException- If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.InitializationException- If a problem occurs during initialization that is not related to the server configuration.
-
finalizeKeyManagerProvider
public void finalizeKeyManagerProvider()
Description copied from class:KeyManagerProviderPerforms any finalization that may be necessary for this key manager provider.- Specified by:
finalizeKeyManagerProviderin classKeyManagerProvider<FileBasedKeyManagerProviderCfg>
-
containsKeyWithAlias
public boolean containsKeyWithAlias(String alias)
Description copied from class:KeyManagerProviderVerifies that an alias is defined in the scope of this Key Manager.- Overrides:
containsKeyWithAliasin classKeyManagerProvider<FileBasedKeyManagerProviderCfg>- Parameters:
alias- The alias to check.- Returns:
- true if the alias exists, false otherwise
-
getKeyManagers
public KeyManager[] getKeyManagers() throws DirectoryException
Retrieves a set ofKeyManagerobjects that may be used for interactions requiring access to a key manager.The key manager returned reads the key store file again when a handshake starts after the file, or the PIN file, has changed, so that a renewed certificate is presented without restarting the server or the component using it.
- Specified by:
getKeyManagersin classKeyManagerProvider<FileBasedKeyManagerProviderCfg>- Returns:
- A set of
KeyManagerobjects that may be used for interactions requiring access to a key manager. - Throws:
DirectoryException- If a problem occurs while attempting to obtain the set of key managers.
-
containsAtLeastOneKey
public boolean containsAtLeastOneKey()
Description copied from class:KeyManagerProviderVerifies that the keystore has at least one usable key.- Overrides:
containsAtLeastOneKeyin classKeyManagerProvider<FileBasedKeyManagerProviderCfg>- Returns:
- true if the keystore has at least one usable key, false otherwise
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(FileBasedKeyManagerProviderCfg cfg, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from class:KeyManagerProviderIndicates whether the provided configuration is acceptable for this key manager provider. It should be possible to call this method on an uninitialized key manager provider instance in order to determine whether the key manager provider would be able to use the provided configuration.
Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.- Overrides:
isConfigurationAcceptablein classKeyManagerProvider<FileBasedKeyManagerProviderCfg>- Parameters:
cfg- The key manager provider configuration for which to make the determination.unacceptableReasons- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
trueif the provided configuration is acceptable for this key manager provider, orfalseif not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FileBasedKeyManagerProviderCfg cfg, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<FileBasedKeyManagerProviderCfg>- Parameters:
cfg- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(FileBasedKeyManagerProviderCfg cfg)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<FileBasedKeyManagerProviderCfg>- Parameters:
cfg- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
-