Class EncryptionReplacer

java.lang.Object
com.hazelcast.config.replacer.AbstractPbeReplacer
com.hazelcast.config.replacer.EncryptionReplacer
All Implemented Interfaces:
ConfigReplacer

public class EncryptionReplacer extends AbstractPbeReplacer
This class is an example ConfigReplacer implementation which decrypts encrypted values.

The main(String...) method is provided to generate the encrypted variables.

This class extends AbstractPbeReplacer where the main encryption logic is located. This class implements getPassword() method and depending on configuration allows to use a password file and/or user properties (name and HOME) and/or network interface properties (MAC address).

  • Field Details

    • PROPERTY_PASSWORD_USER_PROPERTIES

      public static final String PROPERTY_PASSWORD_USER_PROPERTIES
      Replacer property name to configure true/false flag controlling if users properties should be used as part of the encryption password.
      See Also:
    • PROPERTY_PASSWORD_NETWORK_INTERFACE

      public static final String PROPERTY_PASSWORD_NETWORK_INTERFACE
      Replacer property name to configure network interface name used to retrieve MAC address used as part of the encryption password.
      See Also:
    • PROPERTY_PASSWORD_FILE

      public static final String PROPERTY_PASSWORD_FILE
      Replacer property name to configure path to a password file which content should be used as part of the encryption password.
      See Also:
  • Constructor Details

    • EncryptionReplacer

      public EncryptionReplacer()
  • Method Details

    • init

      public void init(Properties properties)
      Description copied from interface: ConfigReplacer
      Initialization method called before first usage of the config replacer.
      Specified by:
      init in interface ConfigReplacer
      Overrides:
      init in class AbstractPbeReplacer
      Parameters:
      properties - properties configured (not null)
    • getPrefix

      public String getPrefix()
      Description copied from interface: ConfigReplacer
      Variable replacer prefix string. The value returned should be a constant unique short alphanumeric string without whitespaces.
      Returns:
      constant prefix of this replacer
    • getPassword

      protected char[] getPassword()
      Description copied from class: AbstractPbeReplacer
      Provides password for a chosen SecretKeyFactory.
      Specified by:
      getPassword in class AbstractPbeReplacer
      Returns:
      password must not be null or empty
    • main

      public static final void main(String... args) throws Exception
      Throws:
      Exception
    • encrypt

      protected static String encrypt(String... args) throws Exception
      Throws:
      Exception