|
Based on what I see in your code and debug values (namely trailing DLEs)
replace
eval record = %trimr(record);
with
Pos2 = %scan(x'10' :Record);
Record = %subst(Record :1 :(Pos2 - 1));
Personally I would change a few other things, but the above should take
care of the DLEs you're getting.
On Wed, Nov 20, 2019 at 9:45 AM Rishi Seth <rishiseth99@xxxxxxxxx> wrote:
sorry i did not understand what did you mean at all is it possible toin
ammend my program code so that i could only write valid decrypted value
my testfile which should only write valid decrypted value no more junkbut
values in my test file.
also currently i knew this correct value of *record* field ( i mean as
here i knew decrypted value of this *encodedexchangetoken* in advance)
what about those unforeseen scenarios where this decrypted value could betest
something else based on the different values supplied in
*encodedexchangetoken* field( that is why i have kept it as a variable
field i mean kept variable to *encodednExchangetoken* field here) so how
should my program be modified to handle such scenarios if possible could
you please amend it and share it in your reply email so that i could
it.length
Thanks
On Wed, Nov 20, 2019 at 3:09 PM Bruce Vining <bruce.vining@xxxxxxxxx>
wrote:
Debug is showing that the UNIXCMD program is returning data link escape
(x'10') values rather than blanks for bytes 65 - 80, and then blanks
(x'40') starting at 81. If you somehow know that the actual data
1.being sent is 80 bytes (which it appears from your notes that you do)then
scan
eval record = %trimr(%subst(record :1 :80) : x'10');
and record should now be all blanks following byte 64.
Otherwise trim blanks and DLEs from record OR, as this is EBCDIC data,
for the first DLE and substring out bytes 1 thru the DLE position less
shouldEither way should get the job done based on your current XML document.wrote:
On Wed, Nov 20, 2019 at 8:01 AM Rishi Seth <rishiseth99@xxxxxxxxx>
If
Hi,
Thanks.
EVAL N1 = %LEN(OUTREC);
DSPLY N1;
" This should display the correct length of your token value.
not, then there are garbage characters (not blanks) being introduced
somewhere in the above process."
----When I debug I get N1 = 64 which is incorrect which ideally
ofhave
been 48 as per current decrypted value( if you calculate the length
havecomesactual decrypted value which is actually in current scenario is '
*707fbe32-0dbc-41e0-888f-5bc40de8c20d2P9AMPCTQ4CZ*' ) of '
*encodedExchangetoken'* field which is read from input XML file and
in record field after this openssl command in the mentioned program.
so value of N1=64 in debug mode which clearly indicates that we
amsome
garbage value apart from decrypted value in record field here and I
sostruggling to remove that garbage value only.
RCDLEN = 500 is incorrect then what should be correct length on fly
whichthat i can set it as per exact decrypted value of record field
givenshould not contain any garbage value in it?
Please see below values obtained in debug session after following
debug.ìu3VtNgfyWU9faZinstructions:-
> EVAL encodedExchangeToken:x 96
00000 0058A4F3 E5A3D587 86A8E6E4 F98681E9 -
c3Iaa8ZWbE5UZCfm
00010 83F3C981 81F8E9E6 82C5F5E4 E9C38694 -
C17yA4MyW0ghflt9
00020 C3F1F7A8 C1F4D4A8 E6F08788 8693A3F9 -
dNQNDpCcgMZiG/kX
00030 84D5D8D5 C497C383 87D4E989 C76192E7 -
PE4vv2CHL93B4iKi
00040 D7C5F4A5 A5F2C3C8 D3F9F3C2 F489D289 -
ODHxxdVA==......
00050 D6C4C8A7 A784E5C1 7E7E0000 00000000 -
707fbe32-0dbc-41
> EVAL record:x 96
00000 F7F0F786 8285F3F2 60F08482 8360F4F1 -
e0-888f-5bc40de8
00010 85F060F8 F8F88660 F58283F4 F08485F8 -
c20d2P9AMPCTQ4CZ
00020 83F2F084 F2D7F9C1 D4D7C3E3 D8F4C3E9 -
................
00030 10101010 10101010 10101010 10101010 -
00040 40404040 40404040 40404040 40404040 -
00050 40404040 40404040 40404040 40404040 -
Bottom
Debug . . .
Thanks
On Wed, Nov 20, 2019 at 3:54 AM Bruce Vining <bruce.vining@xxxxxxxxx
wrote:
I apologize if you've done these steps before, but could you:
1. Enter debug of your program
2. Set a breakpoint on the statement
eval encodedExchangeToken =%trimr(encodedExchangeToken);
3. Set a second breakpoint on the statement
eval record = %trimr(record);
4. Run the program
5. At the breakpoint set in step 2 run
eval encodedExchangeToken:x 96
6. Resume the program and at the breakpoint set in step 3 run
eval record:x 96
7. Post the displayed results of steps 5 and 6
8. Post the contents of
/home/I0RS01HU/INPUT.xml
On Tue, Nov 19, 2019 at 11:36 AM Rishi Seth <rishiseth99@xxxxxxxxx
thatwrote:
I think we are getting diverted from main topic what i meant was
exacteven
i tried as you said on fly that flat file should be created with
codelength of that decrypted value even that i tried please see below
but n1 variable which is holding the value of %len(outrec) in
%trimrmode
tells it's value to be 64 that means still after doing those
becauseon
field or data structure as well have some extra junk value
fulllength
of decrypted value is 48 only so 64-48 =16 these 16 length is
363631653237354f494d31554c594c4a +ofopenssl +
garbage which i don't want to write in my flat file .
FUNIX IF F 1000 SPECIAL PGMNAME('UNIXCMD')
F PLIST(UNIXPARM) USROPN
F*QSYSPRT O F 1000 PRINTER
dencodedExcha...
dngeToken s 500 VARYING
DPOS2 S 5U 0
D cmd s 5000a
D mode s 1A inz('P')
DN1 S 2P 0
D Åcommand s 512a
d QCMDEXC PR ExtPgm('QCMDEXC')
d command 500a const
d clength 15p 5 const
D record ds 1000
D outrec s 1000 varying inz
C UNIXPARM PLIST
C PARM CMD
C PARM MODE
/free
RECORD = *BLANKS;
OUTREC = *BLANKS;
XML-INTO encodedExchangeToken %XML('/home/I0RS01HU/+
INPUT.xml':'doc=file case=any path=+
TokenExchangeResponse/encodedExchangeToken');
eval encodedExchangeToken =%trimr(encodedExchangeToken);
cmd = 'echo ' + '''' + encodedExchangeToken + ''' !
enc -d -aes-128-ecb -K
wrote:-nopad -nosalt -base64 -A';
open UNIX;
read UNIX record;
dow not %eof(UNIX);
eval record = %trimr(record);
eval outrec = %trimr(record);
eval outrec = %trimr(outrec);
EVAL N1 = %LEN(OUTREC);
DSPLY N1;
//Delete the TESTFILE
Åcommand = 'DLTF FILE(rishi/TESTFILE)';
QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
Åcommand = *blanks;
Åcommand = 'CRTPF FILE(RISHI/TESTFILE) RCDLEN(500)';
QCMDEXC(%trim(Åcommand): %len(%trim(Åcommand)));
//Write into file
EXEC SQL
INSERT INTO rishi/TESTFILE VALUES (:outrec);
// dsply %subst(outrec:1:48);
read UNIX record;
enddo;
close UNIX;
*inlr = *on;
/end-free
On Tue, Nov 19, 2019 at 5:06 PM <dlclark@xxxxxxxxxxxxxxxx>
you11/19/2019
"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on
somethings10:52:25 AM:
sorry i did not understand what you mean but let me explain
clearly:-
1) decrypted output of this AES128 algorithm is uncertain.
One step at a time... There are only two things that
accept acan
do
about this AES128 algorithm you mention. It must either
be avalid
varying-length parameter and handle it as such or there must
toseparate
parameter which allows you to pass a length value in addition
thetheyou
data
to be encrypted/decrypted. No one can answer those issues for
You(unless
they are familiar with the process of which you are speaking).
must
be able to analyze the AES128 algorithm to determine which of
*********************************************************************************************above
two requirements can be met.
Sincerely,
Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300
Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331
messagenamedThis email message and any attachments is for use only by the
proprietaryaddressee(s) and may contain confidential, privileged and/or
information. If you have received this message in error, please
immediately notify the sender and delete and destroy the
ofand
all
copies. All unauthorized direct or indirect use or disclosure
*********************************************************************************************this
privilegemessage is strictly prohibited. No right to confidentiality or
is waived or lost by any error in transmission.
related--
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
affiliateaffiliateaffiliateaffiliatequestions.
Help support midrange.com by shopping at amazon.com with our
link: https://amazon.midrange.com--
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
link: https://amazon.midrange.com
--
Thanks and Regards,
Bruce
931-505-1915
--
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
link: https://amazon.midrange.com--
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
--link: https://amazon.midrange.com
--
Thanks and Regards,
Bruce
931-505-1915
--
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
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
--
Thanks and Regards,
Bruce
931-505-1915
--
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 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.