Package com.hazelcast.config.replacer
Class AbstractPbeReplacer
java.lang.Object
com.hazelcast.config.replacer.AbstractPbeReplacer
- All Implemented Interfaces:
ConfigReplacer
- Direct Known Subclasses:
EncryptionReplacer
The common parent for
ConfigReplacer implementations which allow to mask values by encrypting the value. This parent
class contains shared methods responsible for encryption/decryption. The implementing classes have to provide
getPassword() implementation - the password will be used to generate a secret key.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault value for "cipherAlgorithm" property.static final StringDefault value for "secretKeyFactoryAlgorithm" property.static final StringReplacer property name to configureCipheralgorithm name.static final StringReplacer property name to configure key length (in bits).static final StringReplacer property name to configure salt length (in bytes).static final StringReplacer property name to configureSecretKeySpecalgorithm name.static final StringReplacer property name to configureSecretKeyFactoryalgorithm name.static final StringReplacer property name to configure Java Security provider name used forCipherandSecretKeyFactoryselection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringDecrypts given encrypted variable.protected StringEncrypts given string with key generated fromgetPassword()with given iteration count and return the masked value (to be used as the variable).protected abstract char[]Provides password for a chosen SecretKeyFactory.getReplacement(String variable) Provides String which should be used as a variable replacement for given masked value.voidinit(Properties properties) Initialization method called before first usage of the config replacer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hazelcast.config.replacer.spi.ConfigReplacer
getPrefix
-
Field Details
-
PROPERTY_CIPHER_ALGORITHM
Replacer property name to configureCipheralgorithm name.- See Also:
-
PROPERTY_SECRET_KEY_FACTORY_ALGORITHM
Replacer property name to configureSecretKeyFactoryalgorithm name.- See Also:
-
PROPERTY_SECRET_KEY_ALGORITHM
Replacer property name to configureSecretKeySpecalgorithm name.- See Also:
-
PROPERTY_KEY_LENGTH_BITS
Replacer property name to configure key length (in bits).- See Also:
-
PROPERTY_SALT_LENGTH_BYTES
Replacer property name to configure salt length (in bytes).- See Also:
-
PROPERTY_SECURITY_PROVIDER
Replacer property name to configure Java Security provider name used forCipherandSecretKeyFactoryselection.- See Also:
-
DEFAULT_CIPHER_ALGORITHM
Default value for "cipherAlgorithm" property.- See Also:
-
DEFAULT_SECRET_KEY_FACTORY_ALGORITHM
Default value for "secretKeyFactoryAlgorithm" property.- See Also:
-
-
Constructor Details
-
AbstractPbeReplacer
public AbstractPbeReplacer()
-
-
Method Details
-
init
Description copied from interface:ConfigReplacerInitialization method called before first usage of the config replacer.- Specified by:
initin interfaceConfigReplacer- Parameters:
properties- properties configured (notnull)
-
getPassword
protected abstract char[] getPassword()Provides password for a chosen SecretKeyFactory.- Returns:
- password must not be
nullor empty
-
getReplacement
Description copied from interface:ConfigReplacerProvides String which should be used as a variable replacement for given masked value.- Specified by:
getReplacementin interfaceConfigReplacer- Parameters:
variable- the masked value- Returns:
- either not
nullString to be used as a replacement for the variable; or null when this replacer is not able to handle the masked value.
-
encrypt
Encrypts given string with key generated fromgetPassword()with given iteration count and return the masked value (to be used as the variable).- Parameters:
secretStr- sensitive string to be protected by encryptioniterations- iteration count- Returns:
- the encrypted value.
- Throws:
Exception- in case of any exceptional case
-
decrypt
Decrypts given encrypted variable.- Parameters:
encryptedStr- the encrypted value- Returns:
- the decrypted value
- Throws:
Exception- in case of any exceptional case
-