You can encrypt sensitive business data—such as customer phone numbers, email addresses, or card numbers—so that it is stored in the database as ciphertext.

The plugin automatically generates an application key, which is stored under the directory /storage/apps/main/encryption-field-keys.
Each application key is saved as a file whose name is the key ID, with the .key extension. Do not rename these files.
Keep your application key files safe. If an application key file is lost, encrypted data cannot be decrypted.
/storage/apps/${sub-app-name}/encryption-field-keysThis plugin uses an envelope encryption scheme.

application key, stores it in the default directory, and encodes it in base64.field key, encrypts it using the application key and a randomly generated 16-byte field IV (AES), and stores the encrypted result in the options column of the fields table.field key and field IV from the options column of the fields table.field key using the application key and field IV. It then encrypts the actual data using the field key and a randomly generated 16-byte data IV (AES).field key is also used to sign the plaintext using HMAC-SHA256, producing a base64-encoded data signature (used later for querying).data IV and ciphertext are concatenated and encoded in base64.data signature and base64 ciphertext are joined with a . separator.If you want to specify your own application key, you can set the environment variable ENCRYPTION_FIELD_KEY_PATH. The plugin will load all .key files in this directory as application keys.
Application key file requirements:
.key.
Encrypted fields only support the following filter operators:

field key and decrypt it using the application key.field key to generate an HMAC-SHA256 signature for the user’s input.. and perform a prefix search on the encrypted field value in the database.
Before running the key rotation command nocobase key-rotation, ensure that this plugin is already enabled in the application.
When migrating an application to a new environment, you may want to replace the old application key. You can use the nocobase key-rotation command to generate a new application key.
The command requires the application key from the old environment. After running it, NocoBase generates a new application key and replaces the old one. The new key is stored in the default directory and base64-encoded.
For rotating a sub-application’s key, add the --app-name parameter: