× 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.



I am attempting to use the Qc3DecryptData API to decrypt a value that has
been encrypted in Triple DES in Java.

The encryption uses the transformation DESede/CBC/PKCS5Padding - but I am
having difficulty recreating the necessary settings in RPG to decrypt the
value.

In order to try and match these settings I have specified the algorithm
(QC3BCA) = 21 for Triple DES, block length (QC3BL) = 8 for Triple DES,
Mode (QC3MODE) = '1' for CBC and I have set the pad option (QC3PO) = '2'
(as the documentation for the encryption API states that this is
equivalent to PKCS # 5 padding) however the value that is returned when I
test this is not the expected plain text string.

The Java code outputs a base 64 encoded string - to test the decryption
process I am decoding an example encrypted value and then converting this
to a hexadecimal literal in that is passed in to the API for decryption. I
have tried converting the ASCII value of the decoded string to EBCDIC and
neither works...

When I try and encrypt an identical value the result is different from
that generated in Java (both as a string and as hex values).

The encryption key and initialization vector values are identical between
the two processes (albeit as a byte array in java and a hex literal in the
RPG (at present for test purposes)).

Does anyone have any experience in using this API decrypting code that has
been encrypted using the above transformation? Is it possible?

Regards,
Stuart Bramley

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.