2011-11-16 73 views

回答

5

至少對於舊的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; 
} 

一些額外的信息

https://docs.jboss.org/jbossas/javadoc/4.0.2/org/jboss/resource/security/SecureIdentityLoginModule.java.html

http://www.docjar.com/html/api/org/jboss/resource/security/SecureIdentityLoginModule.java.html