Example #1
0
        static void Main(string[] args)
        {
            try
            {
                ShowInformation();
                ProgramOptions options = ParseCommandLine(args);
                if (options == null)
                {
                    return;
                }

                StoreLocation store = options.MachineStore ? StoreLocation.LocalMachine : StoreLocation.CurrentUser;

                CertificatesAuthority ca = new CertificatesAuthority(options.AuthorityName, store);
                if (options.Pkcs10File != null)
                {
                    ca.SignRequest(options.Pkcs10File, options.Usage, 0);
                }
                else
                {
                    ca.GenerateCertificate(options.CertificateName, options.Usage, 0);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                ShowInformation();
                ProgramOptions options = ParseCommandLine(args);
                if(options == null)
                    return;

                StoreLocation store = options.MachineStore ? StoreLocation.LocalMachine : StoreLocation.CurrentUser;

                CertificatesAuthority ca = new CertificatesAuthority(options.AuthorityName, store);
                if(options.Pkcs10File != null)
                    ca.SignRequest(options.Pkcs10File, options.Usage, 0);
                else
                    ca.GenerateCertificate(options.CertificateName, options.Usage, 0);
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }