PayWithAmazon\Client::signParameters PHP Method

signParameters() private method

If Signature Version is 0, it signs concatenated Action and Timestamp If Signature Version is 1, it performs the following: Sorts all parameters (including SignatureVersion and excluding Signature, the value of which is being created), ignoring case. Iterate over the sorted list and append the parameter name (in original case) and then its value. It will not URL-encode the parameter values before constructing this string. There are no separators. If Signature Version is 2, string to sign is based on following: 1. The HTTP Request Method followed by an ASCII newline (%0A) 2. The HTTP Host header in the form of lowercase host, followed by an ASCII newline. 3. The URL encoded HTTP absolute path component of the URI (up to but not including the query string parameters); if this is empty use a forward '/'. This parameter is followed by an ASCII newline. 4. The concatenation of all query string components (names and values) as UTF-8 characters which are URL encoded as per RFC 3986 (hex characters MUST be uppercase), sorted using lexicographic byte ordering. Parameter names are separated from their values by the '=' character (ASCII character 61), even if the value is empty. Pairs of parameter and values are separated by the '&' character (ASCII code 38).
private signParameters ( array $parameters )
$parameters array
    private function signParameters(array $parameters)
    {
        $signatureVersion = $parameters['SignatureVersion'];
        $algorithm = "HmacSHA1";
        $stringToSign = null;
        if (2 === $signatureVersion) {
            $algorithm = "HmacSHA256";
            $parameters['SignatureMethod'] = $algorithm;
            $stringToSign = $this->calculateStringToSignV2($parameters);
        } else {
            throw new \Exception("Invalid Signature Version specified");
        }
        return $this->sign($stringToSign, $algorithm);
    }