Exemplo n.º 1
0
        public bool LoadProfileXml(string profileFilePath,
                                   out Dictionary <string, CertificateProfileInfo> profileDic)
        {
            bool ret = true;

            profileDic = new Dictionary <string, CertificateProfileInfo>();

            XmlDocument xml = new XmlDocument();

            try
            {
                xml.Load(profileFilePath);
            }
            catch (Exception)
            {
                return(false);
            }

            XmlNodeList xnList = xml.SelectNodes("/profiles/profile");

            foreach (XmlNode xn in xnList)
            {
                CertificateProfileInfo certProfileInfo =
                    new CertificateProfileInfo();

                certProfileInfo.profileName = xn.Attributes["name"].Value;

                foreach (XmlNode xnProfileItem in xn.ChildNodes)
                {
                    CertificateProfileItem certProfileItem =
                        new CertificateProfileItem(
                            xnProfileItem.Attributes["key"].Value,
                            xnProfileItem.Attributes["password"].Value,
                            xnProfileItem.Attributes["distributor"].Value,
                            xnProfileItem.Attributes["ca"].Value,
                            xnProfileItem.Attributes["rootca"].Value);

                    certProfileInfo.profileItemDic.Add(
                        xnProfileItem.Attributes["distributor"].Value,
                        certProfileItem);
                }

                profileDic.Add(certProfileInfo.profileName, certProfileInfo);
            }

            XmlNode xnProfiles = xml.SelectSingleNode("/profiles");

            activeProfile = xnProfiles?.Attributes["active"]?.Value;

            return(ret);
        }
Exemplo n.º 2
0
        public override bool Equals(Object obj)
        {
            CertificateProfileItem personObj = obj as CertificateProfileItem;

            if (personObj == null)
            {
                return(false);
            }
            else
            {
                return(keyPath.Equals(personObj.keyPath) &&
                       keyPassword.Equals(personObj.keyPassword) &&
                       caPath.Equals(personObj.caPath) &&
                       rootca.Equals(personObj.rootca));
            }
        }