I've successfuly used curl as a POC to compute signatures on the fly and PUT user files directly to Amazon S3 : Direct file upload to S3 using sigv4
Now I'm working on my real case : browser based uploads using POST.
I'm following the instructions described here : http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html
I'm computing my signature and using a corresponding form - minus some fields (see below Form).
Strangely, I got an error after form submit (see below MissingSignatureError)... I'm forced to add a "Signature" field which is not present in the Amazon example form. And when I replace my "X-Amz-Signature" field by "Signature", the typical "SignatureDoesNotMatch" error appears.
This seems very weird to me. Why is this ? Is Amazon not auto. using Sigv4 ? Is the Amazon documentation incorrect ?
Form
<form action="https://??.s3.amazonaws.com/" method="post" enctype="multipart/form-data">
Key to upload: <input type="input" name="key" value="recordtest/testpost.jpg" /><br />
Content-Type: <input type="input" name="Content-Type" value="image/jpeg" /><br />
<input type="hidden" name="AWSAccessKeyId" value="??" />
<input type="text" name="X-Amz-Credential" value="??/eu-west-1/s3/aws4_request" />
<input type="text" name="X-Amz-Algorithm" value="AWS4-HMAC-SHA256" />
<input type="text" name="X-Amz-Date" value="20170301T173312Z" />
<input type="hidden" name="Policy" value="eyAiZXhwaXJhdGlvbiI6ICIyMDE3LTAzLTAxVDE4OjMzOjEyLjc0MFoiLAogICJjb25kaXRpb25zIjogWwogICAgeyJidWNrZXQiOiAidGVsbWVkLXRlc3QifSwKICAgIHsieC1hbXotY3JlZGVudGlhbCI6ICJBS0lBSlA1STZaS1JPUkpHNDZaQS8yMDE3MDMwMS9ldS13ZXN0LTEvczMvYXdzNF9yZXF1ZXN0In0sCiAgICB7IngtYW16LWFsZ29yaXRobSI6ICJBV1M0LUhNQUMtU0hBMjU2In0sCiAgICB7IngtYW16LWRhdGUiOiAiMjAxNzAzMDFUMTczMzEyWiJ9CiAgXQp9" />
<input type="hidden" name="X-Amz-Signature" value="38f054500c98f0df20a3bdb165d3a24659dafd5c7f9c8961f7aaa1694660a980" />
File: <input type="file" name="file" /> <br />
<!-- The elements after this will be ignored -->
<input type="submit" name="submit" value="Upload to Amazon S3" />
</form>
MissingSignatureError
<Error>
<Code>InvalidArgument</Code>
<Message>
Bucket POST must contain a field named 'Signature'. If it is specified, please check the order of the fields.
</Message>
</Error>
SignatureDoesNotMatch
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>
...
</Error>