- 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 TypeMethodDescription@NotNull CipherCreates a newCipherfor this engine.@NotNull SecretKeycreateSecretKey(@javax.validation.constraints.NotBlank char[] password) Creates a newSecretKeyfor this engine for the specified password.@NotNull StringDecrypts the specified encrypted configuration value.voiddestroy()Destroys all secret information.@NotNull StringEncrypts the specified plain configuration value.
-
Method Details
-
createSecretKey
@NotNull @NotNull SecretKey createSecretKey(@NotBlank @javax.validation.constraints.NotBlank char[] password) throws ConfigCryptoProviderException Creates a newSecretKeyfor this engine for the specified password.- Parameters:
password- The password- Returns:
- The newly created
SecretKey - Throws:
ConfigCryptoProviderException- If an exception occurs creating theSecretKey
-
createCipher
Creates a newCipherfor this engine.- Returns:
- The newly created
Cipher - Throws:
ConfigCryptoProviderException- If an exception occurs creating theCipher
-
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 valuekey- TheSecretKeyto usecipher- TheCipherto 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 valuekey- TheSecretKeyto usecipher- TheCipherto 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 anIllegalStateException.- Throws:
ConfigCryptoProviderException- If an error occurs destroying the secret information.
-