public string GetSharedAccessSignature(SharedAccessAccountPolicy policy)
        {
            if (!Credentials.IsSharedKey)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Cannot create Shared Access Signature unless Account Key credentials are used."));
            }
            string hash = SharedAccessSignatureHelper.GetHash(policy, Credentials.AccountName, "2018-03-28", Credentials.Key);

            return(SharedAccessSignatureHelper.GetSignature(policy, hash, Credentials.KeyName, "2018-03-28").ToString());
        }
Exemple #2
0
        public string GetSharedAccessSignature(SharedAccessTablePolicy policy, string accessPolicyIdentifier, string startPartitionKey, string startRowKey, string endPartitionKey, string endRowKey, SharedAccessProtocol?protocols, IPAddressOrRange ipAddressOrRange)
        {
            if (!ServiceClient.Credentials.IsSharedKey)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Cannot create Shared Access Signature unless Account Key credentials are used."));
            }
            string             canonicalName = GetCanonicalName();
            StorageCredentials credentials   = ServiceClient.Credentials;
            string             hash          = SharedAccessSignatureHelper.GetHash(policy, accessPolicyIdentifier, startPartitionKey, startRowKey, endPartitionKey, endRowKey, canonicalName, "2018-03-28", protocols, ipAddressOrRange, credentials.Key);

            return(SharedAccessSignatureHelper.GetSignature(policy, Name, accessPolicyIdentifier, startPartitionKey, startRowKey, endPartitionKey, endRowKey, hash, credentials.KeyName, "2018-03-28", protocols, ipAddressOrRange).ToString());
        }