public void TestDomain() { DummyX509Index index = new DummyX509Index(); CertificateResolver resolver = new CertificateResolver(index, null); resolver.GetCertificatesForDomain("redmond.hsgincubator.com"); Assert.True(index.Log.Count == 1); Assert.True(index.Log[0] == "redmond.hsgincubator.com"); }
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); } }
public void CachingVerifyDisabled() { m_resolver = CreateResolver( false, /* caching disabled */ 0, /* TTL */ false); /* negative caching */ string domain = DomainIncubator; X509Certificate2Collection source = m_resolver.GetCertificatesForDomain(domain); X509Certificate2Collection cached = m_cache.Get(domain); Assert.Null(cached); Assert.True(source.Count > 0); }
public void CachingVerifyTTL() { m_resolver = CreateResolver( true, /* caching enabled */ 3, /* TTL */ false); /* negative cache */ string domain = DomainIncubator; X509Certificate2Collection source = m_resolver.GetCertificatesForDomain(domain); X509Certificate2Collection cached = m_cache.Get(domain); VerifyValidCert(source, cached); Thread.Sleep(4000); // verify its evicted from cache. cached = m_cache.Get(domain); Assert.Null(cached); // now get it served from the cache. source = m_resolver.GetCertificatesForDomain(domain); cached = m_cache.Get(domain); VerifyValidCert(source, cached); }