Ejemplo n.º 1
0
        public void ResetStores(string[] args)
        {
            SystemX509Store store;

            WriteLine("Removing all Machine Private Certs");
            using (store = SystemX509Store.OpenPrivateEdit())
            {
                foreach (var certificate in store.GetAllCertificates())
                {
                    store.Remove(certificate);
                }
            }

            WriteLine("Removing all Machine Public Certs");
            using (store = SystemX509Store.OpenExternalEdit())
            {
                foreach (var certificate in store.GetAllCertificates())
                {
                    store.Remove(certificate);
                }
            }

            WriteLine("Removing all Machine Anchors Certs");
            using (store = SystemX509Store.OpenAnchorEdit())
            {
                foreach (var certificate in store.GetAllCertificates())
                {
                    store.Remove(certificate);
                }
            }
        }
Ejemplo n.º 2
0
        public void EnsureMachineStores(string[] args)
        {
            SystemX509Store store = null;

            using (store = SystemX509Store.OpenPrivateEdit())
            {
                WriteLine("Created Private Store");
            }
            using (store = SystemX509Store.OpenExternalEdit())
            {
                WriteLine("Created Public Store");
            }
            using (store = SystemX509Store.OpenAnchorEdit())
            {
                WriteLine("Created Anchor Store");
            }
        }
Ejemplo n.º 3
0
        private static SystemX509Store OpenStore(string storeName)
        {
            SystemX509Store store;

            switch (storeName.ToLower())
            {
            case "public":
                store = SystemX509Store.OpenExternalEdit();
                break;

            case "private":
                store = SystemX509Store.OpenPrivateEdit();
                break;

            default:
                throw new ArgumentException(storeName);
            }
            return(store);
        }
Ejemplo n.º 4
0
        void EnsureStandardMachineStores(string path)
        {
            SystemX509Store.CreateAll();

            string basePath          = path;
            string redmondCertsPath  = MakeCertificatesPath(basePath, "redmond");
            string nhindCertsPath    = MakeCertificatesPath(basePath, "nhind");
            string noAnchorCertsPath = MakeCertificatesPath(basePath, "noAnchor");

            SystemX509Store store;

            WriteLine("Installing Private Certs");
            using (store = SystemX509Store.OpenPrivateEdit())
            {
                InstallCerts(store, LoadCerts(redmondCertsPath, "Private"));
                InstallCerts(store, LoadCerts(nhindCertsPath, "Private"));
            }

            WriteLine("Installing Public Certs");
            using (store = SystemX509Store.OpenExternalEdit())
            {
                InstallCerts(store, LoadCerts(redmondCertsPath, "Public"));
                InstallCerts(store, LoadCerts(nhindCertsPath, "Public"));
                InstallCerts(store, LoadCerts(noAnchorCertsPath, "Public"));
            }

            WriteLine("Installing Anchors Certs");
            using (store = SystemX509Store.OpenAnchorEdit())
            {
                InstallCerts(store, LoadCerts(redmondCertsPath, "IncomingAnchors"));
                InstallCerts(store, LoadCerts(redmondCertsPath, "OutgoingAnchors"));

                InstallCerts(store, LoadCerts(nhindCertsPath, "IncomingAnchors"));
                InstallCerts(store, LoadCerts(nhindCertsPath, "OutgoingAnchors"));
            }
        }