CREATE ENCRYPT RULE
语法用于创建数据加密规则
CreateEncryptRule ::=
'CREATE' 'ENCRYPT' 'RULE' encryptDefinition ( ',' encryptDefinition )*
encryptDefinition ::=
tableName '(' 'COLUMNS' '(' columnDefinition ( ',' columnDefinition )* ')' ',' 'QUERY_WITH_CIPHER_COLUMN' '=' queryWithCipherColumn ')'
columnDefinition ::=
'NAME' '=' columnName ',' ( 'PLAIN' '=' plainColumnName )? 'CIPHER' '=' cipherColumnName ',' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType ( ',' 'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' )? ')'
tableName ::=
identifier
queryWithCipherColumn ::=
identifier
columnName ::=
identifier
plainColumnName ::=
identifier
cipherColumnName ::=
identifier
encryptAlgorithmType ::=
identifier
PLAIN
指定明文数据列,CIPHER
指定密文数据列;encryptAlgorithmType
指定加密算法类型,请参考 加密算法;tableName
将无法被创建;CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))
),QUERY_WITH_CIPHER_COLUMN=true),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER=order_cipher,TYPE(NAME='MD5'))
), QUERY_WITH_CIPHER_COLUMN=FALSE);
CREATE
、ENCRYPT
、RULE
、COLUMNS
、NAME
、CIPHER
、PLAIN
、QUERY_WITH_CIPHER_COLUMN
、TYPE
、TRUE
、FALSE