3
是否有一個由jboss提供的API,可以用來訪問login-config.xml並解密加密的密碼?如何解密jboss login-config.xml中的密碼?
是否有一個由jboss提供的API,可以用來訪問login-config.xml並解密加密的密碼?如何解密jboss login-config.xml中的密碼?
至少對於舊的jboss版本(4.x),「jaas is the way」是默認鍵。你可以嘗試像這樣解碼編碼的字節。
public static String decode(String secret) {
String retString = "";
try {
byte[] kbytes = "jaas is the way".getBytes();
SecretKeySpec key = new SecretKeySpec(kbytes, "Blowfish");
BigInteger n = new BigInteger(secret, 16);
byte[] encoding = n.toByteArray();
Cipher cipher = Cipher.getInstance("Blowfish");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] decode = cipher.doFinal(encoding);
retString = new String(decode);
} catch (Exception ignore) {
ignore.printStackTrace();
}
return retString;
}
一些額外的信息
http://www.docjar.com/html/api/org/jboss/resource/security/SecureIdentityLoginModule.java.html