Interface ConfigCryptoEngine

All Known Implementing Classes:
AbstractConfigCryptoEngine, ConfigCryptoAesGcmEngine

@API(status=STABLE, since="1.0") public interface ConfigCryptoEngine
Engine of cryptography transformations for configuration values.
Since:
0.2
Version:
1.0, 2020-04
Author:
(w) Iker Hernaez
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Cipher
    Creates a new Cipher for this engine.
    @NotNull SecretKey
    createSecretKey(@javax.validation.constraints.NotBlank char[] password)
    Creates a new SecretKey for this engine for the specified password.
    @NotNull String
    decrypt(@NotNull String value, @NotNull SecretKey key, @NotNull Cipher cipher)
    Decrypts the specified encrypted configuration value.
    void
    Destroys all secret information.
    @NotNull String
    encrypt(@NotNull String value, @NotNull SecretKey key, @NotNull Cipher cipher)
    Encrypts the specified plain configuration value.
  • Method Details

    • createSecretKey

      @NotNull @NotNull SecretKey createSecretKey(@NotBlank @javax.validation.constraints.NotBlank char[] password) throws ConfigCryptoProviderException
      Creates a new SecretKey for this engine for the specified password.
      Parameters:
      password - The password
      Returns:
      The newly created SecretKey
      Throws:
      ConfigCryptoProviderException - If an exception occurs creating the SecretKey
    • createCipher

      @NotNull @NotNull Cipher createCipher() throws ConfigCryptoProviderException
      Creates a new Cipher for this engine.
      Returns:
      The newly created Cipher
      Throws:
      ConfigCryptoProviderException - If an exception occurs creating the Cipher
    • encrypt

      @NotNull @NotNull String encrypt(@NotNull @NotNull String value, @NotNull @NotNull SecretKey key, @NotNull @NotNull Cipher cipher) throws ConfigCryptoProviderException
      Encrypts the specified plain configuration value.
      Parameters:
      value - The plain configuration value
      key - The SecretKey to use
      cipher - The Cipher to use
      Returns:
      The encrypted configuration value
      Throws:
      ConfigCryptoProviderException - If an exception occurs during the encryption process
    • decrypt

      @NotNull @NotNull String decrypt(@NotNull @NotNull String value, @NotNull @NotNull SecretKey key, @NotNull @NotNull Cipher cipher) throws ConfigCryptoProviderException
      Decrypts the specified encrypted configuration value.
      Parameters:
      value - The encrypted configuration value
      key - The SecretKey to use
      cipher - The Cipher to use
      Returns:
      The plain configuration value
      Throws:
      ConfigCryptoProviderException - If an exception occurs during the decryption process
    • destroy

      void destroy()
      Destroys all secret information. Any further call to the instance will throw an IllegalStateException.
      Throws:
      ConfigCryptoProviderException - If an error occurs destroying the secret information.