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



Hi Everyone,

Currently I have a scenario like Java will encrypt an image using
DES/CBC/PKCS5Padding with an 8 character length Key and IV they were using
in an array of data like IVBytesJpg = new byte[]{44, 140, (byte)146, 35,
26,(byte) 149, (byte)136, 150 } and store the encrypted image into an
Windows Share Drive (/WindosIP/Shared Drive/Image File).

I am accessing the Windows share drive from iSeries and decrypting the
image and exposing the image in base64 format in REST API.

To achieve this I am using the below steps

Step 1: Fetch the encrypted image from Windows Share drive using the below
code in rpgle (using QNTC)

dcl-s Wrk_WindowsImage sqltype(clob_file);
dcl-s Wrk_Image sqltype(clob:500000);

Wrk_WindowsImage_FO = SQFRD;
Wrk_WindowsImage_Name = /QNTC/WindosIP/Shared Drive/Image File
Wrk_WindowsImage_NL = %len(%trimr(Wrk_WindowsImage_Name));
exec sql values :Wrk_WindowsImage into :Wrk_Image;

This way I can fetch the encrypted image from Windows Share drive into an
CLOB variable

Step 2: Decrypt the Image

Using the IBMi API Qc3DecryptData and Algorithm Format as ALGD0200 and Key
Format as KEYD0200

In the algorithm ALGD0200, I am not sure how to use PKCS5Padding, So I am
just using the Pad option QC3PO as '0' (Do not remove padding).

I am not sure how can I use the array of data (IVBytesJpg = new byte[]{44,
140, (byte)146, 35, 26,(byte) 149, (byte)136, 150 }) as input for IV, if
someone shed some light it would be great.

Step 3: Convert the image into Base64 format
Convert the decrypted value in Base64 format. For this I am planning to use
Scott Klements Base64 utility (https://www.scottklement.com/base64/)

Could you please help me out in how to use the PKCS5Padding and array of
data as IV in Qc3DecryptData API?

Regards,
Suren

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.