Encrypt

Syntax

  1. CREATE ENCRYPT RULE encryptRuleDefinition [, encryptRuleDefinition] ...
  2. ALTER ENCRYPT RULE encryptRuleDefinition [, encryptRuleDefinition] ...
  3. DROP ENCRYPT RULE tableName [, tableName] ...
  4. encryptRuleDefinition:
  5. tableName(COLUMNS(columnDefinition [, columnDefinition] ...), QUERY_WITH_CIPHER_COLUMN=queryWithCipherColumn)
  6. columnDefinition:
  7. (NAME=columnName [, PLAIN=plainColumnName] , CIPHER=cipherColumnName, encryptAlgorithm)
  8. encryptAlgorithm:
  9. TYPE(NAME=encryptAlgorithmType [, PROPERTIES([algorithmProperties] )] )
  10. algorithmProperties:
  11. algorithmProperty [, algorithmProperty] ...
  12. algorithmProperty:
  13. key=value
  • PLAIN specifies the plain column, CIPHER specifies the cipher column
  • encryptAlgorithmType specifies the encryption algorithm type, please refer to Encryption Algorithm
  • Duplicate tableName will not be created
  • queryWithCipherColumn support uppercase or lowercase true or false

Example

  1. CREATE 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),
  6. t_encrypt_2 (
  7. COLUMNS(
  8. (NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
  9. (NAME=order_id, CIPHER=order_cipher,TYPE(NAME=MD5))
  10. ), QUERY_WITH_CIPHER_COLUMN=FALSE);
  11. ALTER ENCRYPT RULE t_encrypt (
  12. COLUMNS(
  13. (NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
  14. (NAME=order_id,CIPHER=order_cipher,TYPE(NAME=MD5))
  15. ), QUERY_WITH_CIPHER_COLUMN=TRUE);
  16. DROP ENCRYPT RULE t_encrypt,t_encrypt_2;