title: Amazon MWS - request signature calculated does not match the signature provided
body: <p>Getting the following error message from <a href="https://mws.amazonservices.com/" rel="noreferrer">https://mws.amazonservices.com/</a>:</p>
  
  <pre><code>&lt;Type&gt;Sender&lt;/Type&gt;
  &lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;
  −
  &lt;Message&gt;
  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.
  &lt;/Message&gt;
  </code></pre>
  
  <p>Here is the VB.net code I am using to calculate the request.  I have removed the SecretKey and AWSAccessKeyId for security reasons.</p>
  
  <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          Dim sURL As String = "https://mws.amazonservices.com/"
  
          Dim sRequest As String = ""
          sRequest &amp;= "Acknowledged=" &amp; Server.UrlEncode("false")
          sRequest &amp;= "&amp;Action=" &amp; Server.UrlEncode("GetReportList")
          sRequest &amp;= "&amp;AWSAccessKeyId=" &amp; Server.UrlEncode("REMOVED-FOR-SECURITY")
          sRequest &amp;= "&amp;Marketplace=" &amp; Server.UrlEncode("REMOVED-FOR-SECURITY")
          sRequest &amp;= "&amp;Merchant=" &amp; Server.UrlEncode("REMOVED-FOR-SECURITY")
          sRequest &amp;= "&amp;SignatureMethod=" &amp; Server.UrlEncode("HmacSHA256")
          sRequest &amp;= "&amp;SignatureVersion=" &amp; Server.UrlEncode("2")
          sRequest &amp;= "&amp;Timestamp=" &amp; Server.UrlEncode(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssCST"))
          sRequest &amp;= "&amp;Version=" &amp; Server.UrlEncode("2009-01-01")
  
          Dim StringToSign As String = "GET\n" &amp; "mws.amazonservices.com\n" &amp; "/\n" &amp; sRequest
          sRequest &amp;= "&amp;Signature=" &amp; Server.UrlEncode(HashString(StringToSign))
  
          Response.Write("&lt;a href=""" &amp; sURL &amp; "?" &amp; sRequest &amp; """&gt;Click here&lt;/a&gt;")
  
      End Sub
  
      Public Shared Function HashString(ByVal StringToHash As String) As String
          Dim myEncoder As New System.Text.UTF8Encoding
          Dim Key() As Byte = myEncoder.GetBytes("REMOVED-FOR-SECURITY")
          Dim XML() As Byte = myEncoder.GetBytes(StringToHash)
          Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(Key)
          Dim HashCode As Byte() = myHMACSHA256.ComputeHash(XML)
          Return Convert.ToBase64String(HashCode)
      End Function
  </code></pre>