0

我正在尝试浏览 PHP 的 Amazon FPS 快速入门指南,但无法验证 CBUI 提供的返回 url。

这是网址:

http://local-screen.com/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/ReturnUrlVerificationSampleCode.php?tokenID=N1G9E5I7BH72563866UZ23YZ1X1AL9AZ2A9291Q1PKDATS8R7BLZ6Y7LEHY2QRHS&signatureMethod=RSA-SHA1&status=SC&signatureVersion=2&signature=WbBPFQku5BA67CR9vWr664eLNDahErYWZM6GrOYTnlDmLZf0rBm0XATrGPLgj5V94GsP0n%2BJ0uye%0A0MRZ3gastZX9M0cjbaPBcCjW1ydt%2BtCiatd%2BjQA6ZRs7XD%2BmWMqHVT3b4eY5WXKHHHQIvp4xLjJY%0AxuwtLf4MaYuiATtdnCY%3D&certificateUrl=https%3A%2F%2Ffps.sandbox.amazonaws.com%2Fcerts%2F090911%2FPKICert.pem%3FrequestId%3Dbjyk7pqb789b33qxg4h9lx8kn8ijplnc5pow0ycey00olslowmv&expiry=01%2F2018&callerReference=%241%24yo8s

这是我得到的错误:

Verifying return url signed using signature v2 .... 
Fatal error: Uncaught exception 'Amazon_FPS_SignatureException' with message 'Certificate could not be verified by the FPS service' in /home/content/85/9687085/html/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/SignatureUtilsForOutbound.php:103 Stack trace: #0 /home/content/85/9687085/html/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/SignatureUtilsForOutbound.php(50): Amazon_FPS_SignatureUtilsForOutbound->validateSignatureV2(Array, 'http://local-sc...', 'GET') #1 /home/content/85/9687085/html/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/ReturnUrlVerificationSampleCode.php(93): Amazon_FPS_SignatureUtilsForOutbound->validateRequest(Array, 'http://local-sc...', 'GET') #2 /home/content/85/9687085/html/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/ReturnUrlVerificationSampleCode.php(97): Amazon_FPS_ReturnUrlVerificationSampleCode::test() #3 {main} thrown in /home/content/85/9687085/html/wp-content/plugins/lclscrn_projects/amazon_fps/FPS/SignatureUtilsForOutbound.php on line 103

这是获取变量并调用验证页面的函数:

public static function test() {

                $aws_access_key = self::$aws_access_key;
                $aws_secret_key = self::$aws_secret_key;

                $utils = new Amazon_FPS_SignatureUtilsForOutbound($aws_access_key, $aws_secret_key);

                /* Verification of an return url signed using signature version 2.*/

                // New parameters sent in return url signed using signature v2
                $params["certificateUrl"] = self::$certificate_url;
                $params["signature"] = self::$signature;
                $params["signatureMethod"] = self::$signature_method;
                $params["signatureVersion"] = self::$signature_version;

                // foreach ($params as $param) {
                //         echo $param;
                //         echo '<br/><br/>';
                // }
                // echo self::$return_url;
                // return;


                $urlEndPoint = self::$return_url; //Your return url end point. 
                print "Verifying return url signed using signature v2 ....\n";
                //return url is sent as a http GET request and hence we specify GET as the http method.
                //Signature verification does not require your secret key
                print "Is signature correct: " . $utils->validateRequest($params, $urlEndPoint, "GET") . "\n";
    }

我还有 foreach 循环的输出,如果有人需要,我可以在上面进行 PM。我只是不明白为什么我不能验证这个网址。任何帮助将不胜感激。

缺口

4

1 回答 1

0

我也在使用来自 Amazon 的 PHP 示例代码,并且遇到了完全相同的错误消息。

解决方案

要求 1:您在 VerifySignature 请求中传递的值HttpParameters必须具有与亚马逊 UI 传递给您的返回 URL 的顺序相同的参数。因此,无需像亚马逊的示例代码那样手动获取每个 GET 参数,只需将对象$_GET用作.$parametersSignatureUtilsForOutbound.php

要求 2:您需要从可在 Internet 上访问的盒子中进行测试。如果您从 localhost 进行测试,您将始终收到此错误。

于 2013-07-03T07:20:52.773 回答