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



Correct. That may also be required, but since the payload is Base64 encoded, I assumed that it would not be necessary.

So the question could be: Must the original payload be converted to the target CCSID before being encoded to Base64? Is it a binary or a text, Json, etc. payload? Binary payloads must not be converted, of course.

Usually it is always a good idea to convert every part of the game to the target CCSID before passing anything to Qc3CalculateHMAC.

Thomas.

-----Ursprüngliche Nachricht-----
Von: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> Im Auftrag von Greg Wilburn
Gesendet: Montag, 7. Dezember 2020 21:56
An: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Betreff: RE: HMAC Calculation

Suren K,

I had a lot of help doing this with a Web Service API... the trick was to convert the data to ASCII before calling Qc3CalculateHMAC.

I used HTTP_Xlate() to do so.

HTH,
Greg

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Suren K
Sent: Monday, December 07, 2020 4:15 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Reg: HMAC Calculation

Hi All,

How are you?

I am facing the following issue with Qc3CalculateHMAC API.

Currently i am trying to do the JWT token validation in iSeries, to do that i am planning to generate the HMAC using the header, payload and signed secret key.

The logic i am using is Passing the input data as Header(Base64encoded).Payload(Base64encoded).

1) For Base64 decoding - SYSTOOLS.BASE64ENCODE function is used.
2) Algorithm - SHA256.
3) I am passing the Secret Key as plain character text using "KEYD0200"

But the HMAC generated by the API is not correct. Am i doing anything wrong?

Qc3CalculateHMAC(
%addr(headerPayload) :
%len(%trimr(headerPayload)) :
'DATA0100' :
algd0500 :
'ALGD0500' :
keyparam :
'KEYD0200' :
'0' : // crypto
*blank : // crypto dev
hash :
QUSEC);

Could anyone please help me to figure out the issue?

Regards,
Suren K
--
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://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2flists.midrange.com%2fmailman%2flistinfo%2frpg400%2dl&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-8722e17cd1d62e9084b3f5773e8d1e75c38c90c9
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2farchive.midrange.com%2frpg400%2dl&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-76896ef582a9a907b8cd34146ab5d6b991b5e882.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2famazon.midrange.com&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-f656ee3f3d82fb2e21d60b47e68b0acaf1507ade
--
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://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2flists.midrange.com%2fmailman%2flistinfo%2frpg400%2dl&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-8722e17cd1d62e9084b3f5773e8d1e75c38c90c9
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2farchive.midrange.com%2frpg400%2dl&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-76896ef582a9a907b8cd34146ab5d6b991b5e882.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://smex12-5-en-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2famazon.midrange.com&umid=15035c3a-13e5-4d22-bdbf-c4a4d8dd1c67&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-f656ee3f3d82fb2e21d60b47e68b0acaf1507ade

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.