public CertificateResolverFacts()
        {
            m_resolver = CreateResolver(true, 60, false); // enable caching, ttl=60secs, disable negative caching 

            m_cache = m_resolver.Cache;

            ClearCache();            
        }
Example #2
0
        /// <summary>
        /// Creates a certificate resolver that retrieves certificates from the given certificate index instance.
        /// </summary>
        /// <param name="index">
        /// An index instance providing <see cref="IX509CertificateIndex"/>
        /// </param>
        /// <param name="cacheSettings">
        /// The cache settings to use. Specify null for no caching.
        /// </param>
        public CertificateResolver(IX509CertificateIndex index, CacheSettings cacheSettings)
        {
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }

            m_certIndex = index;

            if (cacheSettings != null && cacheSettings.Cache)
            {
                m_certificateCache = new CertificateCache(cacheSettings);
            }
        }
Example #3
0
        /// <summary>
        /// Creates a certificate resolver that retrieves certificates from the given certificate index instance. 
        /// </summary>
        /// <param name="index">
        /// An index instance providing <see cref="IX509CertificateIndex"/>
        /// </param>
        /// <param name="cacheSettings">
        /// The cache settings to use. Specify null for no caching.
        /// </param>
        public CertificateResolver(IX509CertificateIndex index, CacheSettings cacheSettings)
        {
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }

            m_certIndex = index;

            if (cacheSettings != null && cacheSettings.Cache)
            {
                m_certificateCache = new CertificateCache(cacheSettings); 
            }
        }
        public void CachingVerifyDisabledNullCacheSettings()
        {
            using (SystemX509Store store = SystemX509Store.OpenExternal())
            {
                m_resolver = new CertificateResolver(store, null);                
                m_cache = m_resolver.Cache;
                string domain = DomainIncubator;
                X509Certificate2Collection source = m_resolver.GetCertificatesForDomain(domain);

                Assert.Null(m_resolver.Cache);
                Assert.True(source.Count > 0);
            }
        }