Package io.helidon.config.encryption
Class EncryptionUtil
- java.lang.Object
-
- io.helidon.config.encryption.EncryptionUtil
-
public final class EncryptionUtil extends Object
Encryption utilities for secrets protection.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdecryptRsa(Key key, String encryptedBase64)Decrypt using RSA (private or public key).static StringencryptAes(char[] masterPassword, String secret)Encrypt using AES with GCM method, key is derived from password with random salt.static StringencryptRsa(Key key, String secret)Encrypt secret using RSA (private or public key).
-
-
-
Method Detail
-
decryptRsa
public static String decryptRsa(Key key, String encryptedBase64) throws ConfigEncryptionException
Decrypt using RSA (private or public key). Expects message encrypted with the other key.- Parameters:
key- private or public key to use to decryptencryptedBase64- base64 encoded encrypted secret- Returns:
- Secret value
- Throws:
ConfigEncryptionException- If any problem with decryption occurs
-
encryptRsa
public static String encryptRsa(Key key, String secret) throws ConfigEncryptionException
Encrypt secret using RSA (private or public key).- Parameters:
key- private or public key to use to encryptsecret- secret to encrypt- Returns:
- base64 encoded encrypted bytes
- Throws:
ConfigEncryptionException- If any problem with encryption occurs
-
encryptAes
public static String encryptAes(char[] masterPassword, String secret) throws ConfigEncryptionException
Encrypt using AES with GCM method, key is derived from password with random salt.- Parameters:
masterPassword- master passwordsecret- secret to encrypt- Returns:
- Encrypted value base64 encoded
- Throws:
ConfigEncryptionException- If any problem with encryption occurs
-
-