對jboss數據庫進加密的方法
1.首先,在jboss安裝目錄中查找到jtds-ds.xml數據源文件;
2.jtds-ds.xml數據源文件查找到后,使用記事本打開;
3.文件打開后,在文件中進行以下修改;
<datasources><local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:jtds:sqlserver://ip地址:端口/數據庫名;tds=8.0;lastupdatecount=true</connection-url>
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
<security-domain>EncryptDBPassword</security-domain>
<!--
sql to call on an existing pooled connection when it is obtained from pool
-->
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
</local-tx-datasource>
</datasources>
4.jtds-ds.xml數據源文件修改好后,繼續在jboss安裝目錄中依次打開server\default\conf\login-config.xml文件;
5.最后,login-config.xml文件打開后,在文件中添加以下配置即可對數據庫進行加密;
<application-policy name="EncryptDBPassword">
<authentication>
<login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
<module-option name="username">userName</module-option>
<module-option name="password">-7c9065f142ec1c019b95c743bfc0fde2</module-option>
<module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MSSQLDS</module-option>
</login-module>
</authentication>
</application-policy>