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

but i was referring scott klement\s unix program to pass commands in it in
pase so here passed this token value in openssl command in a programmatic
way but i am not sure how can i declare this ploist in free format code so
that imy program could compile properly and i should be able to see
decrypted value of encrypted token exchange from my input xml file
main thing what i am trying to do is below steps>/

1) read input xml file which i shard in my previous emails.
2) search for encoded token exchange value in it'
3) after finding encoded token exchange value i want to pass it to openssl
command which should be able to decrypt it the same way the way it works in
pase after calling call qsys/qp2term and then executing this command
interartively it gives mt dectrpted value of encoded token using aes128
algorithm.
please see below:-

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

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

above commands work very well and ives me decrypted value of encoded token
using aes 128 algorithm so same functionality i want to achieve in a
programmatic way.

4) so once i am able to get this value(decrypted value of encodedtoken
exchange) i want to write it in to another xml file's file field which i
say output xml file but as i have been unsuccessful achieving above 3rd
step itself so currently not focusing on writing xml portion.

so to achieve these i just wrote this sample program but i know it has many
basic declaration errors etc. but if some expert could guide me where i am
wrong and how to correct then it would be much helpful.

Thanks

On Thu, Oct 31, 2019 at 7:04 PM Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>
wrote:

Jim is correct. There are so many basic things wrong with the code that I
doubt anyone on the list is going to go very far in helping you. I think
you need to review the basics again. Before it goes away this is a good
place to walk through free format coding.
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/We13116a562db_467e_bcd4_882013aec57a/page/Coding%20in%20Free-Form%20RPG%20IV%20-%20a%20beginner's%20tutorial

Just as a quick start, both of the DCL-F's are wrong. You have DCL-DS's
but you don't actually create any data structures. You have fixed format
code in a **FREE program. You tried to declare one of your files as USROPN,
but you never opened the file.

You've been pointed to this before, but I don't think you read it.
http://www.catb.org/esr/faqs/smart-questions.html

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
Jim Oberholtzer
Sent: Thursday, October 31, 2019 11:28 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Parsing a field from xml file and passing it to openssl

You do claim to know RPG right?
The error messages show you where to look in your code.

Try it this way: I tried to resolve this compile error with this: "
whateveritis" but I don't understand why it's not working.

Then we see you actually tried to clear the errors before you ask.
Invest some time in yourself to learn......



Jim Oberholtzer
Chief Technical Architect
Agile Technology Architects


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

Hi,
I tested below code which could store encodedExchange field in it and
I want to pass it's value to openssl command but when trying to pass
it it's giving me multiple compilation errors could someone please
tell me how to correct these errors

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

*************
compilattion errors & Source code is attached pasted source code with
this email as well:-

**free
dcl-s encodedExchangeToken varchar(88);
dcl-s string char(45);
DCL-f UNIX usage(*input) special(1000) PGMNAME('UNIXCMD')
PLIST(UNIXPARM) USROPN;
DCL-F QSYSPRT usage(*output);

dcl-s cmd char(5000);
dcl-s mode char(1) inz('P');
dcl-ds record(1000);
dcl-ds outrec(132);

C UNIXPARM PLIST
C PARM CMD
C PARM MODE
XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/INPUT.+
xml':'doc=file case=any path=+
TokenExchangeResponse/encodedExchangeToken');
cmd = 'encodedExchangeToken'! openssl enc -d -aes-+ Q+
128-ecb -d -aes-128-ecb-k 363631653237354f494d31554c594c4+ Q+
a -nopad -nosalt -base64 -A -OUT string; Q+
read UNIX record;
dow not %eof(UNIX);
outrec = record;
write QSYSPRT outrec;
read UNIX record;
enddo;

close UNIX;
*inlr = *on;

**************




[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the employee of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender immediately to
arrange for return or destruction of these documents.
--
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 ...

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.