Package com.axelor.db.converters
Class EncryptedFieldService
java.lang.Object
com.axelor.db.converters.EncryptedFieldService
The service can be used to migrate all the encrypted field values.
This utility method migrate() can be used to migrate encrypted field values if you
want to change encryption algorithm or password or salt.
Following encryption settings will be read from axelor-config.properties for the
migration.
encryption.old-algorithmthe old algorithm, empty if not set previouslyencryption.old-passwordthe old password, empty if not set previously
encryption.algorithmthe new algorithm, empty if want to use defaultencryption.passwordthe new password (required)
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EncryptedFieldService
public EncryptedFieldService()
-
-
Method Details
-
migrate
public void migrate()Migrates all encrypted field values across all models.Iterates over every registered model and re-encrypts each encrypted field using the new algorithm and password configured in
axelor-config.properties.- Throws:
IllegalStateException- if the new encryption password is not configured
-
migrate
Migrates encrypted field values for the given model.If no field names are provided, all encrypted fields of the model are migrated. Each value is decrypted using the old encryptor (via the JPA converter) and re-encrypted using the new algorithm and password. Updates are executed in batches via JDBC for efficiency.
- Parameters:
model- the model class whose encrypted fields should be migratedfields- optional list of specific field names to migrate; if empty, all encrypted fields are migrated- Throws:
IllegalStateException- if the new encryption password is not configured
-