code: private function signParameters(array $parameters, $key)
      {
          $signatureVersion = $parameters['SignatureVersion'];
          $stringToSign = null;
          if (0 === $signatureVersion) {
              throw new InvalidArgumentException('Signature Version 0 is no longer supported. Only Signature Version 2 is supported.');
          } else if (1 === $signatureVersion) {
              throw new InvalidArgumentException('Signature Version 1 is no longer supported. Only Signature Version 2 is supported.');
          } else if (2 === $signatureVersion) {
              $algorithm = $this->config['SignatureMethod'];
              $parameters['SignatureMethod'] = $algorithm;
              $stringToSign = $this->calculateStringToSignV2($parameters);
          } else {
              throw new Exception("Invalid Signature Version specified");
          }
          return $this->sign($stringToSign, $key, $algorithm);
      }
docs: Computes RFC 2104-compliant HMAC signature for request parameters
  Implements AWS Signature, as per following spec:
  
  Signature Version 0: This is not supported in the Marketplace Web Service.
  
  Signature Version 1: This is not supported in the Marketplace Web Service.
  
  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).
  @param array $parameters
  @param $key
  @return string
  @throws Exception