You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/02/09 08:59:39 UTC

[shardingsphere] branch master updated: add encrypt enviroment (#9391)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new ca38a46  add encrypt enviroment (#9391)
ca38a46 is described below

commit ca38a46dee666fb3b9620fb9a8ec6d32a06ff57d
Author: Jieker <ji...@163.com>
AuthorDate: Tue Feb 9 16:59:07 2021 +0800

    add encrypt enviroment (#9391)
    
    * add encrypt enviroment
    
    * add EOF
---
 .../docker/encrypt/conf/config-encrypt.yaml        |  76 +++++++++++++++
 .../test/resources/docker/encrypt/conf/logback.xml |  33 +++++++
 .../test/resources/docker/encrypt/conf/server.yaml |  43 +++++++++
 .../resources/docker/encrypt/docker-compose.yml    |  55 +++++++++++
 .../src/test/resources/env/encrypt/authority.xml   |  72 ++++++++++++++
 .../src/test/resources/env/encrypt/databases.xml   |  21 +++++
 .../src/test/resources/env/encrypt/dataset.xml     | 105 +++++++++++++++++++++
 .../resources/env/encrypt/init-sql/h2/init.sql     |  27 ++++++
 .../resources/env/encrypt/init-sql/mysql/init.sql  |  33 +++++++
 .../resources/env/encrypt/init-sql/oracle/init.sql |  30 ++++++
 .../env/encrypt/init-sql/postgresql/init.sql       |  32 +++++++
 .../env/encrypt/init-sql/sqlserver/init.sql        |  30 ++++++
 .../src/test/resources/env/encrypt/rules.yaml      |  64 +++++++++++++
 .../resources/env/encrypt/scenario-env.properties  |  42 +++++++++
 14 files changed, 663 insertions(+)

diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/config-encrypt.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/config-encrypt.yaml
new file mode 100644
index 0000000..39e91f7
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/config-encrypt.yaml
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+schemaName: encrypt
+
+dataSources:
+  encrypt:
+    url: jdbc:mysql://mysql.encrypt.host:3306/encrypt?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: root
+    password:
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+    maintenanceIntervalMilliseconds: 30000
+
+rules:
+- !SHARDING
+  tables:
+    t_order:
+      actualDataNodes: encrypt.t_order
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_order_item:
+      actualDataNodes: encrypt.t_order_item
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_order_details:
+      actualDataNodes: encrypt.t_order_details
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_user:
+      actualDataNodes: encrypt.t_user
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+  bindingTables:
+    - t_order,t_user,t_order_item,t_order_details
+  broadcastTables:
+    - t_broadcast_table
+    - t_broadcast_table_for_ddl
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        pwd:
+          plainColumn: pwd
+          cipherColumn: pwd_cipher
+          encryptorName: aes_encryptor
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/logback.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/logback.xml
new file mode 100644
index 0000000..1494746
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/logback.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<configuration>
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <logger name="org.apache.shardingsphere" level="info" additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+    
+    <root>
+        <level value="info" />
+        <appender-ref ref="console" />
+    </root>
+</configuration> 
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/server.yaml
new file mode 100644
index 0000000..9d9f2af
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/conf/server.yaml
@@ -0,0 +1,43 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#governance:
+#  name: governance_ds
+#  registryCenter:
+#    type: ZooKeeper
+#    serverLists: zk:2181
+#    props:
+#      retryIntervalMilliseconds: 500
+#      timeToLiveSeconds: 60
+#      maxRetries: 3
+#      operationTimeoutMilliseconds: 500
+#  overwrite: true
+
+authentication:
+  users:
+    root:
+      password: root
+
+props:
+  max-connections-size-per-query: 1
+  executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  proxy-transaction-type: LOCAL
+  proxy-opentracing-enabled: false
+  proxy-hint-enabled: false
+  query-with-cipher-column: true
+  sql-show: false
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/docker-compose.yml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/docker-compose.yml
new file mode 100644
index 0000000..6d25bf5
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/encrypt/docker-compose.yml
@@ -0,0 +1,55 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+version: "2.1"
+
+services:
+  mysql:
+    image: "mysql/mysql-server:5.7"
+    container_name: encrypt-mysql
+    command: ['--sql_mode=', '--default-authentication-plugin=mysql_native_password']
+    volumes:
+      - ../../env/encrypt/init-sql/mysql:/docker-entrypoint-initdb.d/
+    ports:
+      - "33460:3306"
+    environment:
+      - LANG=C.UTF-8
+  
+#  zookeeper:
+#    image: "zookeeper:3.6.2"
+#    container_name: encrypt-register-center
+#    ports:
+#      - "2181:23810"
+  
+  shardingsphere-proxy:
+    image: apache/shardingsphere-proxy-test
+    container_name: encrypt-shardingsphere-proxy
+    ports:
+      - "33470:3307"
+      - "33480:3308"
+    links:
+      - "mysql:mysql.encrypt.host"
+#      - "zookeeper:zk"
+    volumes:
+      - ./proxy/conf:/opt/shardingsphere-proxy/conf
+    depends_on:
+      - mysql
+    environment:
+      - WAIT_HOSTS=mysql:3306
+      - WAIT_HOSTS_TIMEOUT=300
+      - WAIT_SLEEP_INTERVAL=5
+      - WAIT_HOST_CONNECT_TIMEOUT=30
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/authority.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/authority.xml
new file mode 100644
index 0000000..9116d10
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/authority.xml
@@ -0,0 +1,72 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<authority>
+    <sqlset db-types="Oracle,SQLServer,PostgreSQL">
+        <user-create>
+            <sql>CREATE USER default_user</sql>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE ROLE role2</sql>
+            <sql>CREATE ROLE role3</sql>
+            <sql>CREATE ROLE role4</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>DROP ROLE IF EXISTS role2</sql>
+            <sql>DROP ROLE IF EXISTS role3</sql>
+            <sql>DROP ROLE IF EXISTS role4</sql>
+            <sql>DROP USER IF EXISTS user_dev</sql>
+            <sql>DROP USER IF EXISTS user_dev_new</sql>
+            <sql>DROP USER IF EXISTS default_user</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="SQLServer">
+        <user-create>
+            <sql>CREATE LOGIN login_dev</sql>
+            <sql>CREATE USER user_dev FOR LOGIN login_dev</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP LOGIN IF EXISTS login_dev</sql>
+            <sql>DROP LOGIN IF EXISTS login_dev_new</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="MySQL">
+        <user-create>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE USER user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt.t_order to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on encrypt.t_user to user_dev@localhost</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP USER IF EXISTS user_dev@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev_new@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev@127.0.0.1</sql>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>FLUSH PRIVILEGES</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="Oracle">
+        <user-create>
+            <sql>CREATE USER user_dev identified by passwd_dev</sql>
+        </user-create>
+    </sqlset>
+</authority>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/databases.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/databases.xml
new file mode 100644
index 0000000..82c547a
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/databases.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<databases>
+    <database>encrypt</database>
+</databases>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/dataset.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/dataset.xml
new file mode 100644
index 0000000..4122b01
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/dataset.xml
@@ -0,0 +1,105 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<dataset>
+    <metadata data-nodes="encrypt.t_user">
+        <column name="user_id" type="numeric" />
+        <column name="pwd" type="varchar" />
+        <column name="pwd_cipher" type="varchar" />
+    </metadata>
+    <metadata data-nodes="encrypt.t_order">
+        <column name="order_id" type="numeric" />
+        <column name="user_id" type="numeric" />
+        <column name="status" type="varchar" />
+    </metadata>
+    <metadata data-nodes="encrypt.t_order_item">
+        <column name="item_id" type="numeric" />
+        <column name="order_id" type="numeric" />
+        <column name="user_id" type="numeric" />
+        <column name="status" type="varchar" />
+        <column name="creation_date" type="datetime" />
+    </metadata>
+    <metadata data-nodes="encrypt.t_broadcast_table">
+        <column name="id" type="numeric" />
+        <column name="status" type="varchar" />
+    </metadata>
+    <row data-node="encrypt.t_user" values="10, null, xdpUjIyP5dJQfX+2tOVbYg==" />
+    <row data-node="encrypt.t_user" values="11, null, ad3U0KgdvmyMjHGHM1TnQA==" />
+    <row data-node="encrypt.t_user" values="12, null, yiGGBrwHiDXsZPtZUhPd9A==" />
+    <row data-node="encrypt.t_user" values="13, null, UizTwGQDouZaeZA+NYZrKA==" />
+    <row data-node="encrypt.t_order" values="1000, 10, init" />
+    <row data-node="encrypt.t_order" values="1001, 10, init" />
+    <row data-node="encrypt.t_order" values="1002, 10, init" />
+    <row data-node="encrypt.t_order" values="1003, 10, init" />
+    <row data-node="encrypt.t_order" values="1004, 10, init" />
+    <row data-node="encrypt.t_order" values="1005, 10, init" />
+    <row data-node="encrypt.t_order" values="1006, 10, init" />
+    <row data-node="encrypt.t_order" values="1007, 10, init" />
+    <row data-node="encrypt.t_order" values="1008, 10, init" />
+    <row data-node="encrypt.t_order" values="1009, 10, init" />
+    <row data-node="encrypt.t_order" values="1100, 11, init" />
+    <row data-node="encrypt.t_order" values="1101, 11, init" />
+    <row data-node="encrypt.t_order" values="1102, 11, init" />
+    <row data-node="encrypt.t_order" values="1103, 11, init" />
+    <row data-node="encrypt.t_order" values="1104, 11, init" />
+    <row data-node="encrypt.t_order" values="1105, 11, init" />
+    <row data-node="encrypt.t_order" values="1106, 11, init" />
+    <row data-node="encrypt.t_order" values="1107, 11, init" />
+    <row data-node="encrypt.t_order" values="1108, 11, init" />
+    <row data-node="encrypt.t_order" values="1109, 11, init" />
+    <row data-node="encrypt.t_order_item" values="100000, 1000, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100001, 1000, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100100, 1001, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100101, 1001, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100200, 1002, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100201, 1002, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100300, 1003, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100301, 1003, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100400, 1004, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100401, 1004, 10, init, 2017-08-08" />
+    <row data-node="encrypt.t_order_item" values="100500, 1005, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100501, 1005, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100600, 1006, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100601, 1006, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100700, 1007, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100701, 1007, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100800, 1008, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100801, 1008, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100900, 1009, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="100901, 1009, 10, init, 2017-08-09" />
+    <row data-node="encrypt.t_order_item" values="110000, 1100, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110001, 1100, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110100, 1101, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110101, 1101, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110200, 1102, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110201, 1102, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110300, 1103, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110301, 1103, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110400, 1104, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110401, 1104, 11, init, 2017-08-18" />
+    <row data-node="encrypt.t_order_item" values="110500, 1105, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110501, 1105, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110600, 1106, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110601, 1106, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110700, 1107, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110701, 1107, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110800, 1108, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110801, 1108, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110900, 1109, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_order_item" values="110901, 1109, 11, init, 2017-08-19" />
+    <row data-node="encrypt.t_broadcast_table" values="1, init" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/h2/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/h2/init.sql
new file mode 100644
index 0000000..ef4a191
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/h2/init.sql
@@ -0,0 +1,27 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+DROP TABLE IF EXISTS t_user;
+DROP TABLE IF EXISTS t_order;
+DROP TABLE IF EXISTS t_order_item;
+DROP TABLE IF EXISTS t_broadcast_table;
+
+CREATE TABLE t_user (user_id INT NOT NULL, pwd VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, PRIMARY KEY (user_id));
+CREATE INDEX user_index_t_user ON t_user (user_id);
+CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+CREATE TABLE t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
+CREATE INDEX order_index_t_order ON t_order (order_id);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/mysql/init.sql
new file mode 100644
index 0000000..bbbf21c
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/mysql/init.sql
@@ -0,0 +1,33 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS encrypt;
+
+CREATE DATABASE encrypt;
+
+CREATE TABLE encrypt.t_user (user_id INT NOT NULL, pwd VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, PRIMARY KEY (user_id));
+CREATE INDEX user_index_t_user ON encrypt.t_user (user_id);
+CREATE TABLE encrypt.t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE encrypt.t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+CREATE TABLE encrypt.t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
+CREATE INDEX order_index_t_order ON encrypt.t_order (order_id);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/oracle/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/oracle/init.sql
new file mode 100644
index 0000000..7c4499f
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/oracle/init.sql
@@ -0,0 +1,30 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE USER 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+DROP SCHEMA encrypt;
+
+CREATE SCHEMA encrypt;
+
+CREATE TABLE encrypt.t_user (user_id INT NOT NULL, pwd VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, PRIMARY KEY (user_id));
+CREATE INDEX user_index_t_user ON encrypt.t_user (user_id);
+CREATE TABLE encrypt.t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE encrypt.t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+CREATE TABLE encrypt.t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
+CREATE INDEX order_index_t_order ON encrypt.t_order (order_id);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/postgresql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/postgresql/init.sql
new file mode 100644
index 0000000..288a8c9
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/postgresql/init.sql
@@ -0,0 +1,32 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE USER 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'encrypt';
+
+DROP DATABASE IF EXISTS encrypt;
+
+CREATE DATABASE encrypt;
+
+CREATE TABLE encrypt.t_user (user_id INT NOT NULL, pwd VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, PRIMARY KEY (user_id));
+CREATE INDEX user_index_t_user ON encrypt.t_user (user_id);
+CREATE TABLE encrypt.t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE encrypt.t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+CREATE TABLE encrypt.t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
+CREATE INDEX order_index_t_order ON encrypt.t_order (order_id);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/sqlserver/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/sqlserver/init.sql
new file mode 100644
index 0000000..759b705
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/init-sql/sqlserver/init.sql
@@ -0,0 +1,30 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE USER 'root'@'%' IDENTIFIED BY '';
+GRANT All privileges ON *.* TO 'root'@'%';
+
+DROP DATABASE IF EXISTS encrypt;
+
+CREATE DATABASE encrypt;
+
+CREATE TABLE encrypt.t_user (user_id INT NOT NULL, pwd VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, PRIMARY KEY (user_id));
+CREATE INDEX user_index_t_user ON encrypt.t_user (user_id);
+CREATE TABLE encrypt.t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE encrypt.t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
+CREATE TABLE encrypt.t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
+CREATE INDEX order_index_t_order ON encrypt.t_order (order_id);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/rules.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/rules.yaml
new file mode 100644
index 0000000..64cf38c
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/rules.yaml
@@ -0,0 +1,64 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+rules:
+- !SHARDING
+  tables:
+    t_order:
+      actualDataNodes: encrypt.t_order
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_order_item:
+      actualDataNodes: encrypt.t_order_item
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_order_details:
+      actualDataNodes: encrypt.t_order_details
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+    t_user:
+      actualDataNodes: encrypt.t_user
+      tableStrategy:
+        none:
+      databaseStrategy:
+        none:
+  bindingTables:
+    - t_order,t_user,t_order_item,t_order_details
+  broadcastTables:
+    - t_broadcast_table
+    - t_broadcast_table_for_ddl
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        pwd:
+          plainColumn: pwd
+          cipherColumn: pwd_cipher
+          encryptorName: aes_encryptor
+props:
+  query-with-cipher-column: true
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/scenario-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/scenario-env.properties
new file mode 100644
index 0000000..7ca6e1f
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/encrypt/scenario-env.properties
@@ -0,0 +1,42 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+it.encrypt.mysql.host=127.0.0.1
+it.encrypt.mysql.port=33460
+it.encrypt.mysql.username=root
+it.encrypt.mysql.password=
+
+it.encrypt.postgresql.host=127.0.0.1
+it.encrypt.postgresql.port=5432
+it.encrypt.postgresql.username=postgres
+it.encrypt.postgresql.password=postgres
+
+it.encrypt.sqlserver.host=127.0.0.1
+it.encrypt.sqlserver.port=1433
+it.encrypt.sqlserver.username=sa
+it.encrypt.sqlserver.password=Jdbc1234
+
+it.encrypt.oracle.host=127.0.0.1
+it.encrypt.oracle.port=1521
+it.encrypt.oracle.username=jdbc
+it.encrypt.oracle.password=jdbc
+
+it.encrypt.proxy.host=127.0.0.1
+it.encrypt.proxy.port=33470
+it.encrypt.proxy.username=root
+it.encrypt.proxy.password=root
+