/// <summary>
        /// Creates the machine store trust anchor resolver from configuration settings.
        /// </summary>
        /// <returns>The configured machine store trust anchor resolver.</returns>
        public override ITrustAnchorResolver CreateResolver()
        {
            this.Validate();

            SystemX509Store outgoing = null;
            SystemX509Store incoming = null;

            try
            {
                outgoing = this.Outgoing.OpenStore();
                incoming = this.Incoming.OpenStore();

                return(new TrustAnchorResolver((IX509CertificateStore)outgoing, (IX509CertificateStore)incoming));
            }
            finally
            {
                if (outgoing != null)
                {
                    outgoing.Dispose();
                }
                if (incoming != null)
                {
                    incoming.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        private CertificateResolver CreateResolver(bool cachingEnabled, int ttlSeconds, bool negativeCache)
        {
            if (m_certStore != null)
            {
                m_certStore.Dispose();
            }

            m_certStore     = SystemX509Store.OpenExternal();
            m_negativeCache = negativeCache;

            return(new CertificateResolver(
                       m_certStore,
                       new CacheSettings()
            {
                Name = TestCacheName,
                Cache = cachingEnabled,
                NegativeCache = negativeCache,
                CacheTTLSeconds = ttlSeconds
            }));
        }