Problem description
The X-Amz-Signature value in the request is invalid.
Causes
The request uses the Amazon S3-compatible Signature Version 4 (SigV4), but the X-Amz-Signature value does not meet the required format.
SigV4 computes the signature using HMAC-SHA256, which produces a 32-byte output. After hex encoding (2 characters per byte), the result is always a 64-character string. Any value that is too short, too long, or otherwise malformed is rejected.
Examples
The following request has an invalid X-Amz-Signature value:
GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=abc HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: trueThe X-Amz-Signature value abc is only 3 characters. A valid signature must be exactly 64 characters.
Solutions
Fix the signature
Verify that:
The
X-Amz-Signaturevalue is a 64-character string.The presigned URL is complete — no parameters are missing or truncated.
All fields of the request are correctly configured.
A correctly formed request looks like this:
GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2s**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: trueUse an SDK to generate signed requests
Use Amazon S3 SDKs to construct presigned URLs rather than building them manually. SDKs compute the signature automatically and prevent formatting errors. For setup instructions, see Use Amazon S3 SDKs to access OSS.