ALTER ENCRYPT RULE

Description

The ALTER ENCRYPT RULE syntax is used to alter an encryption rule.

Syntax

  1. AlterEncryptRule ::=
  2. 'ALTER' 'ENCRYPT' 'RULE' encryptDefinition ( ',' encryptDefinition )*
  3. encryptDefinition ::=
  4. tableName '(' 'COLUMNS' '(' columnDefinition ( ',' columnDefinition )* ')' ',' 'QUERY_WITH_CIPHER_COLUMN' '=' ( 'TRUE' | 'FALSE' ) ')'
  5. columnDefinition ::=
  6. 'NAME' '=' columnName ',' ( 'PLAIN' '=' plainColumnName )? 'CIPHER' '=' cipherColumnName ',' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType ( ',' 'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' )? ')'
  7. tableName ::=
  8. identifier
  9. columnName ::=
  10. identifier
  11. plainColumnName ::=
  12. identifier
  13. cipherColumnName ::=
  14. identifier
  15. encryptAlgorithmType ::=
  16. string

Supplement

  • PLAIN specifies the plain column, CIPHER specifies the cipher column
  • encryptAlgorithmType specifies the encryption algorithm type, please refer to Encryption Algorithm
  • queryWithCipherColumn support uppercase or lowercase true or false

Example

  • Alter an encrypt rule
  1. ALTER ENCRYPT RULE t_encrypt (
  2. COLUMNS(
  3. (NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
  4. (NAME=order_id,CIPHER=order_cipher,TYPE(NAME='MD5'))
  5. ), QUERY_WITH_CIPHER_COLUMN=TRUE);

Reserved words

ALTER, ENCRYPT, RULE, COLUMNS, NAME, CIPHER, PLAIN, QUERY_WITH_CIPHER_COLUMN, TYPE, TRUE, FALSE