Error with MBS CURLS Amazon S3 upload example

I am trying to upload a picture with the Amazon S3 example that comes with MBS plugins 20.4 (using Xojo 2019 3.2).

File: CURLS Amazon S3 upload.xojo_binary_project

Does this error mean that there is something wrong with my S3 bucket configuration or is the example not up-to-date?

HTTPResult: 400

OutputData:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>InvalidArgument</Code>
    <Message>x-amz-content-sha256 must be UNSIGNED-PAYLOAD, STREAMING-AWS4-HMAC-SHA256-PAYLOAD, or a valid sha256 value.</Message>
    <ArgumentName>x-amz-content-sha256</ArgumentName>
    <ArgumentValue>36343632363637384442434339314336343941304245424634344644344441344237433144443630383545374438453133363643343745363544304245453344</ArgumentValue>
    <RequestId>DR1T7XFNAG4K8VBW</RequestId>
    <HostId>pbOXcKZLKqKc3LD60fYz6wOud9mklZSsDc5FGnsoDrmFQ51uBgAFgPuueU03Q2OJYTBKhRsHb5U=</HostId>
</Error>

DebugMessage:

Trying 52.219.72.213:443…
Connected to nws-cube.s3.eu-central-1.amazonaws.com (52.219.72.213) port 443 (#0)
ALPN, offering http/1.1
TLSv1.3 (OUT), TLS handshake, Client hello (1):
TLSv1.3 (IN), TLS handshake, Server hello (2):
TLSv1.2 (IN), TLS handshake, Certificate (11):
TLSv1.2 (IN), TLS handshake, Server key exchange (12):
TLSv1.2 (IN), TLS handshake, Server finished (14):
TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
TLSv1.2 (OUT), TLS handshake, Finished (20):
TLSv1.2 (IN), TLS handshake, Finished (20):
SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
ALPN, server did not agree to a protocol
Server certificate:
subject: C=US; ST=Washington; L=Seattle; O=Amazon.com, Inc.; CN=*.s3.eu-central-1.amazonaws.com
start date: Nov 9 00:00:00 2019 GMT
expire date: Dec 10 12:00:00 2020 GMT
issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert Baltimore CA-2 G2
SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
PUT /oli_400.png HTTP/1.1
Host: nws-cube.s3.eu-central-1.amazonaws.com
Authorization: AWS4-HMAC-SHA256 Credential=AKIAWGV3KU6Z7VM2SVOB/20200930/eu-central-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=b9f9de231bc40309a65c02e72f7308f4ff34bc185abc3f19837bff816a0dcae7
Date: Wed, 30 Sep 2020 09:38:56 GMT
x-amz-content-sha256: 36343632363637384442434339314336343941304245424634344644344441344237433144443630383545374438453133363643343745363544304245453344
x-amz-date: 20200930T093856Z
Content-Length: 239055

We are completely uploaded and fine
Mark bundle as not supporting multiuse
HTTP/1.1 400 Bad Request
x-amz-request-id: DR1T7XFNAG4K8VBW
x-amz-id-2: pbOXcKZLKqKc3LD60fYz6wOud9mklZSsDc5FGnsoDrmFQ51uBgAFgPuueU03Q2OJYTBKhRsHb5U=
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Wed, 30 Sep 2020 09:38:57 GMT
Connection: close
Server: AmazonS3

Closing connection 0
TLSv1.2 (OUT), TLS alert, close notify (256):

HashedPayload = SHA256MBS.HashFile(file, True)

Can you change the HashedPayload line to be this?

1 Like

Yes, this worked for me. Thank you very much!

1 Like

Thank you for pointing out the example!

Also I disabled the secret key in the example as that was my real test account!

2 Likes