Пример #1
0
        void LoadCSRInfo(string csrfile)
        {
            X509Request req = null;

            using (var bio = BIO.File(csrfile, "r"))
                req = new X509Request(bio);
            CSReq = req;



            //ArrayList s = new ArrayList();
            //certificationRequestInfo = csri;
            //ArrayList oid = csri.Subject.GetOids();
            //ArrayList vals = csri.Subject.GetValues();

            Dictionary <string, string> xvals = new Dictionary <string, string>();

            foreach (string k in req.Subject.OneLine.Split('/'))
            {
                if (!string.IsNullOrEmpty(k))
                {
                    string[] val = k.Split('=');
                    if (!xvals.ContainsKey(val[0]))
                    {
                        xvals.Add(val[0], val[1]);
                    }
                }
            }

            x509NameBind bind = new x509NameBind();

            bind.Vals     = xvals;
            nameFrm1.bind = bind;
            nameFrm1.LoadNames();
        }
Пример #2
0
        public void LoadCertificate(Al.Security.X509.X509Certificate cert)
        {
            System.Collections.IList oids   = cert.SubjectDN.GetOidList();
            System.Collections.IList values = cert.SubjectDN.GetValueList();
            bind = new x509NameBind();
            for (int i = 0; i < oids.Count; i++)
            {
                bind.Add(((Al.Security.Asn1.DerObjectIdentifier)oids[i]).Id, (string)values[i]);
            }

            LoadNames();
        }
Пример #3
0
        public bool GetNames()
        {
            try
            {
                if (!InvokeRequired)
                {
                    bind = new x509NameBind();
                    if (superValidator1.Validate())
                    {
                        // Basic informations
                        bool res = SetText(cn);
                        res &= SetText(o);
                        res &= SetText(ou);
                        res &= SetText(emailaddress);
                        res &= SetText(st);
                        res &= SetText(l);
                        res &= SetText(street);
                        res &= SetText(dc);
                        res &= SetText(uid);
                        res &= SetCombo(c);

                        res &= SetText(surname);
                        res &= SetText(givenname);
                        res &= SetText(initials);
                        res &= SetText(gender);
                        res &= SetText(uniqueidentifier);
                        res &= SetText(telephonenumber);
                        res &= SetText(pseudonym);
                        res &= SetText(postaladdress);
                        res &= SetCombo(countryofcitizenship);
                        res &= SetCombo(countryofresidence);

                        // EV SSL
                        res &= SetCombo(jurisdictionOfIncorporationCountryName);
                        res &= SetText(businessCategory);
                        res &= SetText(jurisdictionOfIncorporationLocalityName);
                        res &= SetText(jurisdictionOfIncorporationStateOrProvinceName);

                        // Custom
                        res &= SetCustoms();

                        bind.ReverseOrder();
                        if (!res)
                        {
                            MessageBoxEx.Show("Failed: Some of x509 names was skipped", "Saving Failure", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return(false);
                        }
                        return(true);
                    }
                }
                else
                {
                    return((bool)Invoke(new InvokeBoolInterThread(GetNames)));
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "Saving x509 Name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(false);
        }
Пример #4
0
 private void buttonX1_Click(object sender, EventArgs e)
 {
     bind = null;
 }