我正在使用我认为需要V2签名身份验证的S3目标,但我无法让我的生活得以实现。 我正在使用Sprightlysoft AWS组件。
'create an instance of the REST class
Dim MyREST As New SprightlySoftAWS.REST
Dim RequestURL As String
'Build the URL to call. Do not specify a bucket name or key name when listing all buckets
RequestURL = MyREST.BuildS3RequestURL(True, "s3target.com", "", "", "")
Dim RequestMethod As String
RequestMethod = "GET"
Dim ExtraRequestHeaders As New Dictionary(Of String, String)
'add a date header
ExtraRequestHeaders.Add("x-amz-date", DateTime.UtcNow.ToString("r"))
Dim AuthorizationValue As String
'generate the authorization header value
AuthorizationValue = MyREST.GetS3AuthorizationValue(RequestURL, RequestMethod, ExtraRequestHeaders, TextBoxAWSAccessKeyId.Text, TextBoxAWSSecretAccessKey.Text)
'add the authorization header
ExtraRequestHeaders.Add("Authorization", AuthorizationValue)
'call MakeRequest to submit the REST request
Dim RetBool As Boolean
RetBool = MyREST.MakeRequest(RequestURL, RequestMethod, ExtraRequestHeaders, "")
我得到的错误信息是:
" AWS Access密钥ID和签名与您提供的不一致。 请检查您的密钥和签名方法"
根据错误和我的研究,似乎目标需要v2签名,并且似乎在Sprightlysoft AWS组件中有可用的v2签名功能。
https://sprightlysoft.com/AWSComponent/Help/html/2605bafc-43dc-df45-7700-bd2fd74e1505.htm
Public Function GetSignatureVersion2Value (RequestURL As String, RequestMethod As String, SendData As String, AWSSecretAccessKey As String ) As String
我试图让这个工作,但我只是猜测需要如何/在何处使用它。我想知道是否有人可能知道如何使用这个,所以我可以正确认证,如果这确实是这个难题的缺失部分。