Ejemplo n.º 1
0
        private void Encroll_Button_Click(object sender, EventArgs e)
        {
            var caConfig      = this.CaConfigBindingSource[0] as CaConfig;
            var keyLength     = 2048;
            var certification = new Certification();
            var subjectBody   = this.SubjectBodyBindingSource[0] as SubjectBody;

            try
            {
                var create = certification.CreateRequest(subjectBody,
                                                         OID.ServerAuthentication.Oid,
                                                         keyLength);
                this.richTextBox1.Text = create;

                var send = certification.SendRequest(create, caConfig.Server, caConfig.TemplateName);
                this.richTextBox2.Text = send;

                certification.InstallAndDownload(send, caConfig.Password, caConfig.FriendlyName);
                MessageBox.Show("Done!!");
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{ex},{ex.HResult}");
            }
        }
Ejemplo n.º 2
0
        //[Ignore]
        public void CreateRequest()
        {
            var templateName = "WebServer";
            var keyLength    = 2048;

            var caServer      = @"ad.lab.local\lab-ca";
            var certification = new Certification();
            var subjectBody   = new SubjectBody()
            {
                CommonName = "*.lab.local,*.lab1.local"
            };
            var create = certification.CreateRequest(subjectBody,
                                                     OID.ServerAuthentication.Oid,
                                                     keyLength);
            var send = certification.SendRequest(create, caServer, templateName);

            certification.InstallAndDownload(send, null, null);
        }