0002-00000223

更新时间:
复制 MD 格式

Problem description

The SignDate value in the x-oss-credential header uses an invalid date format.

Causes

V4 signature authentication requires SignDate in compact format (YYYYMMDD). The request uses a hyphenated format (YYYY-MM-DD), which OSS does not accept.

The x-oss-credential header must follow this format:

<AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request

SignDate must not contain hyphens. Use 20221220, not 2022-12-20.

Examples

The following request fails because SignDate is set to 2022-12-20 instead of 20221220:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************/2022-12-20/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

Solutions

Change SignDate from 2022-12-20 to 20221220:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

If the server returns a response that contains the StringToSign parameter, verify that the StringToSign value on the server matches the string before calculation.

References