/// <summary>
 /// Loads certificates from a LocalMachine Certificate store named "NHINAnchors"
 /// </summary>
 public static TrustAnchorResolver CreateDefault()
 {
     using (SystemX509Store store = SystemX509Store.OpenAnchor())
     {
         UniformCertificateResolver anchors = new UniformCertificateResolver(store.GetAllCertificates());
         return(new TrustAnchorResolver(anchors));
     }
 }
        /*
         *  These methods work with the default Direct Project Certificate Stores
         */

        /// <summary>
        /// Creates the default Direct Project machine stores if they don't already exist
        /// </summary>
        public static void CreateAll()
        {
            SystemX509Store store;

            store = SystemX509Store.OpenAnchorEdit();
            store.Dispose();

            store = SystemX509Store.OpenExternalEdit();
            store.Dispose();

            store = SystemX509Store.OpenPrivateEdit();
            store.Dispose();
        }
        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});
        }