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



Tyr using this instead of the API

/free

If Function = 'ENCRYPT';
EXEC SQL SET :ResultVarying = ENCRYPT_TDES(:InputVarying, :pw);
Endif;

If Function = 'DECRYPT';
EXEC SQL SET :ResultVarying = DECRYPT_CHAR(
cast(:InputVarying as char(5000) for bit data), :pw);
Endif;

/end-free

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of sbramley@xxxxxxxxx
Sent: Wednesday, July 02, 2008 8:18 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Decrypting Triple DES

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
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.