Exemplo n.º 1
0
        public void CertificateEnsureMachine(string[] args)
        {
            using (SystemX509Store store = OpenStore(args.GetRequiredValue(0)))
            {
                CertificateFileInfo certFileInfo = CertificateFileInfo.Create(1, args);
                MemoryX509Store     certs        = certFileInfo.LoadCerts(MachineKeyFlags);
                foreach (X509Certificate2 cert in certs)
                {
                    string comment = "EXISTS";
                    if (!store.Contains(cert))
                    {
                        store.Add(cert);
                        comment = "ADDED";
                    }

                    WriteLine("{0}: {1}, Thumbprint:{2}", comment, cert.Subject, cert.Thumbprint);
                }
            }
        }