Selimcan Kacar
Selimcan Kacar

Reputation: 11

Huawei APK Uploading Error: Calculated Signature does not match

I am trying to upload apk/aab file to Huawei App Gallery via APIs. I successfully get upload URL and necessary parameters to upload a file. On upload file step I get this error. I used bash.

Error message:

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

Based on this document page about Obtaining the File Upload URL, I have assigned sha parameter to variable like this. I removed ":" between characters.

sha256="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"

with this sha256 and other parameters, I get upload url successfully. I store response body to a json file, and parse needed parts for upload file request.

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"')

I use this parameters in upload request.

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

Response says

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

I am positive that my sha variable and sha256 fingerprint on app gallery on targeted app is same.

I think I assign sha key wrong but I don't know what to do at this point.

Upvotes: 0

Views: 148

Answers (0)

Related Questions