public class BasicKeystoreKeyStrategy extends AbstractInitializableComponent implements DataSealerKeyStrategy
The separate resource must be a Java properties file containing a CURRENT_VERSION_PROP
property pointing to the latest key version.
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_VERSION_PROP
Name of property representing current key version.
|
Constructor and Description |
---|
BasicKeystoreKeyStrategy()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doDestroy()
Performs component specific destruction logic.
|
void |
doInitialize()
Performs the initialization of the component.
|
Pair<String,SecretKey> |
getDefaultKey()
Get the default/current key to use for new operations, returned along with an identifier for it.
|
SecretKey |
getKey(String name)
Get a specifically named key.
|
void |
setKeyAlias(String alias)
Set the encryption key alias base name.
|
void |
setKeyPassword(String password)
Set the encryption key password.
|
void |
setKeystorePassword(String password)
Set the keystore password.
|
void |
setKeystoreResource(Resource resource)
Set the keystore resource.
|
void |
setKeystoreType(String type)
Set the keystore type.
|
void |
setKeyVersionResource(Resource resource)
Set the key version resource.
|
void |
setUpdateInterval(long interval)
Set the number of milliseconds between key update checks.
|
void |
setUpdateTaskTimer(Timer timer)
Set the timer used to schedule update tasks.
|
destroy, initialize, isDestroyed, isInitialized
@Nonnull @NotEmpty public static final String CURRENT_VERSION_PROP
public void setKeystoreType(@Nonnull @NotEmpty String type)
type
- the keystore typepublic void setKeystoreResource(@Nonnull @NotEmpty Resource resource)
resource
- the keystore resourcepublic void setKeyVersionResource(@Nonnull @NotEmpty Resource resource)
resource
- the key version resourcepublic void setKeystorePassword(@Nonnull @NotEmpty String password)
password
- the keystore passwordpublic void setKeyAlias(@Nonnull @NotEmpty String alias)
alias
- the encryption key alias basepublic void setKeyPassword(@Nonnull @NotEmpty String password)
password
- the encryption key passwordpublic void setUpdateInterval(@Duration @NonNegative long interval)
interval
- number of milliseconds between key update checkspublic void setUpdateTaskTimer(@Nullable Timer timer)
timer
- timer used to schedule update taskspublic void doInitialize() throws ComponentInitializationException
doInitialize
in class AbstractInitializableComponent
ComponentInitializationException
- thrown if there is a problem initializing the componentprotected void doDestroy()
doDestroy
in class AbstractInitializableComponent
@Nonnull public Pair<String,SecretKey> getDefaultKey() throws KeyException
getDefaultKey
in interface DataSealerKeyStrategy
KeyException
- if the key cannot be returned@Nonnull public SecretKey getKey(@Nonnull @NotEmpty String name) throws KeyException
getKey
in interface DataSealerKeyStrategy
name
- name of the key to retrieveKeyException
- if the key cannot be returned, does not exist, etc.Copyright © 2016 JBoss by Red Hat. All rights reserved.