public CertificateProfileInfo GetProfileInfo(string profileName)
        {
            CertificateProfileInfo info = null;

            if (profileDic.Count == 0)
            {
                return(null);
            }

            profileDic.TryGetValue(profileName, out info);

            return(info);
        }
        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);
        }
        public override bool Equals(Object obj)
        {
            CertificateProfileInfo personObj = obj as CertificateProfileInfo;

            if (personObj == null)
            {
                return(false);
            }

            if (profileName.Equals(personObj.profileName) == false)
            {
                return(false);
            }

            foreach (var pair in profileItemDic)
            {
                if (!pair.Value.Equals(personObj.profileItemDic[pair.Key]))
                {
                    return(false);
                }
            }

            return(true);
        }