您好 我把encrypt-jdbc配置配到项目中 成功 可是执行项目中hirbernate执行insert 没有被加密 请问是什么原因呀
1.项目中的加密配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:encrypt="http://shardingsphere.apache.org/schema/shardingsphere/encrypt"
xmlns:bean="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://shardingsphere.apache.org/schema/shardingsphere/encrypt
http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encrypt.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean:properties id="props">
<prop key="aes.key.value">123456</prop>
</bean:properties>
<encrypt:data-source id="encryptDataSource" data-source-name="dataSource">
<encrypt:encrypt-rule>
<encrypt:tables>
<encrypt:table name="hi_sys_dataconf">
<encrypt:column logic-column="cd" plain-column="cd" cipher-column="cd_ciper"
encryptor-ref="encryptor_aes"/>
</encrypt:table>
</encrypt:tables>
<encrypt:encryptors>
<encrypt:encryptor id="encryptor_aes" type="AES" props-ref="props"/>
</encrypt:encryptors>
</encrypt:encrypt-rule>
<encrypt:props>
<prop key="sql.show">true</prop>
<prop key="query.with.cipher.column">true</prop>
</encrypt:props>
</encrypt:data-source>
</beans>
2.在项目中配置好以后,项目启动的时候有如下提示信息:
[12-15 10:41:50,374 INFO ] ConfigurationLogger.java:104 - EncryptRuleConfiguration:
encryptors:
encryptor_aes:
props:
aes.key.value: '123456'
type: AES
tables:
hi_sys_dataconf:
columns:
cd:
assistedQueryColumn: ''
cipherColumn: cd_ciper
encryptor: encryptor_aes
plainColumn: cd
[12-15 10:41:50,375 INFO ] ConfigurationLogger.java:104 - Properties:
sql.show: 'true'
query.with.cipher.column: 'true'
[12-15 10:41:50,424 INFO ] SchemaMetaDataLoader.java:70 - Loading 98 tables' meta data.
3.原项目中的某个模块执行如下语句以后存在表中,但是并没有根据上面的加密的配置对相应的字段加密。项目中原模块的sql打印,并没有shardingsphere的sql打印。
[12-15 10:15:59,543 DEBUG] Slf4jLogFilter.java:134 - {conn-10003, pstmt-20171} update executed. effort 1. 62.1785 millis. insert into hi_sys_dataconf (fg_active, cd, des, flag, instr, na, id_parent, py, wb, zj, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4.配置中的表的结构如下: