Exemplo n.º 1
0
        /// <inheritdoc cref="ICertConfigD.EnumConfigEntries"/>
        public static ICertConfigEntryD[] EnumConfigEntries()
        {
            var list       = new List <ICertConfigEntryD>();
            var certConfig = new CCertConfigClass();

            while (certConfig.Next() >= 0)
            {
                list.Add(new CertConfigEntryD(certConfig));
            }
            Marshal.FinalReleaseComObject(certConfig);
            return(list.ToArray());
        }
Exemplo n.º 2
0
        /// <inheritdoc cref="ICertConfigD.FindConfigEntryByServerName"/>
        public static ICertConfigEntryD FindConfigEntryByServerName(String computerName)
        {
            var certConfig = new CCertConfigClass();

            while (certConfig.Next() >= 0)
            {
                try {
                    if (certConfig.GetField("Server").Equals(computerName, StringComparison.OrdinalIgnoreCase))
                    {
                        var entry = new CertConfigEntryD(certConfig);
                        Marshal.FinalReleaseComObject(certConfig);
                        return(entry);
                    }
                } catch { }
            }
            return(null);
        }
Exemplo n.º 3
0
        /// <inheritdoc cref="ICertConfigD.FindConfigEntryByCertificateName"/>
        public static ICertConfigEntryD FindConfigEntryByCertificateName(String caName)
        {
            var certConfig = new CCertConfigClass();

            while (certConfig.Next() >= 0)
            {
                try {
                    if (certConfig.GetField("CommonName").Equals(caName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        var entry = new CertConfigEntryD(certConfig);
                        Marshal.FinalReleaseComObject(certConfig);
                        return(entry);
                    }
                } catch { }
            }
            return(null);
        }