Problem description
OSS returns this error when the signature in your PostObject request does not match the signature it calculated.
Causes
Each signature type requires the signature value to be placed in a specific form field. Placing the signature in the wrong field causes a mismatch.
| Signature type | Required form field |
|---|---|
| V1 signature (default) | Signature |
| Amazon S3-compatible V2 signature | Signature |
| V2 signature | x-oss-signature |
| V4 signature | x-oss-signature |
| Amazon S3-compatible V4 signature | x-amz-signature |
Examples
A PostObject request uses the default V1 signature, but the value of the Signature form field is invalid.
Solutions
To compute and submit a valid V1 signature, follow these steps:
Create a policy document encoded in
UTF-8.Encode the policy in Base64. The Base64-encoded result is both the value of the
policyform field and the string-to-sign.Sign the string-to-sign using your
AccessKeySecretand the HMAC-SHA1 algorithm:Signature = base64(hmac-sha1(AccessKeySecret, base64(policy)))Submit the computed signature in the
Signatureform field. The multipart body fragment looks like this:Content-Disposition: form-data; name="Signature" {signature} --9431149156168
For the complete PostObject request structure and all supported form fields, see PostObject.
References
For working code that constructs a signed PostObject request, see: