Monday, May 7, 2012

Java code to Decrypt the weblogic server passwords

The below Java code will help us to decrypt the weblogic server password

import weblogic.security.internal.SerializedSystemIni;
    import weblogic.security.internal.encryption.ClearOrEncryptedService;
    import weblogic.security.internal.encryption.EncryptionService;
   
    public class Decrypt {
        public static void main(String[] args) {
            String string = args[0];
            EncryptionService encryptionService = SerializedSystemIni.getEncryptionService();
            ClearOrEncryptedService clearOrEncryptedService = new ClearOrEncryptedService(encryptionService);
            System.out.println("Clear text password: " + clearOrEncryptedService.decrypt(string));
        }
    }

1 comment:

  1. Not working. It is giving me below error.

    Exception in thread "main" weblogic.security.internal.encryption.EncryptionServiceException: com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.
    at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:125)
    at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:173)
    at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:96)
    at com.sni.weblogic.DecryptPassword.main(DecryptPassword.java:20)
    Caused by: com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.
    at com.rsa.jsafe.JA_PKCS5Padding.a(Unknown Source)
    at com.rsa.jsafe.JG_BlockCipher.decryptFinal(Unknown Source)
    at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:113)
    ... 3 more

    ReplyDelete