RsaCrypto 数据库用户密码加密

1、将propertiesLoader.java和RsaCryptoUtil.java复制到项目中
2、修改applicationContext.xml中解析properties的bean
   修改后的配置如下:
<bean id="propertyConfigurer"
class="com.dqgb.common.properties.PropertiesLoader">
<property name="locations">
<list>
<value>classpath*:/application.properties</value>
</list>
</property>
</bean>
3、解压RSACrypto.zip,运行rsaCrypto.exe,点击生成密钥
输入数据库帐号,点击加密,得到密文。在peroperties文件中增加jdbc.username_ciphertext属性,值为上面生成的密文。
然后在明文中输入数据库密码,点击加密,得到密码的密文。然后在properties文件中增加jdbc.password_ciphertext属性,值为密文。
注意,两次加密使用的密钥必须一致。
在properties文件中增加priv_key属性,值为私钥,私钥每一行末尾需要增加一个’\’


猜你喜欢

转载自deejay.iteye.com/blog/1576572