cancel
Showing results for 
Search instead for 
Did you mean: 

Encryption in PI using java binary file(.jar) file

Former Member
0 Kudos

Hi Experts,

My scenario is file to file PI 7.31 SP11 and I am using only ID objects no ESR objects but the challenge is encryption using java binary file(.jar) file.

The file gets generated by sender SAP R3 system and places it in a shared folder and PI picks it and pushes to FTP after encrypting. But the client provides encryption utility in the form of java binary file(.jar) file and we need to call the jar file once the payment file is generated from their erp in order to encrypt the payment files. Please guide.


Thanks,

Nithin.

Accepted Solutions (1)

Accepted Solutions (1)

vadimklimov
Active Contributor
0 Kudos

Hi Nithin,

If the provided encryption utility is executable JAR file, you can call it by means of external OS command execution after message processing in File adapter (refer to Defining Operating System Commands Before/After Processing - Advanced Adapter Engine - SAP Library) in order to encrypt the file produced by FTP receiver communication channel.

Regards,

Vadim

Former Member
0 Kudos

Hi Vadim,Experts,

PI is running on Linux, can you pls help on script to call JAR file (that is given by receiver) & push them to other directory. Also "Command Line" that should be specified in receiver channel config. Here I would like to achieve this by two steps. 1. NFS(Shared folder) -> NFS (local PI folder)  2. NFS (local PI server) -> FTP

As soon the receiver channel in step 1 pushes each file then OS command should be executed once to call JAR File to encrypt that file and push/copy to other folder. I believe that this process will be executed to all the files. In step 2 all the files will be picked up from local PI directory to FTP.

Thanks,

Nithin.

vadimklimov
Active Contributor
0 Kudos

Hi Nithin,

Here, I see you aim to execute several commands (encrypt file and then move file to another location). Having this in mind, it shall be convenient to develop a Linux script (for example, a bash script considering an OS your PI system runs) and call it from File/FTP receiver communication channel.

The first step is to prepare a script. I'm not aware of encryption library that you use, so it is not possible to provide you complete script code. But I'm sure you may work this out with the help of encryption library vendor / documentation and your colleagues responsible for Linux administration. The executable JAR file can be called using command java (a part of JRE) with argument -jar. As an outcome of this exercise, you shall get an executable script that calls encryption library for the file produced by PI, and then moves it to another location (NFS directory or FTP server). In receiver communication channel, you can use placeholder %f (file name) or %F (absolute file name - which is, file path and file name) when specifying the called OS command - so that the file name is passed as an argument to a called script, and script uses it when applying required actions to the file.

You can test if script works as expected from OS level, but placing a sample file (as if it would be produced by PI) and running a script with corresponding arguments from a shell.

After a script is ready, place it in a location that is accessible for PI application servers (or right on PI application servers).

In File/FTP receiver communication channel in PI, specify the same command that you used when testing a script, only adjusting file name argument (by replacing it with the placeholder) and specifying valid location of a script.

One important notice: since a file that is produced by PI, needs to be accessed, and considering the fact that File/FTP adapter triggers a calls of an OS command as a part of its execution, it may be the case that File/FTP adapter hasn't flushed corresponding file stream and closed it, so the file may not be available for the external program (e.g. OS commands) at a time of a script call (even in cases when a script is called after message processing) and a script will issue an error. If you observe this, as a workaround, you may want to put an explicit wait step right at the beginning of a Linux script so that at at time when script starts actual file processing (after wait), file receiver communication channel already completes its work and produces the file.

Regards,

Vadim

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vadim,

Thanks a ton for your prompt response!

The client has given us a JAR file say if it is placed in some physical path, then I could call the JAR file by giving full path of the file including file name and could encrypt a file manually and generate it in the same folder where actual file is placed with file name starting with alphabet "e" followed by actual file name. But pls suggest to achieve it automatically using command line feature in SAP PI?

I could encrypt manually by using the command highlighted here in cmd  " Java –jar  <<name of the jar file>>.jar  <<full path of the file>> ". So how to do the same using PI command line feature? Please suggest. Please find the below snippet on the same.


Thanks,

Nithin.

nitindeshpande
Active Contributor
0 Kudos

Hello Nithin,

You need to put this in a script and then run the script from your File channel, by providing the command in your File channel.

Please find the below wiki on how to execute the command in your file channel. As your OS is UNIX, please go through the last part of the WIKI.

SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki

Regards,

Nitin

Former Member
0 Kudos

Hi Nitin,

Thanks for your prompt reply, our PI OS is Linux not UNIX, can you please help me on building the script and then example syntax to be used in command line feature in receiver or sender channel?

Thanks,

Nithin.

nitindeshpande
Active Contributor
0 Kudos

Hello Nithin,

Please create a .sh file with the command mentioned in your reply and provide the below command in your File channel.

sh <<file path of your shell script (.sh) file>>

Sorry i am not Unix/Linux expert, but this is the thing i can help with.

Regards,

Nitin

Former Member
0 Kudos

Hi Vadim, Experts,

Below diagram shows the overall flow:

My question is whether the encryption done in PI is recommendable here since the unencrypted file is picked up by PI and then later it should be encrypted? or should I suggest ABAP team to encrypt it using Java binary file and later PI can pick this and place it in Intermediate server.

Thanks,

Nithin.

vadimklimov
Active Contributor
0 Kudos

Hi Nithin,


I would suggest verifying with ECC functional team and security team if they have any specific security requirements for this interface, but if both ECC and PI are located in secured network (intranet) and access to an ECC folder to which ECC generates files and PI polls them is strictly limited, then commonly payment data is generated by ECC as it is (without encryption), and encryption is done by PI.

Regards,

Vadim

Former Member
0 Kudos

Hi Vadim,

Thanks a ton for your indispensable inputs! I need to explore on Linux script.

Rdgs,

Nithin.