Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Error><Code>SignatureDoesNotMatch</Code><Message> Error ( aws file upload scenarios ) #627

Closed
vikramvi opened this issue Dec 29, 2015 · 6 comments

Comments

@vikramvi
Copy link

Below is the cURL which works

curl -i -H 'Authorization: AWS AKIAJEN6W4AO3LJODOAA:nApHVNFtGX....' -H 'x-amz-date: Tue, 29 Dec 2015 16:30:30 UTC +00:00' -H 'Content-Type: ' -X PUT 'https://upload.wunderlist.io/b3b8b920-9076-0133-a1c3-22000a7b80b0-1451406330-801227?partNumber=1&uploadId=gOhekKMS6wVA_Rf7K_cOL....'

Below is the test case which fails

@test
public void uploadFile(){

String amazongURL = https://upload.wunderlist.io/59e227c0-9078-0133-220b-22000a0e060c-1451407039-71260?partNumber=.....
String awsAuth = AWS AKIAJEN6W4AO3LJODOAA:fo/1vkoLdV...
String awsTime = Tue, 29 Dec 2015 16:42:19 UTC +00:00

final String body2 =
with().
headers("Authorization",awsAuth, "x-amz-date",awsTime, "Content-Type","" ).
when().
put(awsUpload_URL).asString();

                   System.out.println(body2);   

}

Error as below

SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.AKIAJEN6W4AO3LJODOAAPUT

; charset=ISO-8859-1

x-amz-date:Tue, 29 Dec 2015 16:42:19 UTC +00:00
/wunderlist-uploads-production/59e227c0-9078-0133-220b-22000a0e060c-1451407039-71260?partNumber=1&uploadId=Qjq4Eblv9tiV2qkKomJLEcLU267wLXxh6PYZxbOm_1PU38JRAy3WeS6.wT2xxANy534QF_afmcVjHyfRBXSZZ0d.eRqwFq4ikenZQh8gERlhoDicVYEPPS9MoWdpaSWIfo/1vkoLdVdgUEuOzn11vKFmARA=50 55 54 0a 0a 3b 20 63 68 61 72 73 65 74 3d 49 53 4f 2d 38 38 35 39 2d 31 0a 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 54 75 65 2c 20 32 39 20 44 65 63 20 32 30 31 35 20 31 36 3a 34 32 3a 31 39 20 55 54 43 20 2b 30 30 3a 30 30 0a 2f 77 75 6e 64 65 72 6c 69 73 74 2d 75 70 6c 6f 61 64 73 2d 70 72 6f 64 75 63 74 69 6f 6e 2f 35 39 65 32 32 37 63 30 2d 39 30 37 38 2d 30 31 33 33 2d 32 32 30 62 2d 32 32 30 30 30 61 30 65 30 36 30 63 2d 31 34 35 31 34 30 37 30 33 39 2d 37 31 32 36 30 3f 70 61 72 74 4e 75 6d 62 65 72 3d 31 26 75 70 6c 6f 61 64 49 64 3d 51 6a 71 34 45 62 6c 76 39 74 69 56 32 71 6b 4b 6f 6d 4a 4c 45 63 4c 55 32 36 37 77 4c 58 78 68 36 50 59 5a 78 62 4f 6d 5f 31 50 55 33 38 4a 52 41 79 33 57 65 53 36 2e 77 54 32 78 78 41 4e 79 35 33 34 51 46 5f 61 66 6d 63 56 6a 48 79 66 52 42 58 53 5a 5a 30 64 2e 65 52 71 77 46 71 34 69 6b 65 6e 5a 51 68 38 67 45 52 6c 68 6f 44 69 63 56 59 45 50 50 53 39 4d 6f 57 64 70 61 53 57 499DAC9AF1C03F593AQVUotwctsrCVFmpj/amlz6ofBCE5l5CaaLEJWILWHqM0y1kDlBarYVlpAeR+M9t8zO2x4bLJC3o=

@vikramvi
Copy link
Author

http://stackoverflow.com/questions/2777078/amazon-mws-request-signature-calculated-does-not-match-the-signature-provided

also from error I see that

AKIAJEN6W4AO3LJODOAA

instead of expected as below
AWS AKIAJEN6W4AO3LJODOAA:p+7fQ+NLPPWdx7+MCOSY9O5H+1U=

Is this bug which truncates remaining portion of string ?

@johanhaleby
Copy link
Collaborator

Don't know really. Doesn't AWS create an HMAC or something based on the
headers? REST Assured adds headers such as the accept header automatically
which could lead trouble if you use the headers to calculate a hash.

On Tue, Dec 29, 2015 at 5:59 PM, vikramvi notifications@github.com wrote:

http://stackoverflow.com/questions/2777078/amazon-mws-request-signature-calculated-does-not-match-the-signature-provided

also from error I see that

AKIAJEN6W4AO3LJODOAA

instead of expected as below
AWS AKIAJEN6W4AO3LJODOAA:p+7fQ+NLPPWdx7+MCOSY9O5H+1U=

Is this bug which truncates remaining portion of string ?


Reply to this email directly or view it on GitHub
#627 (comment)
.

@vikramvi
Copy link
Author

vikramvi commented Jan 4, 2016

yes AWS create an HMAC , I checked with developer and he says framework adding some stuff to AWS header

basically I want to pass empty content type.

I'm doing below

headers("Authorization",awsAuth, "x-amz-date",awsTime,"Content-type","").

and it gives back

charset=ISO-8859-1

which I don't want

How can I ask framework not to mess up with my headers and use whatever I give to it ?

Thanks,
Vikram

@johanhaleby
Copy link
Collaborator

You can instruct RA not to use supply the "charset=ISO-8859-1"
automatically by using the EncoderConfig
https://github.com/jayway/rest-assured/wiki/Usage#encoder-config, for
example given().
config(RestAssured.config().encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false))).
...

On Mon, Jan 4, 2016 at 4:52 PM, vikramvi notifications@github.com wrote:

yes AWS create an HMAC , I checked with developer and he says framework
adding some stuff to AWS header

basically I want to pass empty content type.

I'm doing below

headers("Authorization",awsAuth, "x-amz-date",awsTime,"Content-type","").

and it gives back

charset=ISO-8859-1

which I don't want

How can I ask framework not to mess up with my headers and use whatever I
give to it ?

Thanks,
Vikram


Reply to this email directly or view it on GitHub
#627 (comment)
.

@vikramvi
Copy link
Author

vikramvi commented Jan 5, 2016

Thanks a ton , it worked.

I will add this scenario and check-in test case to sample repo, which I had shared with you earlier

@vikramvi vikramvi closed this as completed Jan 5, 2016
@johanhaleby
Copy link
Collaborator

Thanks!

vikramvi pushed a commit to vikramvi/RESTful-api-automation that referenced this issue Jan 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants