Using FineUploader and on my page, attempted a manual retry of a previously failed upload request (several hours later).
The signature request to my server comes in "headers" i.e signaling a multi-part. I do the calculations and send only the signature (no policy file here), largely following a Python implementation.
However AWS rejects the request with a SignatureDoesNotMatch.
Is there a timelimit on AWS side within which the request must be retried ? Below is the JS implementation of the multipart signature request. Any help appreicated.
function s3CredentialsMP(config, headers) {
console.log("Signing the below str");
console.log(headers);
splits = headers.split("POST");
creq = splits[1];
bHdr = splits[0];
canonical_req = "POST" + creq;
algo = bHdr[0];
amz_date = bHdr[1];
cred_scope = bHdr[2];
cred_parts = cred_scope.split('/');
date_stamp = cred_parts[0];
regionName = cred_parts[1];
serviceName = cred_parts[2];
signingKey = s3UploadSigningKey(config, date_stamp, regionName, serviceName);
CryptoJS = require("crypto-js");
hexDigestCreq = CryptoJS.SHA256(creq).toString(CryptoJS.enc.Hex);
string_to_sign = algo + "\n" + amz_date + "\n" + cred_scope +
"\n" + hexDigestCreq;
sigVal = hmac(config.secretKey, string_to_sign).toString('hex');
return {
signature: sigVal
}
}
Params IN multi-part sig request :
AWS4-HMAC-SHA256
20170330T120109Z
20170330/us-west-2/s3/aws4_request
POST
/1143%20Delivered.las
uploads=
host:lasfupload.s3-us-west-2.amazonaws.com
x-amz-acl:private
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20170330T120109Z
x-amz-meta-qqfilename:1143%20Delivered.las
host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-meta-qqfilename
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Signature : 2231a6dd8dc0917def780bfc114ed10e459f8f748195c2d05c217684461dfec1