예제 #1
0
 public void AddClause(KeyInfoClause clause)
 {
     Info.Add(clause);
 }
예제 #2
0
        public void LoadXml(XmlElement value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            Id = value.Attributes ["Id"] != null?value.GetAttribute("Id") : null;

            if ((value.LocalName == XmlSignature.ElementNames.KeyInfo) && (value.NamespaceURI == XmlSignature.NamespaceURI))
            {
                foreach (XmlNode n in value.ChildNodes)
                {
                    if (n.NodeType != XmlNodeType.Element)
                    {
                        continue;
                    }

                    KeyInfoClause kic = null;

                    switch (n.LocalName)
                    {
                    case XmlSignature.ElementNames.KeyValue:
                        XmlNodeList xnl = n.ChildNodes;
                        if (xnl.Count > 0)
                        {
                            // we must now treat the whitespace !
                            foreach (XmlNode m in xnl)
                            {
                                switch (m.LocalName)
                                {
                                case XmlSignature.ElementNames.DSAKeyValue:
                                    kic = (KeyInfoClause) new DSAKeyValue();
                                    break;

                                case XmlSignature.ElementNames.RSAKeyValue:
                                    kic = (KeyInfoClause) new RSAKeyValue();
                                    break;
                                }
                            }
                        }
                        break;

                    case XmlSignature.ElementNames.KeyName:
                        kic = (KeyInfoClause) new KeyInfoName();
                        break;

                    case XmlSignature.ElementNames.RetrievalMethod:
                        kic = (KeyInfoClause) new KeyInfoRetrievalMethod();
                        break;

                    case XmlSignature.ElementNames.X509Data:
                        kic = (KeyInfoClause) new KeyInfoX509Data();
                        break;

                    case XmlSignature.ElementNames.RSAKeyValue:
                        kic = (KeyInfoClause) new RSAKeyValue();
                        break;

                    default:
                        kic = (KeyInfoClause) new KeyInfoNode();
                        break;
                    }

                    if (kic != null)
                    {
                        kic.LoadXml((XmlElement)n);
                        AddClause(kic);
                    }
                }
            }
            // No check is performed on MS.NET...
        }