Package com.firebolt.jdbc.cache
Class EncryptionService
java.lang.Object
com.firebolt.jdbc.cache.EncryptionService
Class that knows how to encrypt and encrypt secrets using AES encryption algorithm
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EncryptionService
public EncryptionService()
-
-
Method Details
-
encrypt
public String encrypt(String plainText, String encryptionKey) throws EncryptionException, IllegalArgumentException Encrypts a plaintext using the encryption key.- Parameters:
plainText
- - the text to be encryptedencryptionKey
- - the key to be used for encryption- Returns:
- - if encryption is successful then a base64 encoded encrypted string will be returned
- Throws:
EncryptionException
- - when cannot encrypt the plain textIllegalArgumentException
-
decrypt
public String decrypt(String base64EncryptedText, String encryptionKey) throws EncryptionException, IllegalArgumentException Decrypts the encrypted text using AES algorithm- Parameters:
base64EncryptedText
- - the base64 encoded stringencryptionKey
- - the key to decrypt- Returns:
- the original plain text
- Throws:
EncryptionException
- - in case the encrypted text cannot be decryptedIllegalArgumentException
-