I'm working with an S3 target that I think is requiring V2 signature authentication, but I have been unable for the life of me to get this working. I'm using the Sprightlysoft AWS component.
'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, "")
The error message I get is:
"The AWS Access Key ID and Signature did not match your provided. Please check your key and signing method"
According to errors and my research, it would seem that the target is requiring a v2 signature, and there seems to be a v2 signature function available, within the Sprightlysoft AWS component.
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
I've tried to get this working, but I'm just guessing to how/where this needs to be used. I wondered if someone may know how to use this so I can authenticate properly, if this is indeed the missing piece of the puzzle.