Prerequisites:
Set below environment variables with proper values/paths, which are required to run utility.Note: These variables configured as per my local environment and you need make changes according to your environment. Please make sure configured these variables on box having OIM installed.
- export JAVA_HOME=/usr/local/jdk24/jdk1.6.0_24
- export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/pandharinath.mahalle/bin:$JAVA_HOME/bin
- export MW_HOME=/home/oracle/Middleware
- export WL_HOME=$MW_HOME/wlserver_10.3
- export ORACLE_COMMON_HOME=$MW_HOME/oracle_common
- export ORACLE_OIM_HOME=$MW_HOME/Oracle_IDM1
- export DOMAIN_HOME=/home/oracle/Middleware/user_projects/domains/base_domain
- export CLASSPATH=$ORACLE_OIM_HOME/server/platform/iam-platform-utils.jar:$WL_HOME/server/lib/wlfullclient.jar:$ORACLE_OIM_HOME/designconsole/ext/spring.jar:$ORACLE_OIM_HOME/designconsole/lib/oimclient.jar:$ORACLE_OIM_HOME/designconsole/ext/commons-logging.jar:$ORACLE_COMMON_HOME/modules/oracle.jrf_11.1.1/*:$ORACLE_OIM_HOME/modules/oracle.jps_11.1.1/*:$ORACLE_OIM_HOME/modules/*:$ORACLE_COMMON_HOME/modules/oracle.osdt_11.1.1/*:$ORACLE_OIM_HOME/modules/oracle.iau_11.1.1/*:$ORACLE_OIM_HOME/inventory/Scripts/ext/jlib/glassfish.jaxb_1.0.0.0_2-1-12.jar:$CLASSPATH
Decryption Utility:
1. Create DecryptPassword.java file on linux box having OIM installed and configured above env variables.
2. Write below code in it.
import com.thortech.xl.crypto.*;
public class
DecryptPassword {
public static void
main(String[] args) throws Exception {
if(args.length >=
1){
DecryptPassword
oDecryptPwd = new DecryptPassword();
String
param = args[0];
System.out.println("Password
after decryption:" +oDecryptPwd.getDecryptedPassword(param));
}
}
public String
getDecryptedPassword(String encryptedPwd) throws tcCryptoException{
String decryptedPwd =
tcCryptoUtil.decrypt(encryptedPwd,"DBSecretKey");
return decryptedPwd;
}
}
|
javac DecryptPassword.java
4. Run it using below command.
java -Doracle.security.jps.config=$DOMAIN_HOME/config/fmwconfig/jps-config.xml -DDOMAIN_HOME=$DOMAIN_HOME DecryptPassword 8650:OIuWk+mYHr6dCNKJfcbl4f9dfK6WidqzaSY47d21oh8=
Sample Input/Output:
Input : 8650:OIuWk+mYHr6dCNKJfcbl4f9dfK6WidqzaSY47d21oh8=
Output : Welcome@123654
Encryption Utility:
1. Create EncryptPassword.java file on linux box having OIM installed and configured above env variables.
2. Write below code in it.
import com.thortech.xl.crypto.*;
public class EncryptPassword {
public static void
main(String[] args) throws Exception {
if(args.length >=
1){
EncryptPassword
oEncryptPwd = new EncryptPassword();
String param = args[0];
System.out.println("Password after
encryption: "+oEncryptPwd.getEncryptedPassword(param));
}
}
public String
getEncryptedPassword(String decryptedPwd) throws tcCryptoException{
String encryptedPwd=
tcCryptoUtil.encrypt(decryptedPwd,"DBSecretKey");
return encryptedPwd;
}
}
|
3. Compile it using below command.
javac EncryptPassword.java4. Run it using below command.
java -Doracle.security.jps.config=$DOMAIN_HOME/config/fmwconfig/jps-config.xml -DDOMAIN_HOME=$DOMAIN_HOME EncryptPassword Welcome@123
Sample Input/Output:
Input : Welcome@123654
Output : 1164:4OQStpGN4yYTIkOzTcuIbrMx/rZwD6YoW2AcE5O6Vo4=