Esempio n. 1
0
        public static byte[] GenerateDigestValue(string filePath, CMS_HASH_DIGESTMETHOD digestMethod, CMS_HASH_TRANSFORM transform)
        {
            Stream inputStream = (Stream)null;

            try
            {
                HashAlgorithm hashAlgorithm = ComponentVerifier.GetHashAlgorithm(digestMethod);
                inputStream = ComponentVerifier.GetTransformedStream(filePath, transform);
                return(hashAlgorithm.ComputeHash(inputStream));
            }
            finally
            {
                if (inputStream != null)
                {
                    inputStream.Close();
                }
            }
        }