Amazon.Util.CryptoUtilFactory.CryptoUtil.HMACSignBinary C# (CSharp) Метод

HMACSignBinary() публичный Метод

public HMACSignBinary ( byte data, byte key, SigningAlgorithm algorithmName ) : byte[]
data byte
key byte
algorithmName SigningAlgorithm
Результат byte[]
            public byte[] HMACSignBinary(byte[] data, byte[] key, SigningAlgorithm algorithmName)
            {
                if (key == null || key.Length == 0)
                    throw new ArgumentNullException("key", "Please specify a Secret Signing Key.");

                if (data == null || data.Length == 0)
                    throw new ArgumentNullException("data", "Please specify data to sign.");

                KeyedHashAlgorithm algorithm = ThreadSafeCreateKeyedHashedAlgorithm(algorithmName);
                if (null == algorithm)
                    throw new InvalidOperationException("Please specify a KeyedHashAlgorithm to use.");

                try
                {
                    algorithm.Key = key;
                    byte[] bytes = algorithm.ComputeHash(data);
                    return bytes;
                }
                finally
                {
                    algorithm.Clear();
                }
            }