Azure / azure-storage-blob-go

Microsoft Azure Blob Storage Library for Go
MIT License
157 stars 102 forks source link

Signature did not match. String to sign used was rcwl #327

Closed zhangtiedong0912 closed 2 years ago

zhangtiedong0912 commented 2 years ago

Which version of the SDK was used?

v0.8.0

Which platform are you using? (ex: Windows, Linux, Debian)

MacOS

What problem was encountered?

It's raise this error when i generate a token and try to upload an image. (I expect to create a SAS token on the Container and upload images to SAS using this token)

Signature did not match. String to sign used was rcwl
2022-09-30T05:30:10Z
2022-10-01T11:30:10Z
/blob/otdatastorage/storage98
credential, err := azblob.NewSharedKeyCredential("otdatastorage", key)
if err != nil {
    return
}
sasSignatureValues := azblob.BlobSASSignatureValues{
    Protocol:      azblob.SASProtocolHTTPS,
    ExpiryTime:    time.Now().UTC().Add(20 * time.Hour),
    ContainerName: "storage98",
    BlobName:      "",
    Permissions:   azblob.ContainerSASPermissions{Write: true, List: true, Create: true, Read: true}.String(),
    Version:       "2021-06-08",
}
sasQueryParams, err := sasSignatureValues.NewSASQueryParameters(credential)
if err != nil {
    fmt.Println(err)
}
fmt.Println(sasQueryParams.Encode())

How can we reproduce the problem in the simplest way?

Have you found a mitigation/solution?

I Googled and tried everything: I checked the time and key, but nothing worked

zhangtiedong0912 commented 2 years ago

i remove the version, it works