title: Signature calculated does not match the signature you provided Amazon
body: <p>"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for detail"</p>
  
  <p>Below is my SignatureHelper (based on Amazon class libraries).</p>
  
  <pre><code>public string SignRequest(Dictionary&lt;string, string&gt; parametersUrl, Dictionary&lt;string, string&gt; parametersSignture)
  {
      var secret = Encoding.UTF8.GetBytes(parametersSignture["Secret"]);
      var signer = new HMACSHA256(secret);
  
      var stringToSign = CalculateStringToSign(parametersUrl, parametersSignture);
      var toSign = Encoding.UTF8.GetBytes(stringToSign);
  
      var sigBytes = signer.ComputeHash(toSign);
      var signature = Convert.ToBase64String(sigBytes);
  
      return signature;
  }
  
  private static string CalculateStringToSign(IDictionary&lt;string, string&gt; parameters, IDictionary&lt;string, string&gt; parametersSignture)
  {
      var sorted = new SortedDictionary&lt;string, string&gt;(parameters, StringComparer.Ordinal);
  
      var data = new StringBuilder();
      data.Append(parametersSignture["RequestMethod"]);
      data.Append("\n");
  
      var endpoint = new Uri(parametersSignture["EndPoint"]);
  
      data.Append(endpoint.Host);
      if (endpoint.Port != 443 &amp;&amp; endpoint.Port != 80)
      {
          data.Append(":")
              .Append(endpoint.Port);
      }
  
      data.Append("\n");
      var uri = endpoint.AbsolutePath;
      if (uri.Length == 0)
      {
          uri = "/";
      }
  
      data.Append(UrlEncode(uri, true));
      data.Append("\n");
  
      foreach (var pair in sorted.Where(pair =&gt; pair.Value != null))
      {
          data.Append(UrlEncode(pair.Key, false));
          data.Append("=");
          data.Append(UrlEncode(pair.Value, false));
          data.Append("&amp;");
      }
  
      var result = data.ToString();
  
      return result.Remove(result.Length - 1);
  }
  
  private static string UrlEncode(string data, bool path)
  {
      var encoded = new StringBuilder();
      var unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~" + (path ? "/" : string.Empty);
  
      foreach (char symbol in Encoding.UTF8.GetBytes(data))
      {
          if (unreservedChars.IndexOf(symbol) != -1)
          {
              encoded.Append(symbol);
          }
          else
          {
              encoded.Append("%" + string.Format("{0:X2}", (int)symbol));
          }
      }
  
      return encoded.ToString();
  }
  </code></pre>
  
  <p>This is my data:</p>
  
  <p>CalculateStringToSign
  POST</p>
  
  <pre><code>mws.amazonservices.com
  /
  AWSAccessKeyId=***&amp;Action=SubmitFeed&amp;FeedType=_POST_PRODUCT_DATA_&amp;MWSAuthToken=****&amp;Merchant=***&amp;PurgeAndReplace=false&amp;SignatureMethod=HmacSHA256&amp;SignatureVersion=2&amp;Timestamp=2015-06-30T13%3A47%3A42Z&amp;Version=2009-01-01
  </code></pre>
  
  <p>URL</p>
  
  <pre><code>"https://mws.amazonservices.com/?AWSAccessKeyId=***&amp;Action=SubmitFeed&amp;Merchant=***&amp;MWSAuthToken=***&amp;SignatureVersion=2&amp;Timestamp=2015-06-30T13%3a47%3a42Z&amp;Version=2009-01-01&amp;Signature=bfSpx9m7PIH3CbKNkjLDwY9norfD8mbTROJyxYnCMSU%3d&amp;SignatureMethod=HmacSHA256&amp;FeedType=_POST_PRODUCT_DATA_&amp;PurgeAndReplace=false+HTTP%2f1.1&amp;x-amazon-user-agent=Developer(Language%3dc%23)"
  </code></pre>
  
  <p>This is what I receive back</p>
  
  <pre><code>Code: SignatureDoesNotMatch
  Message: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
  </code></pre>
  
  <p>I think its something within my helper (unsure what as I've look at many code samples and it seems the same.</p>
  
  <p>Thanks,</p>
  
  <p>Clare </p>