The password
encryption in the global variable level is done by adding the variable in the
GV by editing the GV and typing a value for it and setting the data type as
‘Password’.
This will do the encryption of the password and makes it as masked password (visible as Asterisk (****)).
By doing this we can secure the password information’s from the users.
In case we need to decrypt the password, then we need to follow the below steps.
Step 1: If this example, GV named
'pwdtest' and its data type is Password ,So then its value displays as
Asterisk only.
Step 2: create a business process in
designer and drop the Java Code Activity. Define an output parameter in the
configuration tab and update the below code in it.
String password = com.tibco.pe.plugin.PluginProperties.getProperty("tibco.clientVar.pwdtest");
out=password;
out=password;
If you have
a tree structure where the password is mentioned,
then update the code as,
String
password = com.tibco.pe.plugin.PluginProperties.getProperty("tibco.clientVar.CONNECTION/HTTP/Host");
out=password;
Step 3: save and compile the JAVA code.
Step 4: run this process we can get the
decrypted password value in Output parameter.
TEST Result:
JAVA code with full class:
package test;
import java.util.*;
import java.io.*;
import com.tibco.security.ObfuscationEngine;
import com.tibco.*;
public class testJavaCode{
/****** START SET/GET METHOD, DO NOT MODIFY *****/
protected String out = "";
public String getout() {
return out;
}
public void setout(String val) {
out = val;
}
/****** END SET/GET METHOD, DO NOT MODIFY *****/
public testJavaCode() {
}
public void invoke() throws Exception {
/* Available Variables: DO NOT MODIFY
Out : String out
* Available Variables: DO NOT MODIFY *****/
String password = com.tibco.pe.plugin.PluginProperties.getProperty("tibco.clientVar.pwdtest");
out=password;
import java.util.*;
import java.io.*;
import com.tibco.security.ObfuscationEngine;
import com.tibco.*;
public class testJavaCode{
/****** START SET/GET METHOD, DO NOT MODIFY *****/
protected String out = "";
public String getout() {
return out;
}
public void setout(String val) {
out = val;
}
/****** END SET/GET METHOD, DO NOT MODIFY *****/
public testJavaCode() {
}
public void invoke() throws Exception {
/* Available Variables: DO NOT MODIFY
Out : String out
* Available Variables: DO NOT MODIFY *****/
String password = com.tibco.pe.plugin.PluginProperties.getProperty("tibco.clientVar.pwdtest");
out=password;
}
}
}
Thank you! This helps!
ReplyDelete