× 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 just corrected my code and able to find encodedexchange token value with
below code:-

**free
dcl-s encodedExchangeToken varchar(88);
XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/INPUT.+
xml':'doc=file case=any path=+
TokenExchangeResponse/encodedExchangeToken');
*inLr = *on;


But the problem is now I want to use this encodedExchangeToken in below
RPGLE program to decrypt it using AES128 algorithm.
which works well when i interactively execute this command like below and
gives me blow highlighted result:-

echo
'u3VtNgfyWU9faZc3Iaa8ZWbE5UZCfmC17yA4MyW0ghflt9dNQNDpCcgMZiG/kXPE4vv2CHL
93B4iKiODHxxdVA==' | openssl enc -d -aes-128-ecb -K
363631653237354f494d31554
c594c4a -nopad -nosalt -base64 -A

707fbe32-0dbc-41e0-888f-5bc40de8c20d2P9AMPCTQ4CZ ¢


But when I am trying to use the same command in below RPGLE program my
program ends up in multiple errors:-

0001.00 **free
0002.00 dcl-s encodedExchangeToken varchar(88);
0003.00 dcl-s string char(45);
0004.00 FUNIX IF F 1000 SPECIAL PGMNAME('UNIXCMD')
0005.00 F PLIST(UNIXPARM) USROPN
0006.00 FQSYSPRT O F 132 PRINTER
0007.00
0008.00 Dcmd s 5000a
0009.00 D mode s 1A inz('P')
0010.00
0011.00 D record ds 1000
0012.00 D outrec ds 132
0013.00
0014.00 C UNIXPARM PLIST
0015.00 C PARM CMD
0016.00 C PARM MODE
0017.00 XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/INPUT.+
0018.00 xml':'doc=file case=any path=+
0019.00 TokenExchangeResponse/encodedExchangeToken');
0020.00 cmd = 'encodedExchangeToken'| openssl enc -d -aes-+
0021.00 128-ecb -d -aes-128-ecb-k 363631653237354f494d31554c594c4+
0022.00 a -nopad -nosalt -base64 -A -OUT string.txt
0023.00 read UNIX record;
0024.00 dow not %eof(UNIX);
0025.00 outrec = record;
0026.00 write QSYSPRT outrec;
0027.00 read UNIX record;
0028.00 enddo;
0029.00
0030.00 close UNIX;
0031.00 *inlr = *on;
0032.00 /end-free
****************** End of data ***********************************


On Thu, Oct 31, 2019 at 10:49 AM Rishi Seth <rishiseth99@xxxxxxxxx> wrote:

..also length of encoded token exchange field could vary but currently i
am just testing for this 'encodedtokenexchange' value as pasted in input
xml file in my previous email like "

*u3VtNgfyWU9faZc3Iaa8ZWbE5UZCfmC17yA4MyW0ghflt9dNQNDpCcgMZiG/kXPE4vv2CHL93B4iKiODHxxdVA==*
"

On Thu, Oct 31, 2019 at 10:45 AM Rishi Seth <rishiseth99@xxxxxxxxx> wrote:

As advised ,coded like below to extract that '*encodedExchangeToken*'
value but it's ending up in multiple compilation errors like as shown in
below screen shot:

[image: image.png]

[image: image.png]


On Wed, Oct 30, 2019 at 3:20 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:

In response to question on Midrange-L as requested by David

This code will extract the value you want if that is the only field
required. I coded it as varchar based on the OP's original subject line but
in the text he said that he wanted to extract a fixed length entry so I'm
confused. char or march - either will work.

dcl-s encodedExchangeToken varchar(50);
// end-ds;
//
xml-into encodedExchangeToken
%xml('/home/paris/xmlstuff/samplexml.xml': 'doc=file case=any -
path=TokenExchangeResponse/encodedExchangeToken');
dsply encodedExchangeToken;

*InLr = *On;


Jon Paris
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



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.