taojintianxia opened a new issue, #18368:
URL: https://github.com/apache/shardingsphere/issues/18368

   ## Feature Request
   
   **For English only**, other languages will not accept.
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot make decision by current information, 
we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Is your feature request related to a problem?
   No
   
   ### Describe the feature you would like.
   #### please add `key` support for encryptiion
   steps for "reproduce" the process for this feature as followings :
   1. prepare the Java snippet :
   ```
   DataSource dataSource = 
DatasourceUtil.createDataSource("config-encrypt.yaml");
   dataSource.getConnection().createStatement().execute("drop table if exists 
t_user");
   
dataSource.getConnection().createStatement().execute(SQLClause.USER_CREATION);
   ```
   
   2. prepare the SQL :
   ```java
       String USER_CREATION = "CREATE TABLE `t_user` (\n" +
               "  `id` varchar(64) NOT NULL COMMENT '主键',\n" +
               "  `name` varchar(50) NOT NULL COMMENT '姓名',\n" +
               "  `birthday` date DEFAULT NULL COMMENT '生日',\n" +
               "  `gender` char(1) DEFAULT NULL COMMENT '性别 M-男 F-女',\n" +
               "  `nationality` char(2) DEFAULT NULL COMMENT '国籍',\n" +
               "  `contact_person` varchar(50) DEFAULT NULL COMMENT '联系人',\n" +
               "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 
COMMENT '创建时间',\n" +
               "  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON 
UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',\n" +
               "  `version` int(11) DEFAULT NULL COMMENT '数据版本',\n" +
               "  `updator` varchar(64) DEFAULT NULL COMMENT '更新人',\n" +
               "  `disable` tinyint(1) NOT NULL DEFAULT '0' COMMENT 
'逻辑删除标识',\n" +
               "  PRIMARY KEY (`id`),\n" +
               "  KEY `tb_f_user_name_index` (`name`),\n" +
               "  KEY `tb_f_user_nationality_index` (`nationality`),\n" +
               "  KEY `tb_f_user_create_time_index` (`create_time`) USING 
BTREE,\n" +
               "  KEY `tb_f_user_update_time_index` (`update_time`) USING 
BTREE\n" +
               ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
   ```
   3. the config of encrption as followings :
   ```
   schemaName: sursen_encrypt
   dataSources:
     unique_ds:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://127.0.0.1:3306/encrypt_test?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password: root
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
     - !ENCRYPT
       encryptors:
         aes_encryptor:
           type: AES
           props:
             aes-key-value: 123456abc
       tables:
         tb_f_user10:
           columns:
             birthday:
               cipherColumn: birthday_cipher
               plainColumn: birthday_plain
               encryptorName: aes_encryptor
             name:
               cipherColumn: name_cipher
               encryptorName: aes_encryptor
             contact_person:
               cipherColumn: contact_person_cipher
               plainColumn: contact_person_plain
               encryptorName: aes_encryptor
   props:
     sql-show: false
   ```
   
   when execute the Java snippet, will get followings error, this should be 
support
   <img width="1295" alt="image" 
src="https://user-images.githubusercontent.com/4112856/173725962-c8957369-a9e5-4edf-b0be-d817e5a62c2b.png";>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to