Re: HMAC SHA256 in native 4D code (JWT)

2020-03-21 Thread Lee Hinde via 4D_Tech
Thanks. > On Mar 21, 2020, at 8:24 AM, Bruno LEGAY via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Hi, > > The component is now on github : > > https://github.com/blegay/jwt_component > > Bruno LEGAY > A Consulting

Re: HMAC SHA256 in native 4D code (JWT)

2020-03-21 Thread Bruno LEGAY via 4D_Tech
Hi, The component is now on github : https://github.com/blegay/jwt_component Bruno LEGAY A Consulting ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options:

Re: HMAC SHA256 in native 4D code

2020-03-21 Thread Two Way Communications via 4D_Tech
Hi Bruno, Thank you very much. This does in fact generate the correct JWT. I did check where the differences are, comparing to my code: Apparently, when using the php function ‘hash_hmac’, or when using Openssl through LEP, I get another signature than the one I get from your component. I am

Re: HMAC SHA256 in native 4D code

2020-03-21 Thread Bruno LEGAY via 4D_Tech
Hi Ruby, I sent you a component which does HMAC 256 and JWT object signing. It is all native. Lets us know if it works. Bruno LEGAY A Consulting ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Keisuke Miyako via 4D_Tech
if a single PHP function does not produce results in a format you can use, you might have to encapsulate your call in a script file. 2020/03/21 4:48、Two Way Communications via 4D_Tech <4d_tech@lists.4d.com>のメール: With the ’True’ parameter, the php function returns

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Randy Kaempen via 4D_Tech
Here is a method we use on Windows: // SHAHMACEncode_Server 3/21/18 // C_TEXT($1;$2;$3;<>SHAHMAC) // 3/15/18 // $Value:=$1 // 3/15/18 $Key:=$2 // 3/15/18 $Client:=$3 // 3/15/18 // vCommand:="/bin/bash" // 3/21/18 // vInput:="echo -n \""+$Value+"\" | openssl sha1 -hmac

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Two Way Communications via 4D_Tech
I did use PHP execute, then did a Base64 encode on it, and then cleaned ‘+’, ‘/‘ and ‘=‘. Still got an invalid signature. With the ’True’ parameter, the php function returns binary; often this is empty. With the parameter set to false, you get what they call ‘lowercase hexies’. No clue at all

AW: HMAC SHA256 in native 4D code?

2020-03-20 Thread Epperlein, Lutz (agendo) via 4D_Tech
Regarding JWT (JSON Web Token), there is another plugin by Miyako: https://github.com/miyako/4d-plugin-jwt Lutz Epperlein -Ursprüngliche Nachricht- Betreff: Re: HMAC SHA256 in native 4D code? Hi, I had to spend some time looking into this recently myself. You have two options: 1 - K

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread JBellos via 4D_Tech
Hi, I had to spend some time looking into this recently myself. You have two options: 1 - K. Miyako has a plugin - CommonCrypto. Easy to use. $signature:=HMACSHA256 ($keyData;$stringData;Crypto BASE64) 2 - Use PHP execute, but then encode the result (assuming you need to) php

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Spencer Hinsdale via 4D_Tech
Technical <4d_tech@lists.4d.com> 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 fa

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Two Way Communications via 4D_Tech
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

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Spencer Hinsdale via 4D_Tech
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" <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote: Hi Bruno, I was looking in nabble to find a solution

Re: HMAC SHA256 in native 4D code?

2020-03-20 Thread Rudy Mortier via 4D_Tech
Hi Bruno, I was looking in nabble to find a solution for generating HMAC-SHA256 keys. I have been trying to generate JSON web tokens, but they fail because of an invalid signature. I tried using : PHP Execute("";"hash_hmac";$HMACSHA256;"sha256";($base64UrlHeader+"."+$base64UrlPayload);$key),

Re: HMAC SHA256 in native 4D code? (Bill Hutten)

2018-10-10 Thread Bruno LEGAY via 4D_Tech
Hi, Yes. HMAC-256 is quite simple (even more since sha256 is native). I can send you some code if you want. HTH Bruno ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options:

RE: HMAC SHA256 in native 4D code?

2018-10-10 Thread Timothy Penner via 4D_Tech
Hi Bill, I have some older code in the ACME Client technote (http://kb.4d.com/assetid=77708) that perhaps could be repurposed. It doesn't do HMAC but it could get you started and maybe after you adapt the code it will work for your purposes. The code works natively on MacOS because MacOS

HMAC SHA256 in native 4D code?

2018-10-10 Thread Bill Hutten via 4D_Tech
As the subject says - is it possible to do this in native 4D (no plugin) in v17? - bill ** 4D Internet Users Group (4D iNUG) Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech