private static HashSet <string> GetSearchableCertificates(IEnumerable <string> certificateFqdns)
        {
            HashSet <string> hashSet = new HashSet <string>();

            if (certificateFqdns != null && certificateFqdns.Any <string>())
            {
                foreach (string text in certificateFqdns)
                {
                    if (!string.IsNullOrWhiteSpace(text))
                    {
                        if (!hashSet.Contains(text))
                        {
                            hashSet.Add(text);
                        }
                        string             text2 = string.Empty;
                        string             text3 = string.Empty;
                        SmtpX509Identifier smtpX509Identifier;
                        SmtpDomain         smtpDomain;
                        if (SmtpX509Identifier.TryParse(text, out smtpX509Identifier))
                        {
                            if (smtpX509Identifier != null && smtpX509Identifier.SubjectCommonName != null && smtpX509Identifier.SubjectCommonName.SmtpDomain != null)
                            {
                                text2 = smtpX509Identifier.SubjectCommonName.SmtpDomain.Domain;
                            }
                        }
                        else if (SmtpDomain.TryParse(text, out smtpDomain) && smtpDomain != null)
                        {
                            text2 = smtpDomain.Domain;
                        }
                        if (!string.IsNullOrWhiteSpace(text2))
                        {
                            int num = -1;
                            do
                            {
                                num = text2.IndexOf('.', num + 1);
                                if (num != -1)
                                {
                                    if (!string.IsNullOrWhiteSpace(text3))
                                    {
                                        string item = "*." + text3;
                                        if (!hashSet.Contains(item))
                                        {
                                            hashSet.Add(item);
                                        }
                                    }
                                    text3 = text2.Substring(num + 1);
                                }
                            }while (num != -1);
                        }
                    }
                }
            }
            return(hashSet);
        }