Looks like you pad the key, append the msg, then hash. Then pad the key again, append the previous hash, and hash again.
https://stackoverflow.com/questions/11415055/how-to-use-hmac-sha256 From: Two Way Communications <[email protected]> Date: Friday, March 20, 2020 at 9:37 AM To: Spencer Hinsdale <[email protected]> Cc: 4D iNug Technical <[email protected]> Subject: Re: HMAC SHA256 in native 4D code? Hi Spencer, I have been looking at it, but it does not do what I want to do. I need to construct a JSON Web Token (JWT) For that, I need to encrypt a string with a secret key, to obtain the encrypted token. As far as I can see there is no parameter in ‘Generate Digest' to do so. I tried to use: PHP Execute(“";"hash_hmac";$HMACSHA256;"sha256";($base64UrlHeader+"."+$base64UrlPayload);$key) but the signature that is being returned does not work with JWT. I tested it on jwt.io<http://jwt.io>, and it returns ‘invalid’. So I am looking for other ways to generate this HMAC SHA256 Regards, Rudy Mortier Two Way Communications bvba On 20 Mar 2020, at 17:18, Spencer Hinsdale <[email protected]<mailto:[email protected]>> wrote: Does this help? https://doc.4d.com/4Dv17/4D/17.4/Generate-digest.301-4882385.en.html On 3/20/20, 9:15 AM, "4D_Tech on behalf of Rudy Mortier via 4D_Tech" <[email protected] on behalf of [email protected]> wrote: Hi Bruno, I was looking in nabble to find a solution for generating HMAC-SHA256 keys. ********************************************************************** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

