× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,
        I have a java method I am writing to use from within RPG for
encrypting some data. I need to pass it a byte array containing the data
to encrypt, and three more byte arrays containing the keys to use for
encryption. The method will return a byte array containing the encrypted
data.

        I have done plenty with passing strings with no problems. I can
even call this method passing it data and getting it back, no errors. My
concern is the EBCDIC => ASCII => EBCDIC conversion that is taking
place.

        First of all... here is my prototype definition in my RPG
program:

D j_Method        PR            32A   EXTPROC(*JAVA :            
D                                     'com.foo.bar.Encryptinate' :
D                                     'encrypt')                 
D                               32A   Varying                    
D                                8A   Varying                    
D                                8A   Varying                    
D                                8A   Varying                    

So, I am using the varying length string method for passing the byte
arrays to my java method.

The problem is... I don't want the ASCII conversion to take place. I
need all this to just use the raw data as is. 

I was thinking that I needed to go and do something like create a few
integer arrays to pass the data in... something like:

D test            S              3I 0 DIM(32)

Since in the ILE RPG Programmer's Guide it says it won't perform the
conversion when Java data is moved to and from a 3I field. That's all
fine and dandy, but that just seems like it will end up being a little
ugly. I was wondering if any of you knew of a cleaner way to handle a
situation like this?

I was looking at using the JNI directly rather than RPG *JAVA
Prototypes, but I haven't found much information about it just yet...
the Programmer's guide just briefly mentions it and then moves on. Have
any of you tried it? If so, can you point me to some good info on it?

I'm just looking for some general recommendations. Thanks for any input.

Dan Feather


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.