-1
我試圖安裝一個應用程序與我的網址登錄,使他們可以驗證,但我似乎無法弄清楚如何複製我是從下頁試圖代碼:https://help.sendowl.com/help/signed-urls#example如何使用Base64編碼執行HMAC-SHA1?
order_id=12345&buyer_name=Test+Man&buyer_email=test%40test.com&product_id=123&signature=QpIEZjEmEMZV%2FHYtinoOj5bqAFw%3D
[email protected]&buyer_name=Test Man&order_id=12345&product_id=123
[email protected]&buyer_name=Test Man&order_id=12345&product_id=123&secret=t0ps3cr3t
publicStr&t0ps3cr3t
這是步驟:
- 一階的參數(刪除簽名)和UNESCAPE 他們:
- 下一頁附加您的簽名密鑰:
- 生成密鑰簽名用:
- 執行HMAC-SHA1摘要與基礎64編碼:QpIEZjEmEMZV/HYtinoOj5bqAFw =
以下是我的嘗試,但最終沒有得到相同的結果:
$signKey = "t0ps3cr3t";
$signData = "[email protected]&buyer_name=Test Man&order_id=12345&product_id=123&secret=t0ps3cr3t";
$passData = hash_hmac("sha1", $signData, base64_decode(strtr($signKey)), true);
$passData = base64_encode($passData);
echo $passData;
我一直收到x8NXmAmkNBPYCXwtj65mdVJ8lPc=