Exemplo n.º 1
0
 public static IEnumerable <CngAlgorithm> GetSupportedAlgorithms(this CngProvider provider,
                                                                 NCryptAlgorithmOperations operations)
 {
     using (SafeNCryptProviderHandle providerHandle = provider.OpenProvider())
     {
         foreach (NCryptNative.NCryptAlgorithmName algorithm in NCryptNative.EnumerateAlgorithms(providerHandle, operations))
         {
             yield return(new CngAlgorithm(algorithm.pszName));
         }
     }
 }
Exemplo n.º 2
0
        public static IEnumerable <CngAlgorithm> GetSupportedAlgorithms(this CngProvider provider,
                                                                        NCryptAlgorithmOperations operations)
        {
            using (SafeNCryptProviderHandle providerHandle = provider.OpenProvider())
            {
                NCryptNative.NCryptAlgorithmName[] algorithmNames = NCryptNative.EnumerateAlgorithms(providerHandle, operations);
                CngAlgorithm[] algorithms = new CngAlgorithm[algorithmNames.Length];

                for (int i = 0; i < algorithmNames.Length; ++i)
                {
                    algorithms[i] = new CngAlgorithm(algorithmNames[i].pszName);
                }

                return(algorithms);
            }
        }