Class PooledConfigCryptoProvider

java.lang.Object
dev.orne.config.impl.AbstractConfigCryptoProvider
dev.orne.config.impl.PooledConfigCryptoProvider
All Implemented Interfaces:
ConfigCryptoProvider

@API(status=INTERNAL, since="1.0") public class PooledConfigCryptoProvider extends AbstractConfigCryptoProvider
Default implementation of ConfigCryptoProvider based on ConfigCryptoEngine with pooled Ciphers.
Since:
0.2
Version:
1.0, 2020-08
Author:
(w) Iker Hernaez
See Also:
  • Constructor Details

    • PooledConfigCryptoProvider

      public PooledConfigCryptoProvider(@NotNull @NotNull CryptoProviderOptions options)
      Creates a new instance with specified builder configuration options.
      Parameters:
      options - The configured builder options.
    • PooledConfigCryptoProvider

      protected PooledConfigCryptoProvider(@NotNull @NotNull ConfigCryptoEngine engine, boolean destroyEngine, @NotNull @NotNull SecretKey secretKey, @NotNull @NotNull org.apache.commons.pool2.ObjectPool<Cipher> pool)
      Creates a new instance.
      Parameters:
      engine - The cryptographic engine to use.
      destroyEngine - If the engine must be destroyed with provider.
      secretKey - The secret key to use.
      pool - The pool of Cipher instances to use.
  • Method Details

    • getCiphersPool

      @NotNull protected @NotNull org.apache.commons.pool2.ObjectPool<Cipher> getCiphersPool()
      Returns the pool of Ciphers to use during encryption and decryption.
      Returns:
      The pool of Ciphers to use during encryption and decryption
    • encrypt

      @NotNull public @NotNull String encrypt(@NotNull @NotNull String value) throws ConfigCryptoProviderException
      Encrypts the specified plain configuration value.
      Parameters:
      value - The plain configuration value
      Returns:
      The encrypted configuration value
      Throws:
      ConfigCryptoProviderException - If an exception occurs during the encryption process
    • decrypt

      @NotNull public @NotNull String decrypt(@NotNull @NotNull String value) throws ConfigCryptoProviderException
      Decrypts the specified encrypted configuration value.
      Parameters:
      value - The encrypted configuration value
      Returns:
      The plain configuration value
      Throws:
      ConfigCryptoProviderException - If an exception occurs during the decryption process