Package com.axelor.common.crypto
Class StringEncryptorCoordinator
java.lang.Object
com.axelor.common.crypto.StringEncryptorCoordinator
Coordinator that routes encrypt/decrypt operations between the legacy
StringEncryptor
($AES$), StringEncryptorPbkdf2Sha256 ($AESv1$), and StringEncryptorPbkdf2Sha512 ($AESv2$).
All new encryptions always use the $AESv1$ format. Decryption automatically dispatches
based on the version prefix embedded in the base64 payload.
-
Constructor Summary
ConstructorsConstructorDescriptionStringEncryptorCoordinator(OperationMode mode, String password) Creates a coordinator with explicit modes for both the current (v1/v2) and legacy encryptors. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringEncryptorCoordinatorCreates a coordinator using AES/CBC for current encryptions.Decrypts by dispatching to the appropriate bundle based on the version prefix.Always encrypts using the current$AESv1$format.static StringEncryptorCoordinatorCreates a coordinator using AES/GCM for current encryptions.booleanisEncrypted(String message) Check whether the given message is already encrypted or not.
-
Constructor Details
-
StringEncryptorCoordinator
Creates a coordinator with explicit modes for both the current (v1/v2) and legacy encryptors.- Parameters:
mode- the operation mode used by the encryptorspassword- the encryption password
-
-
Method Details
-
gcm
Creates a coordinator using AES/GCM for current encryptions. -
cbc
Creates a coordinator using AES/CBC for current encryptions. -
isEncrypted
Description copied from interface:EncryptorCheck whether the given message is already encrypted or not.- Specified by:
isEncryptedin interfaceEncryptor<String,String> - Parameters:
message- the message to check- Returns:
- true if encrypted
-
encrypt
Always encrypts using the current$AESv1$format. -
decrypt
Decrypts by dispatching to the appropriate bundle based on the version prefix.
-