ALTER ENCRYPT RULE

Description

The ALTER ENCRYPT RULE syntax is used to alter encryption rules.

Syntax

Grammar Railroad diagram

  1. AlterEncryptRule ::=
  2. 'ALTER' 'ENCRYPT' 'RULE' encryptDefinition (',' encryptDefinition)*
  3. encryptDefinition ::=
  4. ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
  5. columnDefinition ::=
  6. '(' 'NAME' '=' columnName ',' 'CIPHER' '=' cipherColumnName (',' 'ASSISTED_QUERY' '=' assistedQueryColumnName)? (',' 'LIKE_QUERY' '=' likeQueryColumnName)? ',' encryptAlgorithmDefinition (',' assistedQueryAlgorithmDefinition)? (',' likeQueryAlgorithmDefinition)? ')'
  7. encryptAlgorithmDefinition ::=
  8. 'ENCRYPT_ALGORITHM' '(' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType (',' propertiesDefinition)? ')'
  9. assistedQueryAlgorithmDefinition ::=
  10. 'ASSISTED_QUERY_ALGORITHM' '(' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType (',' propertiesDefinition)? ')'
  11. likeQueryAlgorithmDefinition ::=
  12. 'LIKE_QUERY_ALGORITHM' '(' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType (',' propertiesDefinition)? ')'
  13. propertiesDefinition ::=
  14. 'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
  15. tableName ::=
  16. identifier
  17. columnName ::=
  18. identifier
  19. cipherColumnName ::=
  20. identifier
  21. assistedQueryColumnName ::=
  22. identifier
  23. likeQueryColumnName ::=
  24. identifier
  25. encryptAlgorithmType ::=
  26. string
  27. key ::=
  28. string
  29. value ::=
  30. literal

Supplement

  • CIPHER specifies the cipher column, ASSISTED_QUERY specifies the assisted query column,LIKE_QUERY specifies the like query column
  • encryptAlgorithmType specifies the encryption algorithm type, please refer to Encryption Algorithm

Example

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

Reserved words

ALTER, ENCRYPT, RULE, COLUMNS, NAME, CIPHER, ASSISTED_QUERY, LIKE_QUERY, ENCRYPT_ALGORITHM, ASSISTED_QUERY_ALGORITHM, LIKE_QUERY_ALGORITHM, TYPE, TRUE, FALSE