gpt4 book ai didi

c# - 使用 SAS 生成 blob sasurl

转载 作者:行者123 更新时间:2023-12-03 04:44:42 31 4
gpt4 key购买 nike

我想要获取对 blob 的引用并为其生成 SAS URL。

如何?不暴露我的存储帐户 key ?

我尝试过什么?使用 SAS(Blob 容器或存储帐户)获取对 Blob 的引用。我的引用资料:https://learn.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1?toc=%2fazure%2fstorage%2fblobs%2ftoc.json

我看到的异常:“除非使用帐户 key 凭据,否则无法创建共享访问签名

但我(显然)不想暴露我的帐户 key !这可能吗?如果不行的话还有其他办法吗?

最佳答案

简而言之:不,除了使用其中一个键之外,没有其他方法可以做到这一点。您需要访问 key 之一才能创建 SAS token 。以下是您无法使用现有 SAS token 执行此操作的原因:

The signature is an HMAC computed over the string-to-sign and key using the SHA256 algorithm, and then encoded using Base64 encoding.

这意味着作为 SAS token 一部分的签名是一个计算值。该计算的一部分基于(其中一个) key ,因为它用于计算不可逆哈希值。该哈希值不可逆的事实意味着您无法检索用于计算哈希值的访问 key 。因此,您无法使用 SAS token 创建另一个 SAS token :您没有可用于计算签名的访问 key 。

When you create a storage account, you get two storage access keys, which provide full control over the storage account contents. These keys are admin credentials.

更多信息:Constructing a Service SAS

关于c# - 使用 SAS 生成 blob sasurl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46466356/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com