Copy link to clipboard
Copied
In an example it looks like this:
ewogICAiYmlsbGluZyI6ewogICAgICAiZmlyc3ROYW1lIjoiSsOpcsOpbXkiLAogICAgICAibGFzdE5hbWUiOiJHc
mltbSIsCiAgICAgICJhZGRyZXNzTGluZTEiOiIzIHJ1ZSBkZSBsJ8OpZ2xpc2UiLAogICAgICAiY2l0eSI6Ik9zdGhl
aW0iLAogICAgICAicG9zdGFsQ29kZSI6IjY4MTUwIiwKICAgICAgImNvdW50cnkiOiJGUiIKICAg fSwKICAgInNo
aXBwaW5nIjp7CiAgICAgICJmaXJzdE5hbWUiOiJKw6lyw6lteSIsCiAgICAgICJsYXN0TmFtZSI6IkdyaW1tIiwKIC
AgICAgImFkZHJlc3NMaW5lMSI6IjMgcnVlIGRlIGwnw6lnbGlzZSIsCiAgICAgICJjaXR5IjoiT3N0aGVpbSIsCiAgI
CAgICJwb3N0YWxDb2RlIjoiNjgxNTAiLAogICAgICAiY291bnRyeSI6IkZSIiwKICAgICAgImVtYWlsIjoiamVyZW02OEBob3RtYWlsLmNvbSIsCiAgICAgICJwaG9uZSI6IiszMy02MTIzNDU2NzgiLAogICAgICAic2hpcEluZGljYXRvciI6ImJpbGxpbmdfYWRkcmVzcyIsCiAgICAgICJkZWxpdmVyeVRpbWVmcmFtZSI6InR3b19kYXkiLAogICAgICAiZmlyc3RVc2VEYXRlIjoiMjAxNy0w MS0yNSIsCiAgICAgICJtYXRjaEJpbGxpbmdBZGRyZXN zIjp0cnVlCiAgIH0sCiAgICJjbGllbnQiOnsKICAgICAgImVtYWlsIjoiamVyZW02OEBob3RtYWlsLmNvbSIsCiAgICAgICJtb2JpbGVQaG9uZSI6IiszMy02MTIzNDU2NzgiLAogICAgIC AiYmlydGhDaXR5IjoiQ29sbWFyIiwKICAgICAgImJpcnRoUG9zdGFsQ29kZSI6IjY4MDAwIiwKICAgICAgImJpcnRoQ291bnRyeSI6IkZSIiwKICAgICAgImJpcnRoZGF0ZSI6IjE5ODctMDMtMjciCiAgIH0KfQ==
With my ColdFusion solution above but without == at the end.
How can the example from PHP be implemented correctly in ColdFusion?
geheimerSchlüssel = 9AD6960F6628543CDC75820B09BA57D56395F896”;
stringToSeal = 7622839*eyJiaWxsaW5nIjp7InBvc3RhbENvZGUiOiI1MDEzIiwiY2l0eSI6Ik5pZWRlcmfDtnNnZW4iLCJjb3VudHJ5IjoiRlIiLCJsYXN0TmFtZSI6IlJpcHBzdGVpbiIsImFkZHJlc3NMaW5lMSI6Ik5ldW1hdHRzdHJhc3NlIDMiLCJmaXJzdE5hbWUiOiJTdGV2ZSJ9LCJzaGlwcGluZyI6eyJwb3N0YWxDb2RlIjoiNTAxMyIsImNpdHkiOiJOaWVkZXJnw7ZzZ2VuIiwiY291bnRyeSI6IkZSIiwibGFzdE5hbWUiOiJSaXBwc3RlaW4iLCJtYXRjaEJpbGxpbmdBZGRyZXNzIjp0cnVlLCJhZGRyZXNzTGluZTEiOiJOZXVtYXR0c3RyYXNzZSAzIiwiZmlyc3ROYW1lIjoiU3RldmUifSwiY2xpZW50Ijp7Imxhc3ROYW1lIjoiUmlwcHN0ZWluIiwiYWRkcmVzc0xpbmUxIjoiTmV1bWF0dHN0cmFzc2UgMyIsImZpcnN0TmFtZSI6IlN0ZXZlIn19*16/07/2024: 14:07:04*EN*steve@rippstein.name*16. 80EUR*542DCB57*tricothe*3.0
in PHP:
$MAC = hash_hmac(“sha1”, $stringToSeal, hex2bin($secretKey));
my version in ColdFusion
<cfset MAC = hmac(stringToSeal ,charsetEncode(binaryDecode(secretKey, “hex”), “utf-8”), “HMACSHA1”) />
How should the above PHP line be implemented correctly in ColdFusion?
Many thanks for your help.
Greetings
Steve
Copy link to clipboard
Copied
Your question reminds me of previous PHP HMAC discussions. Start by looking at them to see if they answer your question.
https://community.adobe.com/t5/coldfusion-discussions/converting-php-hash-to-cf/m-p/14068862