tianshuainan opened a new issue, #22230:
URL: https://github.com/apache/shardingsphere/issues/22230
My version is ShardingSphere-JDBC 5.2.1, when requester_name is null, the
error shows "could not execute statement; nested exception is
org.hibernate.exception.GenericJDBCException: could not execute statement".
Below is my configuration.
`
# dsr_request table
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_name.plainColumn=requester_name
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_name.cipherColumn=requester_name_cipher
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_name.encryptor=encryptor
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_email.plainColumn=requester_email
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_email.cipherColumn=requester_email_cipher
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_email.assistedQueryColumn=requester_email_assisted
spring.shardingsphere.encrypt.tables.dsr_request.columns.requester_email.encryptor=queryassistedencryptor
`
my customize encrypt is as below:
`
public class SdEncryptor implements Encryptor {
private SdkEncryptService getSdkEncryptService() {
return SpringContextUtils.getBean(SdkEncryptService.class);
}
@Override
public String encrypt(Object o) {
if (null == o) {
return null;
}
String encryptData;
try {
encryptData =
getSdkEncryptService().encryptData(String.valueOf(o));
} catch (IOException e) {
log.warn("SDK encrypt field {} failed", String.valueOf(o));
throw new HulkException("SDK encrypt failed", e);
}
return encryptData;
}
@Override
public Object decrypt(String s) {
if (s == null) {
return null;
}
String ret;
try {
ret = getSdkEncryptService().decryptData(s);
} catch (IOException e) {
log.warn("SDK decrypt cipher {} failed", s);
throw new HulkException("SDK decrypt failed", e);
}
return ret;
}
@Override
public String getType() {
return "SdEncryptor";
}
@Override
public Properties getProperties() {
return null;
}
@Override
public void setProperties(Properties properties) {}
@Override
public void init() {}
}
`
--
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]