You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

华为App Gallery API上传APK报错:签名验证不匹配

问题现象

通过Bash脚本调用华为App Gallery API上传APK/AAB文件,已成功获取上传URL及所需参数,但执行文件上传步骤时返回签名不匹配错误:

The request signature we calculated does not match the signature you provided. Check your key and signing method.

操作过程

  1. 按照《Obtaining the File Upload URL》文档要求,设置移除冒号后的sha256参数:
sha256="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  1. 调用API获取上传URL,将响应存入old.json并解析上传所需参数:
curl -s -H 'Content-Type: application/json' -H "Authorization: Bearer $token" -H "client_id: $clientid"  -X GET 'https://connect-api.cloud.huawei.com/api/publish/v2/upload-url/for-obs?...' | jq . > old.json

url=$(cat old.json | jq -r .urlInfo.url)
authorization=$(cat old.json | jq -r .urlInfo.headers.Authorization)
amzcontent256=$(cat old.json | jq -r '.urlInfo.headers."x-amz-content-sha256"')
amz256date=$(cat old.json | jq -r '.urlInfo.headers."x-amz-date"')
hosttype=$(cat old.json | jq -r .urlInfo.headers.Host)
useragent=$(cat old.json | jq -r '.urlInfo.headers."user-agent"')
contentyp=$(cat old.json | jq -r '.urlInfo.headers."Content-Type"')
  1. 使用解析出的参数发起文件上传请求:
curl -H 'Content-Type: application/octet-stream' -H "x-amz-content-sha256:$amzcontent256" -H "x-amz-date:$amz256date" -H "Host:$hosttype"  -H "user-agent:$useragent" -H "Authorization:$authorization" -F 'file=@/Users/app1/apkfolder/test.apk' -X PUT $uploadurl

上传响应错误

return (<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.
)

已确认sha256变量值与App Gallery中目标应用的sha256指纹完全一致,但仍出现该签名错误,怀疑shaKey设置环节存在问题,求排查解决方法。

内容的提问来源于stack exchange,提问作者Selimcan Kacar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 20:21:20