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

I tried that as well but i am not getting the expected result.

I declared a field with CCSID as UTF-8

dcl-s signKey char(100) ccsid(*utf8);

For now I hardcoded the secret key in plain text inside the program and
used the Signkey field to move the value into the Key data structure.

Regards,
Suren


On Mon, Dec 7, 2020, 5:47 PM Thomas Raddatz <thomas.raddatz@xxxxxx> wrote:

Did you convert the secret key (KEYD0200) to the ccsid of the target
system? I assume that you need the hmac for a PC and not for an IBM I,
right? Therefore you want to use an Ascii or UTF-8 key instead of an EBCDIC
key, I assume.

In that case the key must be converted to the CCSID of the target system,
before passing it to the Qc3CalculateHMAC() API.

Thomas.

-----Ursprüngliche Nachricht-----
Von: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> Im Auftrag von Suren K
Gesendet: Montag, 7. Dezember 2020 10:15
An: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Betreff: 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=610e4461-c6f6-4a7e-b039-66c99e2689e4&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-b35601ec44c876b516ef29c843b5d6cb9c44d158
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=610e4461-c6f6-4a7e-b039-66c99e2689e4&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-b01fb74cc3366396f8ce552b3fb7a7e1d77d948b
.

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=610e4461-c6f6-4a7e-b039-66c99e2689e4&auth=e97acd68c6deb7b858f463424a55c9ae42d5359e-25c69241f01dab5b20ef507ba6ee621ff83bc9a0
--
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@xxxxxxxxxxxxxxxxxxxx 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.