Beispiel #1
0
 public static CspCNGCollection EnumCNGProviders()
 {
     if (!CryptographyUtils.TestCNGCompat())
     {
         throw new PlatformNotSupportedException();
     }
     return(m_enumcngprovs());
 }
Beispiel #2
0
        public static CspObject[] EnumProviders()
        {
            if (!CryptographyUtils.TestCNGCompat())
            {
                throw new PlatformNotSupportedException();
            }
            var csps = new CCspInformations();

            csps.AddAvailableCsps();

            return((from ICspInformation csp in csps select new CspObject(csp)).ToArray());
        }
Beispiel #3
0
        public static CspProviderInfoCollection GetProviderInfo()
        {
            if (!CryptographyUtils.TestCNGCompat())
            {
                throw new PlatformNotSupportedException();
            }

            var csps = new CCspInformations();

            csps.AddAvailableCsps();
            var retValue = new CspProviderInfoCollection();

            retValue.AddRange((from ICspInformation csp in csps select new CspProviderInfo(csp)).ToArray());
            CryptographyUtils.ReleaseCom(csps);
            return(retValue);
        }
Beispiel #4
0
        /// <summary>
        /// Gets named registered Cryptographic Service Provider (CSP) or Key Storage Provider (KSP), its
        /// information and supported cryptographic algorithms.
        /// </summary>
        /// <param name="name">Cryptographic provider name.</param>
        /// <exception cref="PlatformNotSupportedException">
        /// Current platform does not support key storage providers (prior to Windows Vista).
        /// </exception>
        /// <returns>Specified provider information. Method returns null if provider is not found.</returns>
        public static CspProviderInfo GetProviderInfo(String name)
        {
            if (!CryptographyUtils.TestCNGCompat())
            {
                throw new PlatformNotSupportedException();
            }
            var providers = new CCspInformations();

            providers.AddAvailableCsps();
            try {
                ICspInformation provider = providers.ItemByName[name];
                return(new CspProviderInfo(provider));
            } catch {
                return(null);
            }
        }
Beispiel #5
0
        public static CspProviderInfoCollection GetProviderInfo(String name)
        {
            if (!CryptographyUtils.TestCNGCompat())
            {
                throw new PlatformNotSupportedException();
            }

            var csps = new CCspInformations();

            csps.AddAvailableCsps();
            var retValue = new CspProviderInfoCollection {
                new CspProviderInfo(csps.ItemByName[name])
            };

            CryptographyUtils.ReleaseCom(csps);
            return(retValue);
        }