コード例 #1
0
        /// <summary>
        /// Determines whether an other <see cref="StorageCredentials"/> object is equal to this one by comparing their SAS tokens, account names, key names, and key values.
        /// </summary>
        /// <param name="other">The <see cref="StorageCredentials"/> object to compare to this one.</param>
        /// <returns><c>true</c> if the two <see cref="StorageCredentials"/> objects are equal; otherwise, <c>false</c>.</returns>
        public bool Equals(StorageCredentials other)
        {
            if (other == null)
            {
                return(false);
            }
            else
            {
                StorageAccountKey thisAccountKey  = this.Key;
                StorageAccountKey otherAccountKey = other.Key;

                return(string.Equals(this.SASToken, other.SASToken) &&
                       string.Equals(this.AccountName, other.AccountName) &&
                       string.Equals(thisAccountKey.KeyName, otherAccountKey.KeyName) &&
                       string.Equals(GetBase64EncodedKey(thisAccountKey), GetBase64EncodedKey(otherAccountKey)));
            }
        }
コード例 #2
0
 private static string GetBase64EncodedKey(StorageAccountKey accountKey)
 {
     return((accountKey.KeyValue == null) ? null : Convert.ToBase64String(accountKey.KeyValue));
 }
コード例 #3
0
        /// <summary>
        /// Exports the value of the account access key to a Base64-encoded string.
        /// </summary>
        /// <returns>The account access key.</returns>
        public string ExportBase64EncodedKey()
        {
            StorageAccountKey thisAccountKey = this.Key;

            return(GetBase64EncodedKey(thisAccountKey));
        }