Encrypt

Syntax

  1. SHOW ENCRYPT RULES [FROM databaseName]
  2. SHOW ENCRYPT TABLE RULE tableName [FROM databaseName]
  • Support to query all data encryption rules and specify logical table name query

Return Value Description

ColumnDescription
tableLogical table name
logic_columnLogical column name
logic_data_typeLogical column data type
cipher_columnCiphertext column name
cipher_data_typeCiphertext column data type
plain_columnPlaintext column name
plain_data_typePlaintext column data type
assisted_query_columnAssisted query column name
assisted_query_data_typeAssisted query column data type
encryptor_typeEncryption algorithm type
encryptor_propsEncryption algorithm parameter
query_with_cipher_columnWhether to use encrypted column for query

Example

Show Encrypt Rules

  1. mysql> SHOW ENCRYPT RULES FROM encrypt_db;
  2. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  3. | table | logic_column | logic_data_type | cipher_column | cipher_data_type | plain_column | plain_data_type | assisted_query_column | assisted_query_data_type | encryptor_type | encryptor_props | query_with_cipher_column |
  4. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  5. | t_encrypt | user_id | | user_cipher | | user_plain | | | | AES | aes-key-value=123456abc | true |
  6. | t_encrypt | order_id | | order_cipher | | | | | | MD5 | | true |
  7. | t_encrypt_2 | user_id | | user_cipher | | user_plain | | | | AES | aes-key-value=123456abc | false |
  8. | t_encrypt_2 | order_id | | order_cipher | | | | | | MD5 | | false |
  9. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  10. 4 rows in set (0.78 sec)

Show Encrypt Table Rule Table Name

  1. mysql> SHOW ENCRYPT TABLE RULE t_encrypt;
  2. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  3. | table | logic_column | logic_data_type | cipher_column | cipher_data_type | plain_column | plain_data_type | assisted_query_column | assisted_query_data_type | encryptor_type | encryptor_props | query_with_cipher_column |
  4. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  5. | t_encrypt | user_id | | user_cipher | | user_plain | | | | AES | aes-key-value=123456abc | true |
  6. | t_encrypt | order_id | | order_cipher | | | | | | MD5 | | true |
  7. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  8. 2 rows in set (0.01 sec)
  9. mysql> SHOW ENCRYPT TABLE RULE t_encrypt FROM encrypt_db;
  10. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  11. | table | logic_column | logic_data_type | cipher_column | cipher_data_type | plain_column | plain_data_type | assisted_query_column | assisted_query_data_type | encryptor_type | encryptor_props | query_with_cipher_column |
  12. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  13. | t_encrypt | user_id | | user_cipher | | user_plain | | | | AES | aes-key-value=123456abc | true |
  14. | t_encrypt | order_id | | order_cipher | | | | | | MD5 | | true |
  15. +-------------+--------------+-----------------+---------------+------------------+--------------+-----------------+-----------------------+--------------------------+----------------+-------------------------+--------------------------+
  16. 2 rows in set (0.01 sec))