This discussion is archived
2 Replies Latest reply: Nov 13, 2013 1:55 AM by PuneetRekhade RSS

How to encrypt file on linux using Gnupg command in Java Embedding in BPEL.

Shah Explorer
Currently Being Moderated

Hi All,

 

I am trying to invoke a command script using the java embedding in BPEL Process.I am using the below code to execute the particular command to encrypt the file :-

 

try {    

        Runtime rt = Runtime.getRuntime();    

     

Process pr = rt.exec(new String[] {"/bin/bash", "-c", "/u01/GnuPG/bin/gpg", "-e", "-r", "Developer","/u01/oracle/ConfigFiles/Adapter_controlDir/abc.csv"});    

         int exitVal = pr.waitFor();            

        String result = "SUCCESS: Process exit with " + exitVal;         

        addAuditTrailEntry("result = "+result);      

        setVariableData("outputVariable","payload","/client:processResponse/client:result",result);    

     

} catch(Exception e) {    

   

        e.printStackTrace();      

  String result = "FAILURE: Exception with " + e.toString();    

        addAuditTrailEntry("result = "+result);      

        setVariableData("outputVariable","payload","/client:processResponse/client:result",result);    

           

}

 

The above statement does nothing. I am not sure what command i need to use to access to the command line.

 

When i try this particular statement from linux machine command prompt :- /u01/GnuPG/bin/gpg -e  -r  Developer /u01/oracle/ConfigFiles/Adapter_controlDir/abc.csv

It works absolutely fine and it creates the encrypted files also.

 

Please suggest , which command i need to use from the java embedding.

 

 

Please suggest!!

 

Regards,

Shah

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points