Esempio n. 1
0
        private string CreateAuthorizationHeader(String canonicalizedString)
        {
            string signature = m_credentials.ComputeHmac(canonicalizedString);

            var header = String.Format(CultureInfo.InvariantCulture, "{0} {1}:{2}",
                                       "SharedKey",
                                       m_credentials.AccountName,
                                       signature);

            return(header);
        }
Esempio n. 2
0
        private static void GenerateAzureAuthHeaders(StorageCredentials storageCredentials, Uri requestUri, out string dateHeader, out string authorizationHeader)
        {
            dateHeader = DateTime.UtcNow.ToString("R", System.Globalization.CultureInfo.InvariantCulture);
            string accountName = storageCredentials.AccountName;
            var    resource    = requestUri.PathAndQuery;

            if (resource.Contains("?"))
            {
                resource = resource.Substring(0, resource.IndexOf("?"));
            }

            string stringToSign = string.Format("{0}\n/{1}{2}",
                                                dateHeader,
                                                accountName,
                                                resource
                                                );

            string signedSignature = storageCredentials.ComputeHmac(stringToSign);

            authorizationHeader = string.Format("{0} {1}:{2}", "SharedKeyLite", accountName, signedSignature);
        }