Monday, May 22, 2017

WebLogic ASE Encryption & Decryption

(A) Encrypt or Decrypt  weblogic AES password using WLST
           cd $OIM_HOME/common/bin
            ./wlst.sh
domain = "$USER_PROJECTS/domains/$DOMAIN_NAME"
service = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domain)
encryption = weblogic.security.internal.encryption.ClearOrEncryptedService(service)
encryption.encrypt("password")
encryption.decrypt("{AES}abc/pH/mQ3wVaSzk+2U8weGH6LVCcRteFh24PCqnoY=")




(B)Encrypt or Decrypt  weblogic AES password using Java
Jar needed –
            $WL_HOME/server/lib/wlfullclient.jar
            $WL_HOME/server/lib/cryptoj.jar

Create a new folder 'C:\\weblogic_file' and put 'SerializedSystemIni.dat' file from $DOMAIN/security

import weblogic.security.internal.SerializedSystemIni;
import weblogic.security.internal.encryption.ClearOrEncryptedService;
import weblogic.security.internal.encryption.EncryptionService;

public class EncryptDecrypt {

       public static void main(String[] args) {

        EncryptionService encryptionService = SerializedSystemIni.getEncryptionService("C:\\weblogic_file");
        ClearOrEncryptedService clearOrEncryptedService = new ClearOrEncryptedService(encryptionService);

System.out.println("Encrypted password: " + clearOrEncryptedService.encrypt("password"));

System.out.println("Clear text password: " + clearOrEncryptedService.decrypt("{AES}abc/pH/mQ3wVaSzk+2U8weGH6LVCcRteFh24PCqnoY="));
       }
}

No comments:

Post a Comment