Encrypting datasource password for JBoss 4.2.3.GA

1) Replace user-name and password with security-domain in datasource:

DCM4CHEE_HOME/server/default/deploy/pacs-XXXX-ds.xml
<datasources>
  <local-tx-datasource>
    <jndi-name>pacsDS</jndi-name>
    ...
    <!-- <user-name>pacs</user-name> -->
    <!-- <password>xxx</password> -->
    <security-domain>PacsDSEncrypt</security-domain>
    ...
  </local-tx-datasource>
</datasources>

2) Encrypt password:
Change directory to DCM4CHEE_HOME

unix
java -cp lib/jboss-common.jar:lib/jboss-jmx.jar:server/default/lib/jbosssx.jar:server/default/lib/jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule <password>
windows
java -cp lib\jboss-common.jar;lib\jboss-jmx.jar;server\default\lib\jbosssx.jar;server\default\lib\jboss-jca.jar org.jboss.resource.security.SecureIdentityLoginModule <password>

3) Add security-domain in DCM4CHEE_HOME/server/default/conf/login-config using encrypted password of step 2:

login-config.xml
<policy>
  ...
  <application-policy name="PacsDSEncrypt">
      <authentication>
          <login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
              <module-option name="username">pacs</module-option>
              <module-option name="password">16e0af412f44e943</module-option>
              <module-option name="managedConnectionFactoryName">jboss.jca:name=pacsDS,service=LocalTxCM</module-option>
          </login-module>
      </authentication>
  </application-policy>
</policy>