Encrypting & Decrypting #
Syntax | Description | Type |
---|---|---|
ALTER ENCRYPTING RULE | Modify encrypting rule | RAL |
SHOW ENCRYPTING RULE | View encrypting rule | RAL |
ENCRYPT TABLE | Start encrypting job | RAL |
SHOW ENCRYPTING LIST | View encrypting job | RAL |
SHOW ENCRYPTING STATUS | View encrypting job status | RAL |
COMMIT ENCRYPTING | Commit encrypting job | RAL |
ROLLBACK ENCRYPTING | Rollback encrypting job | RAL |
ALTER DECRYPTING RULE | Modify decrypting rule | RAL |
SHOW DECRYPTING RULE | View decrypting rule | RAL |
DECRYPT TABLE | Start decrypting job | RAL |
SHOW DECRYPTING LIST | View decrypting jobs | RAL |
SHOW DECRYPTING STATUS | View decrypting job status | RAL |
COMMIT DECRYPTING | Commit decrypting job | RAL |
ROLLBACK DECRYPTING | Rollback decrypting job | RAL |
REENCRYPT TABLE WITH RULE tableName | Key exchange phase 1 statement | RAL |
START REENCRYPTING jobId | Key exchange phase 2 statement | RAL |
STOP ENCRYPTING jobId | Stop encrypting job | RAL |
START ENCRYPTING jobId | Restart encrypting job | RAL |
STOP DECRYPTING jobId | Stop decrypting job | RAL |
START DECRYPTING jobId | Restart decrypting job | RAL |
STOP REENCRYPTING jobId | Stop key exchange job | RAL |
1. Modify Encrypting Rule #
ALTER ENCRYPTING RULE
Example
ALTER ENCRYPTING RULE (READ(RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'=500)))));
2. View Encrypting Rule #
SHOW ENCRYPTING RULE
Parameter Description
None
Example
SHOW ENCRYPTING RULE
3. Start Encrypting Job #
ENCRYPT TABLE tableName;
Parameter Description
Name | Description |
---|---|
tableName | Encrypting table |
Example
Start table Encrypting
ENCRYPT TABLE t_user;
Start encrypting the specified column of the table
ENCRYPT TABLE t_user (password);
Starts the encrypting of the derived columns of the specified column of the table
ENCRYPT TABLE t_user (username(LIKE_QUERY));
4. View Encrypting Job #
SHOW ENCRYPTING LIST;
Parameter Description
None
Example
SHOW ENCRYPTING LIST;
5. View Encryting Job Status #
SHOW ENCRYPTING STATUS jobId;
Parameter Description
Name | Description |
---|---|
jobid | Job id |
Example
mysql> SHOW ENCRYPTING STATUS j5202p0000e2af8bea809d29f6ab4b3ac4c99b5789;
+------+-------------+----------+--------+---------------------+---------------+
| item | data_source | status | active | finished_percentage | error_message |
+------+-------------+----------+--------+---------------------+---------------+
| 0 | ds_0 | FINISHED | true | 100 | |
+------+-------------+----------+--------+---------------------+---------------+
Output Description
- data_source: the storage unit where the job task item is located
- status: job status
- active: whether the job is running
- finished_percentage: completion percentage
- error_message: error message
6. Commit Encrypting Job #
COMMIT ENCRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | Job id |
Example
COMMIT ENCRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
7. Rollback encrypting job #
ROLLBACK ENCRYPTING jobId;
Parameter Description
Parameter name | Description |
---|---|
jobid | job id |
Example
ROLLBACK ENCRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
8. Modify Decrypting Rule #
ALTER DECRYPTING RULE (READ(RATE_LIMITER (TYPE(NAME='QPS',PROPERTIES('qps'=500)))));
Example
ALTER DECRYPTING RULE (READ(R
ATE_LIMITER ( TYPE(NAME=‘QPS’,PROPER
TIES('qps= '5000)))));
9. View Decrypting Rule #
SHOW DECRYPTING RULE
Parameter Description
None
Example
SHOW DECRYPTING RULE
10. Start Decrypting Job #
DECRYPT TABLE tableName;
Parameter Description
Name | Description |
---|---|
tableName | Decrypting table |
Example
DECRYPT TABLE t_user;
Start table decrypting
DECRYPT TABLE t_user;
Starts the decrypting for the specified column of the table
DECRYPT TABLE t_user (password);
Special Note
When starting decrypting, if the target table is a single table and the physical table does not contain plaintext columns, Engine will automatically create plaintext columns for decrypting, otherwise the user needs to create plaintext columns by themselves. (This feature supports MySQL, PostgreSQL, openGauss, Oracle and Hive storage units)
11. View Decrypting Job #
SHOW DECRYPTING LIST;
Parameter Description
None
Example
SHOW DECRYPTING LIST;
12. View Decrypting Job Status #
SHOW DECRYPTING STATUS jobId;
Parameter Description
Name | Description |
---|---|
jobid | Job id |
Example
mysql> SHOW DECRYPTING STATUS j5302p0000e2af8bea809d29f6ab4b3ac4c99b5789;
+------+-------------+----------+--------+---------------------+---------------+
| item | data_source | status | active | finished_percentage | error_message |
+------+-------------+----------+--------+---------------------+---------------+
| 0 | testdb | FINISHED | true | 100 | |
+------+-------------+----------+--------+---------------------+---------------+
Output Description
- data_source: the storage unit where the job task item is located
- status: job status
- active: whether the job is running
- finished_percentage: completion percentage
- error_message: error message
13. Commit Decrypting Job #
COMMIT DECRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | Job id |
Example
COMMIT DECRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
14. Rollback decrypting job #
ROLLBACK DECRYPTING jobId;
Parameter description
Parameter name | Description |
---|---|
jobid | job id |
Example
ROLLBACK DECRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
15. Key Exchange Phase 1 Statement #
Rencrypting supports automatic creation of plaintext columns, and after the job is completed, the plaintext columns are automatically deleted.
REENCRYPT TABLE WITH RULE tableName
Parameter Description
Name | Description |
---|---|
tableName | Key exchange table |
Example
REENCRYPT TABLE WITH RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=user_assisted,LIKE_QUERY_COLUMN=user_like,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='665544aaa'))),ASSISTED_QUERY_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='523234abc'))), LIKE_QUERY_ALGORITHM(TYPE(NAME='CHAR_DIGEST_LIKE'))),
(NAME=order_id, PLAIN=order_plain,CIPHER =order_cipher, ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='445533ccc'))))
), QUERY_WITH_CIPHER_COLUMN=true);
16. Key Exchange Phase 2 Statement #
START REENCRYPTING jobId;
Parameter Description
Name | Description |
---|---|
tableName | Key exchange table |
Example
START REENCRYPTING j54014fb26631db0f7149741422d86cc5dfe6;
17. Stop Encrypting job #
STOP ENCRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | job id |
Example
STOP ENCRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
18. Restart Encrypting job #
START ENCRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | job id |
Example
START ENCRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
19. Stop Decrypting job #
STOP DECRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | job id |
Example
STOP DECRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
20. Restart Decrypting job #
START DECRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | job id |
Example
START DECRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';
21. Stop Reencrypting job #
STOP REENCRYPTING jobId;
Parameter Description
Name | Description |
---|---|
jobid | job id |
Example
STOP REENCRYPTING 'j51017f973ac82cb1edea4f5238a258c25e89';