roses/kernel-d-security/security-sdk-database-field/README.md

24 lines
944 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

数据库字段加解密工具
注意:
1.数据库加密字段的类型为String类型
2.如果开启功能时数据库对应字段已经有数据需要对旧数据进行处理可以通过EncryptAlgorithmApi对字段进行加密
说明:
1.通过mybatis的拦截器对传入参数和返回结果进行处理
2.可以满足对某个数据库字段在入库时加密,在查询时解密的需求
3.同时也满足对某个数据库字段在入库时加密,查询时依旧显示密文,只有在需要的时候解密的需求
使用方法:
1.给类添加ProtectedData注解以标识该类需要进行加解密处理
2.在需要加解密的字段上面添加ProtectedField注解即可实现在入库时加密查询时解密的功能
3.如果不想在查询时解密则在字段上添加EncryptField注解替换ProtectedField注解即可实现在入库时该字段加密查询时不解密的功能