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



Thank you so much!
I've looked at this code for so long, I didn't even see the difference in the date.
I'd bang my head against the wall, but I'd damage the wall.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Hiebert, Chris
Sent: Monday, July 11, 2022 2:47 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Signing AWS Requests with Signature Version 4


From the sample at this link you will need to pay attention to the date being used.
https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html

HMAC(HMAC(HMAC(HMAC("AWS4" + kSecret,"20150830"),"us-east-1"),"iam"),"aws4_request")

And they even called out in the text:
Note that the date used in the hashing process is in the format YYYYMMDD (for example, 20150830), and does not include the time.


If you change the date to '20150830' and run it you should see the output at the end matches.
I used '20120215' because that was on the examples page.

C4AFB1CC5771D871763A393E44B703571B55CC28424D1A5E86DA6ED3C154A4B9

In the sample below I used the values from:
https://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html

Given the following test input:

key = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY'
dateStamp = '20120215'
regionName = 'us-east-1'
serviceName = 'iam'





---BTW - If I hover over one of the *HEX fields in RDi, it blows up debug. The program advances to the end and debug disconnects from the SEP.

Looks like you should enter a PMR for that.

I've never tried to debug the code in RDi.
I used CCSID(*HEX) so that I know the system won't attempt any data conversions.


Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg Wilburn
Sent: Monday, July 11, 2022 11:44 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Signing AWS Requests with Signature Version 4


Chris,



Thanks a bunch for this! However, I copied it into a new source member, compiled and ran it.



It doesn't produce the same key as in the AWS example.

AWS Example Value:

c4afb1cc5771d871763a393e44b703571b55cc28424d1a5e86da6ed3c154a4b9

OutString:

F4780E2D9F65FA895F9C67B32CE1BAF0B0D8A43505A000A1A9E090D414DB404D



Either I'm doing something wrong, or something is not quite right yet.



BTW - If I hover over one of the *HEX fields in RDi, it blows up debug. The program advances to the end and debug disconnects from the SEP.



Greg



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.