org.jasypt.encryption.pbe.config

## Interface PBEConfig

- All Known Subinterfaces:
    StringPBEConfig
  All Known Implementing Classes:
    EnvironmentPBEConfig, EnvironmentStringPBEConfig, SimplePBEConfig, SimpleStringPBEConfig, WebPBEConfig, WebStringPBEConfig

      public interface PBEConfig

  Common interface for config classes applicable to `StandardPBEByteEncryptor`, `StandardPBEStringEncryptor`, `StandardPBEBigIntegerEncryptor` or `StandardPBEBigDecimalEncryptor` objects.

  This interface lets the user create new `PBEConfig` classes which retrieve values for this parameters from different (and maybe more secure) sources (remote servers, LDAP, other databases...), and do this transparently for the encryptor object.

  The config objects passed to an encryptor will only be queried once for each configuration parameter, and this will happen during the initialization of the encryptor object.

  For a default implementation, see `SimplePBEConfig`.

  Since:
    1.0
  Author:
    Daniel Fernández

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithm()` Returns the algorithm to be used for encryption, like `PBEWithMD5AndDES`.
    `IvGenerator` | `getIvGenerator()` Returns a `IvGenerator` implementation to be used by the encryptor.
    `Integer` | `getKeyObtentionIterations()` Returns the number of hashing iterations applied to obtain the encryption key.
    `String` | `getPassword()` Returns the password to be used.
    `Integer` | `getPoolSize()` Get the size of the pool of encryptors to be created.
    `Provider` | `getProvider()` Returns the `java.security.Provider` implementation object to be used by the encryptor for obtaining the encryption algorithm.
    `String` | `getProviderName()` Returns the name of the `java.security.Provider` implementation to be used by the encryptor for obtaining the encryption algorithm.
    `SaltGenerator` | `getSaltGenerator()` Returns a `SaltGenerator` implementation to be used by the encryptor.

- - ### Method Detail

    - #### getAlgorithm

          String getAlgorithm()

      Returns the algorithm to be used for encryption, like `PBEWithMD5AndDES`.

      This algorithm has to be supported by the specified JCE provider (or the default one if no provider has been specified) and, if the provider supports it, you can also specify mode and padding for it, like `ALGORITHM/MODE/PADDING`.

      Returns:
        the name of the algorithm to be used.

    - #### getPassword

          String getPassword()

      Returns the password to be used.

      There is no default value for password, so not setting this parameter either from a `PBEConfig` object or from a call to `setPassword` will result in an EncryptionInitializationException being thrown during initialization.

      Returns:
        the password to be used.

    - #### getKeyObtentionIterations

          Integer getKeyObtentionIterations()

      Returns the number of hashing iterations applied to obtain the encryption key.

      This mechanism is explained in PKCS #5: Password-Based Cryptography Standard.

      Returns:
        the number of iterations

    - #### getSaltGenerator

          SaltGenerator getSaltGenerator()

      Returns a `SaltGenerator` implementation to be used by the encryptor.

      If this method returns null, the encryptor will ignore the config object when deciding the salt generator to be used.

      Returns:
        the salt generator, or null if this object will not want to set a specific SaltGenerator implementation.

    - #### getIvGenerator

          IvGenerator getIvGenerator()

      Returns a `IvGenerator` implementation to be used by the encryptor.

      If this method returns null, the encryptor will ignore the config object when deciding the IV generator to be used.

      Returns:
        the IV generator, or null if this object will not want to set a specific IvGenerator implementation.

    - #### getProviderName

          String getProviderName()

      Returns the name of the `java.security.Provider` implementation to be used by the encryptor for obtaining the encryption algorithm. This provider must have been registered beforehand.

      If this method returns null, the encryptor will ignore this parameter when deciding the name of the security provider to be used.

      If this method does not return null, and neither does `getProvider()`, `providerName` will be ignored, and the provider object returned by `getProvider()` will be used.

      Returns:
        the name of the security provider to be used.
      Since:
        1.3

    - #### getProvider

          Provider getProvider()

      Returns the `java.security.Provider` implementation object to be used by the encryptor for obtaining the encryption algorithm.

      If this method returns null, the encryptor will ignore this parameter when deciding the security provider object to be used.

      If this method does not return null, and neither does `getProviderName()`, `providerName` will be ignored, and the provider object returned by `getProvider()` will be used.

      The provider returned by this method does not need to be registered beforehand, and its use will not result in its being registered.

      Returns:
        the security provider object to be asked for the digest algorithm.
      Since:
        1.3

    - #### getPoolSize

          Integer getPoolSize()

      Get the size of the pool of encryptors to be created.

      This parameter will be ignored if used with a non-pooled encryptor.

      Returns:
        the size of the pool to be used if this configuration is used with a pooled encryptor
      Since:
        1.7

Copyright © 2019 The JASYPT team. All rights reserved.