cancel
Showing results for 
Search instead for 
Did you mean: 

Regd. File Encription:How to reusing code written in C#

Former Member
0 Kudos

Hi Experts!

We have a 3rd party which uses an encription method which is based on C#, in PI need to use the same encription methods as they are not willing to change their part of code.

So to encript file which PI is posting to this 3rd party, i am looking for the ways to implement this.Based on my findings, there is a a tool called JNI which can be used to convert the C# code to java or use the dll , and uses a java code.Really its a very vauge understanding and i dont have any clue on how to go about it.

Can anyone suggest the possible approaches to encript and decript ?

Thanks ...

Reagards,

Srinivas.

Accepted Solutions (1)

Accepted Solutions (1)

former_member206760
Active Contributor
0 Kudos

suppose you want to encrypt a file and send it to the 3rd party

you can develop a shell script ( if XI server is based on unix ) and inside thet shell script you can have that C# program to encrupt the file.

you can call this shell script in the receiver file adapter.

same may be done on the sender file adapter for decrypting

Answers (2)

Answers (2)

Former Member
0 Kudos

The solution was to have a java code which calls the C# Dll and using JNI

prateek
Active Contributor
0 Kudos

Using a script as suggested would be a good option for your requirement. If the server is windows based, create a batch file and if it is unix based, go for shell script. Then you may execute is before or after message processing as per your requirement.

Regards,

Prateek

Former Member
0 Kudos

Thanks alot pratik and taran,

I have not worked on batch files earlier, so have some Queries:

1. Is it secure enough to use batch files appraoch , mine is a bank interface.Are there any precautions or any limitations to be considered when usign this approach with FTP receiver/sender adapter.

2. Can you please give me some idea on how to call a dll written in C# from a batch file.

My understanding is : I will put the dll in PI server at any location, for encription ,in receiver FTP channel i will call a this batch file, which in tern will send data as a stream to this batch program , inside batch the C# dll code will encript the file content and output the encripted data , which will be send to third party.

3. Do i need to explicitly define the file name in batch program.I am using a dynamic file name using dynamic configuration.Will there be any problem using both.

please give me some sample code,if you have seen any .i have not worked on this earlier, it will be very helpful

Thanks ..

Srinivas.

Edited by: Srinivas on Feb 8, 2010 12:20 PM

Former Member
0 Kudos

Hi ,

I am able to get the encriptionmanger.dll (in C#) and

we have created a wrapper class in C++ and called the C# dll in that .

Now we have C++ dll, we have written a java JNI code to call the C++ DLL which inturn calls the C# and gets our data encrypted. It works fine:)...

But now the real PI job starts ,

I have two option ..i guess

either use the JNI code in a adapter module or use java mapping..

Please suggest which one is good and how to do it .. if anyone has done it..

the flow which i expalained is working file in Java IDE with local file reference(for storing the dll's)

thanks and Regards,

srinivas