Saturday, September 17, 2016

How to Decrypt Global Variable value of type Password in TIBCO BW Designer


      While implementing project in TIBCO Designer, As a best practice and to maintain security we usually declare the password global variable fields are of type "Password" as shown below. So we can't able to view the actual value defined for that global variable field during both design time (i.e. in TIBCO Designer) and as well as runtime(i.e. in TIBCO Administrator).

But we can decrypt the global variable password field value in two ways :

Example : 1) Decrypt by using encrypted password field value from backend GV's file

STEP -1 : Declare a global variable field of type "Password". (For this example we consider the field name as Password)

STEP -2 : Define a BW process and drag the Java code activity into design panel and create transition between start, Java code and End activities i.e start --> Javacode --> End

and write the below two lines of Java code in your java code activity(as shown in below diagrams) which uses one input parameter to provide encrypted password i.e. Encrypted_Password and one output parameter to capture decrypted password i.e Decrypted_Password

import com.tibco.security.ObfuscationEngine;
Decrypted_Password = new String(ObfuscationEngine.decrypt(Encrypted_Password));

STEP -3 : Compile the java code and Test the process by providing encrypted password and you will finally receive the decrypt password field value as java code activity output parameter value.


Example : 2) Decrypt it by directly providing global variable password field as input to Java code

STEP -1 : Declare a global variable field of type "Password". (For this example we consider the field name as Password)

STEP -2 : Define a BW process and drag the Java code activity into design panel and create transition between start, Java code and End activities i.e start --> Javacode --> End

and write the below one line Java code in your java code activity(as shown in below diagrams) which uses one input parameter to provide GV password field i.e. Encrypted_Password and one output parameter to capture decrypted password i.e Decrypted_Password

Decrypted_Password = com.tibco.pe.plugin.PluginProperties.getProperty(Encrypted_Password);

STEP -3 : Compile the java code and Test the process by providing global variable filed of type "Password" and you receive the decrypt password field value as java code activity output parameter value.

This ends the post. Have A Nice Day ... BYE !!!



2 comments:

back to top