I cover , with full code, the use of an encrypted password mechanism, where the password is held in an encrypted format such that the Java code can detect if the loaded password is encrypted or (initially) clear, then it is rewritten in an encrypted format, with additional encrypted wrapping characters which enables the code to determine automatically if what is read is an (initial) clear or encrypted password.
The password in this scheme is held in a config.xml file.
A section of this is as follows;
<ceuser>P8Admin</ceuser>
<cepassword>RW5jcnlwdDNkZmlsZW5ldFA0c3N3MHJk</cepassword
<celoginconfig>/opt/IBM/FileNet/CEClient/config/jaas.conf.WSI </celoginconfig>
<ceurl>http://ecmukdemo6:9080/wsi/FNCEWS40MTOM</ceurl>
<cestanza>FileNetP8WSI</cestanza>
The Java code is in Chapter 6 of my
book, "IBM Software Systems Integration"
A section with an example which can be used (see pages 1017-1018) is as follows:
//ASB ... Check if this is still clear ie
//ASB ... Not in the form Encrypt3dpasswordvalueP4ssw0rd
String decryptedJDBCPassword = decrypt(JDBCPassword);
if (decryptedJDBCPassword.startsWith("Encrypt3d")&& decryptedJDBCPassword.endsWith("P4ssw0rd") ){
//ASB ... Extract the actual password
//
JDBCPassword = decryptedJDBCPassword.substring(9, decryptedJDBCPassword.length()-8);
}else{
//ASB ... update the clear password
String encryptedJDBCPassword = "Encrypt3d" + JDBCPassword + "P4ssw0rd";
encryptedJDBCPassword = encrypt(encryptedJDBCPassword);
System.out.print("\r\tENCRYPTED JDBC CDDR PASSWORD = " + encryptedJDBCPassword);
System.out.print("\r\t");
// ASB ... Write encrypted password back to the config.xml file
String dirPath = System.getProperty("user.dir");
String OS = System.getProperty("os.name").toLowerCase();
String file = null;
// ASB
if (OS.indexOf("win") >= 0) {
file = dirPath + "\\config\\config.xml";
} else { //Set to forward slash
file = dirPath + "/config/config.xml";
}
// SET file Name, root element, tag element, old value, new value
updateXML(file,"AUDITProcessor","JDBCPassword", JDBCPassword, encryptedJDBCPassword);
}
Hope this helps as a possible starting point.
------------------------------
Alan S Bluck
Director
ASB Software Development Limited
Ringwood, Hampshire, England
0044 7710612479
IBM Champion (2026),
IBM Champion (2025),
IBM Champion (2024),
IBM Champion (2023),
IBM Champion (2022),
Director, ASB Software Development Limited,
RedHat Accredited Business Partner)
------------------------------