How to use encoded password in ODI SDK

How to use encoded password in ODI SDK:

Today I am going to share very interesting thing 😀 . I was struggling a lot to get the work around on this issue. Searched a lot over internet and didn’t get any solution.

Finally I found something that helps to an extent. I would like to give special thanks my friend Tina for her helping hand. Take a look on below code snippet. You can clearly see I have hardcoded the master repository password. Is there any ODI Admin who is going to provide the master repository credentials?? I know everyone will deny due to security issues.


package odi_sdk;
import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.security.Authentication;
import oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker;
import oracle.odi.domain.runtime.variable.finder.IOdiVariableValueFinder;
import oracle.odi.runtime.agent.invocation.StartupParams;
import oracle.odi.domain.runtime.variable.OdiVariableValue;
import oracle.odi.domain.runtime.variable.OdiVariableValueHistory;
import java.util.HashMap;
import java.util.Map;

public class InvokeScen {
public static void main(String[] args) {
String getDate="";
for(int i=0; i < args.length; i++){
getDate= args[i];
}
String Url = "jdbc:oracle:thin:@localhost:1521:xe";
String Driver="oracle.jdbc.OracleDriver";
String Master_User="odimaster";
String Master_Pass="odi";
String WorkRep="DEV_WORK";
String Odi_User="SUPERVISOR";
String Odi_Pass="SUNOPSIS";
String TEST_VARIABLE2="PRO_SDK_TEST.TEST_VARIABLE2";
String TEST_VARIABLE1="PRO_SDK_TEST.TEST_VARIABLE1";

Mapmap = new HashMap();
map.put(TEST_VARIABLE2, getDate);
StartupParams sp=new StartupParams(map);

MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,Master_Pass.toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
.............................
.............................
.............................

So lets try to use encoded password. I am sure this encoded password can be shared by odi admins as they are not going to share the actual passwords. Have a look on below bold lines.


package odi_sdk;

import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.security.Authentication;
import oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker;
import oracle.odi.domain.runtime.variable.finder.IOdiVariableValueFinder;
import oracle.odi.runtime.agent.invocation.StartupParams;
import oracle.odi.domain.runtime.variable.OdiVariableValue;
import oracle.odi.domain.runtime.variable.OdiVariableValueHistory;
import java.util.HashMap;
import java.util.Map;

import com.sunopsis.dwg.DwgObject;

public class InvokeScen {
public static void main(String[] args) {
String getDate="";
for(int i=0; i < args.length; i++){
getDate= args[i];
}
String Url = "jdbc:oracle:thin:@LOCALHOST:1521:XE";
String Driver="oracle.jdbc.OracleDriver";
String Master_User="ODIMASTER";
String Master_Pass="bQya,MIF5V,op0hn84BRC0g";
String WorkRep="DEV_WORK";
String Odi_User="SUPERVISOR";
String Odi_Pass="SUNOPSIS";
String TEST_VARIABLE2="PRO_SDK_TEST.TEST_VARIABLE2";
String TEST_VARIABLE1="PRO_SDK_TEST.TEST_VARIABLE1";

Mapmap = new HashMap();
map.put(TEST_VARIABLE2, getDate);
StartupParams sp=new StartupParams(map);
DwgObject dg=new DwgObject() {

@Override
public String getObjectLocation() {
// TODO Auto-generated method stub
return null;
}
};
@SuppressWarnings("deprecation")
MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,dg.snpsDecypher(Master_Pass).toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
....................
....................
....................

You are now good to go. Actually ODI SDK is very flexible and dynamic in nature. You just need to have little idea on java basics and then dig out to explore new things. Obviously limited to the given API by Oracle.

Okay so far so good. But here we will encounter another problem. The above passoword can be easily decoded by using the decypher method. 😀

System.out.println(dg.snpsDecypher(Master_Pass).toCharArray());

Now you might be thinking what is the use this encoded password then. 😉  Any java developer can print it easily.

Waiting for your comments.
That’s all for today 🙂

About Bhabani 86 Articles
Bhabani has 10 plus years of experience in Data warehousing and Analytics projects that has span across multiple domains like Travel, Banking and Financial, Betting and Gaming Industries. Solution areas he focuses on designing the data warehouse and integrating it with cloud platforms like AWS or GCP. He is also a Elite level contributor at OTN forum more than 9 years. He loves to do experiment and POC on different integration tools and services. Some of his favorite skills are Redshift, Big Query, Python, Apache Airflow, Kafka, HDFS, Map Reduce ,HIVE, Habse, Sqoop, Drill, Impala.

20 Comments

  1. you know, the encoded password is written in plain text, if hacker get the file, but he/she does not know the algorithm ,maybe MD5, DES,etc. so he/she may spend some time to decode it, maybe fail finally.
    even he/she choose to decompile java class, the class maybe have be obfuscated, so cannot decompile.

    so it might means I should not tell the API to decode it, right? 🙂

  2. Yeah right, if there wouldn’t have any such security then people might not have gone for oracle product. But I am still digging on ODI SDK and trying to explore as much as I can. Lets see what is the next stop.

    • I am not able to use encoded password for odiuser(SUPERVISOR);
      Is there any way to do this encoded password for SUPERVISOR.
      Regds,
      Aniket

  3. Hi Bhabani,
    Can you please provide the full code to invoke scenario in eclipse? I have certain codes but that relates to 10g.I am fine with hardcoded password 😀 .Its urgent.

  4. How can i configure sdk in my system. When I installed ODI i had checked the option SDK. Now what should I do to use sdk. I am new to ODI. I got your blog from otnforum. Thnkas.

  5. Hey, can you post all codes here? I am not able to invoke all scenarios via SDK..Is it necessary to have eclipse to run SDK programs ?? Also I am getting error while creating the instance.Please help.

    • So it is printing null ? Can you try to print the inner part 1st that is
      System.out.println(DwgObject.snpsEncode(“oracle”))
      Is it printing the encoded value ?

      Let me know. Thanks

      • here’s my test code,if i run it,my console was in running state,and there is no output,i dont’t no why?
        import com.sunopsis.dwg.DwgObject;
        public class test {

        public static void main(String[] args) {
        System.out.println(DwgObject.snpsDecypher(DwgObject.snpsEncode(“oracle”)));
        }
        }

        • Try this
          import com.sunopsis.dwg.DwgObject;
          public class test {

          @SuppressWarnings(“deprecation”)
          public static void main(String[] args) {
          String pPass=”Oracle”;
          System.out.println(DwgObject.snpsEncode(pPass));
          }
          }

          It should work. If still not working then compile and run the same in command prompt.

          • yes it work,print:”ccfpWomP.AZP6fFoRrsMP8R5Hg”
            but i want to decode “ccfpWomP.AZP6fFoRrsMP8R5Hg” to “Oracle”

          • Yes it is working aswell.

            import com.sunopsis.dwg.DwgObject;
            public class test {

            @SuppressWarnings(“deprecation”)
            public static void main(String[] args) {
            String pPass=”Oracle”;
            System.out.println(DwgObject.snpsDecypher(DwgObject.snpsEncode(pPass)));
            }
            }

          • Hi Bhabani,

            We should also have odiEncode and odiDecypher for these functions too, right?

            In that case the deprecated function directive to the compiler may not be needed.

            Thanks.
            AK.

  6. Hello,

    I’m trying to make this example because I have the master repository password encoded.

    I copied the script, but I have a problem with the next code line:

    MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,dg.snpsDecypher(Master_Pass).toCharArray(), new PoolingAttributes());

    It seems that snpsDecypher needs another param (type OdiInstance), but I don’t have any OdiInstance until I could connect getting the MasterRepositoryDbInfo object.

    Could you help me in any way?
    Thank you very much

    • Hello,

      I have the same issu, to get an OdiInstance you have to connect to the Master repository, to do that you have to decode the master password first using this function snpsDecypher .
      I n ODI 12 C, the function needs an instance ODI as argument, so there is a Circular dependency.

  7. Hi Guys,

    As this is bit urgent for me, can anyone here help me with decoding the ODI supervisor password “DfncipogDsofYIEQ51fofA==” (“password”) and share the output on my mail id gaurav.dhoble@outlook.com. Immediate help would be quite helpful. thanks in advance.

    Regards,
    Gaurav

Leave a Reply

Your email address will not be published.


*