Friday, March 7

decrypt/encrypt password on WLS

1. You can use the below command to encrypt the passwords

source $DOMAIN_HOME/bin/setDomainEnv.sh
java weblogic.security.Encrypt password
Above command will give you the encrypted password which can be used on the files.

2. Try the below scripts and steps ,save the below lines as decrypt.py file

import os
import weblogic.security.internal.SerializedSystemIni
import weblogic.security.internal.encryption.ClearOrEncryptedService

def decrypt(domainHomeName, encryptedPwd):
domainHomeAbsolutePath = os.path.abspath(domainHomeName)
encryptionService = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainHomeAbsolutePath)
ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptionService)
clear = ces.decrypt(encryptedPwd)
print "Decrypted Password:" + clear

try:
if len(sys.argv) == 3:
decrypt(sys.argv[1], sys.argv[2])
else:
print "INVALID ARGUMENTS"
print " Usage: java weblogic.WLST decryptPassword.py <;DOMAIN_HOME> <;ENCRYPTED_PASSWORD>"
print " Example:"
print "java weblogic.WLST decryptPassword.py <;domain_path> <;encrypted password>"
except:
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()
raise

(ii). Set the env by using the below command
source $DOMAIN_HOME/setDomainEnv.sh

(iii). Take the password encrypted values from $DOAMIN_HOME/servers/AdminServer/security/boot.properties

(iv) . Run the script using below,


Thanks to Maheshkumar Subbaiyan  ..

No comments:

Post a Comment