Amazon MWS – la firma della richiesta calcasting non corrisponde alla firma fornita

Ottenere il seguente messaggio di errore da https://mws.amazonservices.com/ :

Sender SignatureDoesNotMatch −  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.  

Ecco il codice VB.net che sto usando per calcolare la richiesta. Ho rimosso SecretKey e AWSAccessKeyId per motivi di sicurezza.

 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 &= "Acknowledged=" & Server.UrlEncode("false") sRequest &= "&Action=" & Server.UrlEncode("GetReportList") sRequest &= "&AWSAccessKeyId=" & Server.UrlEncode("REMOVED-FOR-SECURITY") sRequest &= "&Marketplace=" & Server.UrlEncode("REMOVED-FOR-SECURITY") sRequest &= "&Merchant=" & Server.UrlEncode("REMOVED-FOR-SECURITY") sRequest &= "&SignatureMethod=" & Server.UrlEncode("HmacSHA256") sRequest &= "&SignatureVersion=" & Server.UrlEncode("2") sRequest &= "&Timestamp=" & Server.UrlEncode(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssCST")) sRequest &= "&Version=" & Server.UrlEncode("2009-01-01") Dim StringToSign As String = "GET\n" & "mws.amazonservices.com\n" & "/\n" & sRequest sRequest &= "&Signature=" & Server.UrlEncode(HashString(StringToSign)) Response.Write("Click here") 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