0002-00000705

更新时间:
复制 MD 格式

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 typeRequired form field
V1 signature (default)Signature
Amazon S3-compatible V2 signatureSignature
V2 signaturex-oss-signature
V4 signaturex-oss-signature
Amazon S3-compatible V4 signaturex-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:

  1. Create a policy document encoded in UTF-8.

  2. Encode the policy in Base64. The Base64-encoded result is both the value of the policy form field and the string-to-sign.

  3. Sign the string-to-sign using your AccessKeySecret and the HMAC-SHA1 algorithm:

       Signature = base64(hmac-sha1(AccessKeySecret, base64(policy)))
  4. Submit the computed signature in the Signature form 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: