public static bool HasRootIn(this X509Chain chain, X509Certificate2Collection extraTrustedRootCertificates) { if (extraTrustedRootCertificates == null || extraTrustedRootCertificates.Count == 0) { return(false); } return(extraTrustedRootCertificates.Contains(chain.Root().Certificate)); }