You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/28 12:03:26 UTC

[GitHub] [shardingsphere] yang771036958 opened a new issue, #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

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

   ```
   server:
     port: 50001
   
   spring:
     application:
       name: lite-sys-uaa
     messages:
       basename: com/hollysmart/sys/messages
     main:
       allow-bean-definition-overriding: true
     cloud:
       nacos:
         discovery:
           server-addr: ${spring.cloud.nacos.server-addr}
         config:
           file-extension: yml
           server-addr: ${spring.cloud.nacos.server-addr}
   
     shardingsphere:
       datasource:
         names: ds-0,ds-1,ds-2
         ds-0:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
         ds-1:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
         ds-2:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
       rules:
         dataSources:
           ds:
             writeDataSourceName: ds-0
             readDataSourceNames:
               - ds-1
               - ds-2
             loadBalancerName: roundRobin
         loadBalancers:
           roundRobin:
             type: ROUND_ROBIN
         sharding:
           tables:
             sys_user:
               actual-data-nodes: ds-0.sys_user_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: USER_ID
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: USER_ID
                   shardingAlgorithmName: sys-user-table-alg
             sys_user_mobile:
               actual-data-nodes: ds-0.sys_user_mobile_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: MOBILE
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: MOBILE
                   shardingAlgorithmName: sys-user-mobile-table-alg
             sys_user_username:
               actual-data-nodes: ds-0.sys_user_username_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: USERNAME
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: USERNAME
                   shardingAlgorithmName: sys-user-username-table-alg
             sys_user_oauth:
               actual-data-nodes: ds-0.sys_user_oauth_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: OPEN_ID
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: OPEN_ID
                   shardingAlgorithmName: sys-user-oauth-table-alg
           shardingAlgorithms:
             sys-user-database-alg:
               type: INLINE
               props:
                 algorithm-expression: ds-0
             sys-user-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_$->{USER_ID % 3}
             sys-user-mobile-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_mobile_$->{Math.abs(MOBILE.hashCode())  % 3}
             sys-user-username-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_username_$->{Math.abs(USERNAME.hashCode())  % 3}
             sys-user-oauth-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_oauth_$->{Math.abs(OPEN_ID.hashCode())  % 3}
         encrypt:
           encryptors:
             aes_encryptor:
               type: AES
               props:
                 aes-key-value: 6126e9252C27T7a877e6a76f0c1b0e7e
             sm4_encryptor:
               type: SM4
               props:
                 # 此处不能用CBC模式,是官方的bug,会导致解密失败
                 sm4-mode: ECB
                 sm4-key: f201326119911788cFd30575b81059ac
                 sm4-iv: e166c3391294E69cc4c620f594fe00d7
                 sm4-padding: PKCS7Padding
           tables:
             SYS_USER:
               columns:
                 MOBILE:
                   cipherColumn: MOBILE
                   encryptorName: sm4_encryptor
                 ID_CARD:
                   cipherColumn: ID_CARD
                   encryptorName: sm4_encryptor
             SYS_USER_MOBILE:
               columns:
                 MOBILE:
                   cipherColumn: MOBILE
                   encryptorName: sm4_encryptor
   
   mybatis-plus:
     configuration:
       log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     mapper-locations: classpath:/mappers/*Mapper.xml
     #实体扫描,多个package用逗号或者分号分隔
     typeAliasesPackage: com.hollysmart.sys.uaa.modules.model
     global-config:
       db-config:
         id-type: auto
   
   encrypt:
     key-store:
       location: classpath:config-server.keystore
       secret: Hollysmart!@#123456Aa
       alias: hollysmart
   
   springdoc:
     packages-to-scan: com.hollysmart.sys.uaa.modules.web
   
   ```server:
     port: 50001
   
   spring:
     application:
       name: lite-sys-uaa
     messages:
       basename: com/hollysmart/sys/messages
     main:
       allow-bean-definition-overriding: true
     cloud:
       nacos:
         discovery:
           server-addr: ${spring.cloud.nacos.server-addr}
         config:
           file-extension: yml
           server-addr: ${spring.cloud.nacos.server-addr}
   
     shardingsphere:
       datasource:
         names: ds-0,ds-1,ds-2
         ds-0:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
         ds-1:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
         ds-2:
           type: com.zaxxer.hikari.HikariDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           jdbcUrl: jdbc:mysql://${hollysmart.datasource-common.ip}/lite_admin_service?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true
           username: ${hollysmart.datasource-common.username}
           password: ${hollysmart.datasource-common.password}
       rules:
         dataSources:
           ds:
             writeDataSourceName: ds-0
             readDataSourceNames:
               - ds-1
               - ds-2
             loadBalancerName: roundRobin
         loadBalancers:
           roundRobin:
             type: ROUND_ROBIN
         sharding:
           tables:
             sys_user:
               actual-data-nodes: ds-0.sys_user_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: USER_ID
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: USER_ID
                   shardingAlgorithmName: sys-user-table-alg
             sys_user_mobile:
               actual-data-nodes: ds-0.sys_user_mobile_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: MOBILE
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: MOBILE
                   shardingAlgorithmName: sys-user-mobile-table-alg
             sys_user_username:
               actual-data-nodes: ds-0.sys_user_username_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: USERNAME
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: USERNAME
                   shardingAlgorithmName: sys-user-username-table-alg
             sys_user_oauth:
               actual-data-nodes: ds-0.sys_user_oauth_$->{0..2}
               databaseStrategy:
                 standard:
                   shardingColumn: OPEN_ID
                   shardingAlgorithmName: sys-user-database-alg
               tableStrategy:
                 standard:
                   shardingColumn: OPEN_ID
                   shardingAlgorithmName: sys-user-oauth-table-alg
           shardingAlgorithms:
             sys-user-database-alg:
               type: INLINE
               props:
                 algorithm-expression: ds-0
             sys-user-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_$->{USER_ID % 3}
             sys-user-mobile-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_mobile_$->{Math.abs(MOBILE.hashCode())  % 3}
             sys-user-username-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_username_$->{Math.abs(USERNAME.hashCode())  % 3}
             sys-user-oauth-table-alg:
               type: INLINE
               props:
                 algorithm-expression: sys_user_oauth_$->{Math.abs(OPEN_ID.hashCode())  % 3}
         encrypt:
           encryptors:
             aes_encryptor:
               type: AES
               props:
                 aes-key-value: 6126e9252C27T7a877e6a76f0c1b0e7e
             sm4_encryptor:
               type: SM4
               props:
                 # 此处不能用CBC模式,是官方的bug,会导致解密失败
                 sm4-mode: ECB
                 sm4-key: f201326119911788cFd30575b81059ac
                 sm4-iv: e166c3391294E69cc4c620f594fe00d7
                 sm4-padding: PKCS7Padding
           tables:
             SYS_USER:
               columns:
                 MOBILE:
                   cipherColumn: MOBILE
                   encryptorName: sm4_encryptor
                 ID_CARD:
                   cipherColumn: ID_CARD
                   encryptorName: sm4_encryptor
             SYS_USER_MOBILE:
               columns:
                 MOBILE:
                   cipherColumn: MOBILE
                   encryptorName: sm4_encryptor
   
   mybatis-plus:
     configuration:
       log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     mapper-locations: classpath:/mappers/*Mapper.xml
     #实体扫描,多个package用逗号或者分号分隔
     typeAliasesPackage: com.hollysmart.sys.uaa.modules.model
     global-config:
       db-config:
         id-type: auto
   
   encrypt:
     key-store:
       location: classpath:config-server.keystore
       secret: Hollysmart!@#123456Aa
       alias: hollysmart
   
   springdoc:
     packages-to-scan: com.hollysmart.sys.uaa.modules.web
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] yang771036958 commented on issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

Posted by GitBox <gi...@apache.org>.
yang771036958 commented on issue #17178:
URL: https://github.com/apache/shardingsphere/issues/17178#issuecomment-1112121409

   ![image](https://user-images.githubusercontent.com/34882711/165747949-d5051d60-477a-4c17-a39d-54675f8ca45f.png)
   
   SMS-CBC decrypt error,IV is null,Encryption normal。


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] cheese8 commented on issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #17178:
URL: https://github.com/apache/shardingsphere/issues/17178#issuecomment-1112801652

   I'm following it.
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #17178:
URL: https://github.com/apache/shardingsphere/issues/17178#issuecomment-1112806028

   @cheese8 Good job, assigned.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu closed issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1
URL: https://github.com/apache/shardingsphere/issues/17178


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #17178: Found a bug,SM4,CBC,Decryption exception, shardingsphere JDBC 5.1.1

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #17178:
URL: https://github.com/apache/shardingsphere/issues/17178#issuecomment-1112145043

   Hi @yang771036958, thank you for your feedback. Can you provide the step to reproduce this problem?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org