Beispiel #1
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);
        }
Beispiel #2
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);
        }