简体   繁体   English

使用Azure存储API生成Azure共享访问签名

[英]Generate Azure Shared Access Signature with out using Azure Storage API

I have seen that SAS can be generated using Storage API. 我已经看到可以使用Storage API生成SAS。
Is there a way to generate it from Management Studio or with out using API? 有没有一种方法可以从Management Studio生成它,也可以不使用API​​生成它?

You could create a SAS using REST API. 您可以使用REST API创建SAS。 In fact, storage client library is just a wrapper over this REST API. 实际上,存储客户端库只是该REST API的包装。 Here's the link for creating SAS using REST API: http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx . 这是使用REST API创建SAS的链接: http : //msdn.microsoft.com/zh-cn/library/windowsazure/dn140255.aspx

This document describes how the SAS should be generated. 本文档介绍了如何生成SAS。 You can use the API / SDK or you can write your own code for it. 您可以使用API / SDK ,也可以为其编写自己的代码。

The string-to-sign is a unique string constructed from the fields that must be verified in order to authenticate the request. 字符串签名是一个唯一的字符串,由必须验证才能验证请求的字段构成。 The signature is an HMAC computed over the string-to-sign and key using the SHA256 algorithm, and then encoded using Base64 encoding. 签名是使用SHA256算法在字符串到符号和密钥上计算的HMAC,然后使用Base64编码进行编码。

For example in the latest version you make the string to sign like this: 例如,在最新版本中,您使字符串像这样签名:

StringToSign = signedpermissions + "\n" +
               signedstart + "\n" +
               signedexpiry + "\n" +
               canonicalizedresource + "\n" +
               signedidentifier + "\n" +
               signedIP + "\n" +
               signedProtocol + "\n" +
               signedversion + "\n" +
               rscc + "\n" +
               rscd + "\n" +
               rsce + "\n" +
               rscl + "\n" +
               rsct

and then you'd compute the hash of that and encode. 然后计算该哈希值并进行编码。

You're much better off using the SDK if possible, else grabbing some existing code that does it instead of writing from scratch. 如果可能的话,您最好使用SDK,否则,请抓住一些现有的实现此功能的代码,而不是从头开始编写。 eg see this question or this , or maybe the SDK code is available so you can just inspect that and take the bits you like. 例如,请参阅此问题this ,或者SDK代码可用,因此您可以检查一下并取所需的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 Azure blob 存储中的文件夹生成共享访问签名? - How to generate a Shared access signature for a folder in Azure blob storage? 使用Node.js Azure存储为一个文件生成共享访问签名(SAS) - Generate Shared Access Signature (SAS) for one file using nodejs azure storage 在img标签中为Azure Blob存储使用共享访问签名Uri - Using Shared Access Signature Uri in img tag for Azure Blob Storage 使用 SAS(共享访问签名)使用 Azure 存储上传文件 - Upload file with Azure Storage using SAS (Shared Access Signature) 整个存储帐户的 Azure 共享访问签名 - Azure Shared Access Signature for whole storage account Azure消息队列-生成共享访问签名 - Azure Message Queue -Generate Shared Access Signature Azure Blob 存储共享访问签名 (SAS) - 签名不匹配 - Azure Blob Storage Shared Access Signature (SAS) - Signature did not match Azure共享访问签名 - Azure Shared Access Signature 没有API的Azure Blob共享访问签名 - Azure Blob Shared Access Signature without the api 是否可以在azure blob存储中为给定目录生成具有写许可权的SAS(共享访问签名) - Is it possible to generate SAS (Shared Access Signature) with write permission for given directory in azure blob storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM