数据加密

定义

  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] ...))
  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 指定明文数据列,CIPHER 指定密文数据列
  • encryptAlgorithmType 指定加密算法类型,请参考 加密算法
  • 重复的 tableName 将无法被创建

示例

  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. )),
  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. ));
  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. ));
  16. DROP ENCRYPT RULE t_encrypt,t_encrypt_2;