crowdmob/goamz — pull request #215 by jtblin (2014-09-03 02:02:12+00:00)
Title: Fix s3 signature by sorting x-amz headers by their key

This fix getting **The request signature we calculated does not match the signature you provided. Check your key and signing method** error when using server-side encryption headers with s3.

To create the signature for s3, headers need to be sorted by their key. Currently they are sorted with `key:value`. This is not a problem most of the time, except when one header is the root of another one as for custom server side encryption headers `x-amz-server-side-encryption-customer-key` and `x-amz-server-side-encryption-customer-key-md5`.

See https://github.com/aws/aws-sdk-js/blob/master/lib/signers/s3.js#L82 for correct implementation.