Skip to content

Commit

Permalink
Update 请求签名.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chuikingfan authored Nov 26, 2024
1 parent c311e62 commit 8611618
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions api/计算与网络/CKafka/调用方式/请求签名.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
![](//mc.qcloudimg.com/static/img/3a3a616ba175bb95be68123d86715e77/image.png)

假设用户的 SecretId 和 SecretKey 分别是:
SecretId:`AKIDz8kr*****FkmLPx3gnPhESA`
SecretId:`AKID*****************`
SecretKey:`Gu5t9xGARNpq*****N3Cozk1qA`

>!这里只是示例,请用户根据自己实际的 SecretId 和 SecretKey 和请求参数进行后续操作。
Expand All @@ -36,7 +36,7 @@ SecretKey:`Gu5t9xGARNpq*****N3Cozk1qA`
| 参数名称 | 描述 | 参数值|
|---------|---------|---------|
| Action | 方法名| ListInstances |
| SecretId | 密钥 ID | `AKIDz8kr*****FkmLPx3gnPhESA` |
| SecretId | 密钥 ID | `AKID*****************` |
| Timestamp | 当前时间戳 | 1465185768 |
| Nonce | 随机正整数 | 11886 |
| Region | 实例所在区域 | ap-guangzhou |
Expand All @@ -50,7 +50,7 @@ SecretKey:`Gu5t9xGARNpq*****N3Cozk1qA`
"Action" : "ListInstances",
"Nonce" : "11886",
"Region" : "ap-guangzhou",
"SecretId" : "AKIDz8kr*****FkmLPx3gnPhESA",
"SecretId" : "AKID*****************",
"SignatureMethod" : "HmacSHA256",
"Timestamp" : "1465185768"
}
Expand All @@ -71,7 +71,7 @@ SecretKey:`Gu5t9xGARNpq*****N3Cozk1qA`
Action=ListInstances
&Nonce=11886
&Region=ap-guangzhou
&SecretId=AKIDz8kr*****FkmLPx3gnPhESA
&SecretId=AKID*****************
&SignatureMethod=HmacSHA256
&Timestamp=1465185768
```
Expand All @@ -92,7 +92,7 @@ Action=ListInstances
GETckafka.api.qcloud.com/v2/index.php?Action=ListInstances
&Nonce=11886
&Region=ap-guangzhou
&SecretId=AKIDz8kr*****FkmLPx3gnPhESA
&SecretId=AKID*****************
&SignatureMethod=HmacSHA256
&Timestamp=1465185768
```
Expand All @@ -107,7 +107,7 @@ GETckafka.api.qcloud.com/v2/index.php?Action=ListInstances

```php
$secretKey = 'Gu5t9xGARNpq*****N3Cozk1qA';
$srcStr = 'GETckafka.api.qcloud.com/v2/index.php?Action=ListInstances&Nonce=11886&Region=ap-guangzhou&SecretId=AKIDz8kr*****FkmLPx3gnPhESA&SignatureMethod=HmacSHA256&Timestamp=1465185768';
$srcStr = 'GETckafka.api.qcloud.com/v2/index.php?Action=ListInstances&Nonce=11886&Region=ap-guangzhou&SecretId=AKID*****************&SignatureMethod=HmacSHA256&Timestamp=1465185768';
$signStr = base64_encode(hash_hmac('sha256', $srcStr, $secretKey, true));
echo $signStr;
```
Expand All @@ -120,7 +120,7 @@ echo $signStr;
同理,当您指定签名算法为 **HmacSHA1** 时,生成签名串的代码如下:
```php
$secretKey = 'Gu5t9x*****ozk1qA';
$srcStr = 'GETcckafka.api.qcloud.com/v2/index.php?Action=ListInstances&Nonce=11886&Region=ap-guangzhou&SecretId=AKIDz8kr*****FkmLPx3gnPhESA&SignatureMethod=HmacSHA1&Timestamp=1465185768';
$srcStr = 'GETcckafka.api.qcloud.com/v2/index.php?Action=ListInstances&Nonce=11886&Region=ap-guangzhou&SecretId=AKID*****************&SignatureMethod=HmacSHA1&Timestamp=1465185768';
$signStr = base64_encode(hash_hmac('sha1', $srcStr, $secretKey, true));
echo $signStr;
```
Expand Down

0 comments on commit 8611618

Please sign in to comment.