<PackageReference Include="Azure.Storage.Common" Version="12.24.0" />

StorageSharedKeyCredential

A StorageSharedKeyCredential is a credential backed by a Storage Account's name and one of its access keys.
using System; using System.Security.Cryptography; using System.Text; using System.Threading; namespace Azure.Storage { public class StorageSharedKeyCredential { private byte[] _accountKeyValue; public string AccountName { get; } private byte[] AccountKeyValue { get { return Volatile.Read(ref _accountKeyValue); } set { Volatile.Write(ref _accountKeyValue, value); } } public StorageSharedKeyCredential(string accountName, string accountKey) { AccountName = accountName; SetAccountKey(accountKey); } public void SetAccountKey(string accountKey) { AccountKeyValue = Convert.FromBase64String(accountKey); } internal string ComputeHMACSHA256(string message) { return Convert.ToBase64String(HMACSHA256.HashData(AccountKeyValue, Encoding.UTF8.GetBytes(message))); } protected static string ComputeSasSignature(StorageSharedKeyCredential credential, string message) { return credential.ComputeHMACSHA256(message); } } }