Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA MASKING-- Encrypt-JDBC couldn't not get decrypt information after execute select method #3255

Closed
zzy97092236 opened this issue Oct 14, 2019 · 11 comments

Comments

@zzy97092236
Copy link

    Properties props = new Properties();
    props.setProperty("aes.key.value", "123456");
    EncryptorRuleConfiguration encryptorConfig = new EncryptorRuleConfiguration("GMS", props);
    EncryptColumnRuleConfiguration columnConfig = new EncryptColumnRuleConfiguration("", "id_number_encypt", "", "aes");
    EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration(Collections.singletonMap("id_number", columnConfig));
    EncryptRuleConfiguration encryptRuleConfig = new EncryptRuleConfiguration();
    encryptRuleConfig.getEncryptors().put("aes", encryptorConfig);
    encryptRuleConfig.getTables().put("zzy_test_2018", tableConfig);

Is there anything else to configure?

@terrymanu
Copy link
Member

What is your version and SQL?

@zzy97092236
Copy link
Author

zzy97092236 commented Oct 14, 2019

1、version

<version>4.0.0-RC2</version>

2、sql with SpringDataJPA

 2019-10-14 21:42:39.938  INFO 10868 --- [nio-9002-exec-1] ShardingSphere-SQL                       :
 SQL: select zzyinfo0_.id as id1_1_0_, zzyinfo0_.create_time as create_time2_1_0_, zzyinfo0_.create_user_id as create_user_id3_1_0_, zzyinfo0_.id_number_encypt as id_number4_1_0_, zzyinfo0_.update_time as update_time5_1_0_, zzyinfo0_.update_user_id as update_user_id6_1_0_, zzyinfo0_.user_name as user_name7_1_0_ from zzy_test_2018 zzyinfo0_ where zzyinfo0_.id=?

3、return with a Proxy

Method threw 'org.hibernate.HibernateException' exception. Cannot evaluate com.zm.update.jpa.domain.first.ZzyInfo$HibernateProxy$6kUWeQhC.toString() 

4、
a
b

@terrymanu
Copy link
Member

Can you provide full stack trace?
It seems like hibernate's exception

@zzy97092236
Copy link
Author

it's now doesn't have any Exception,but the return value is still encrypted and a proxy. and the mybatis framework has the same problem.
a
b

@yanyzy
Copy link
Contributor

yanyzy commented Oct 21, 2019

Hi @zzy97092236 ,
i tested it with AES ShardingEncryptor, and didn’t reproduce your situation. so is it possible that your GMS spi didn’t work well?

@zzy97092236
Copy link
Author

Hi @zzy97092236 ,
i tested it with AES ShardingEncryptor, and didn’t reproduce your situation. so is it possible that your GMS spi didn’t work well?

I also tested it with AES ShardingEncryptor ,could you share you code ?

@yanyzy
Copy link
Contributor

yanyzy commented Oct 21, 2019

@zzy97092236
My demo is here sharding-jdbc-demo,
if you use it differently, you can also give me an example.

@terrymanu
Copy link
Member

I just set label of this issue as invalid because it seems cannot reproduce.
We can keep focus on this issue until we make sure it is really cannot reproduce.

@zzy97092236
Copy link
Author

version as follwo:
4.0.0-RC2
oracle 11.2.0.4.0 com.oracle.weblogic ojdbc7 12.1.3-0-0

@zzy97092236
Copy link
Author

about this question,The query result should be plaintext. Now it is ciphertext. Is it normal?

66756505-c2c5e900-eecc-11e9-9f24-8780f8e2dddd
aHR0cHM6Ly9vc2NpbWcub3NjaGluYS5uZXQvb3NjbmV0LzM3NTczMThkZmJjM2M0OWY0N2UzOGZiMjA1YWZkZDRmOGQyLmpwZw

@yanyzy
Copy link
Contributor

yanyzy commented Oct 23, 2019

@zzy97092236
The 4.0.0-RC2 version does have this problem for oracle, and it has been fixed. you can wait for the release of 4.0.0-RC3, or build source code to use 4.0.0-RC3-SNAPSHOT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants