Ejemplo n.º 1
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        /// <param name="counterSignedXmlElement">Element containing parent signature (needed if there are counter signatures)</param>
        public void LoadXml(XmlElement xmlElement, XmlElement counterSignedXmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

            if (xmlElement.HasAttribute("Target"))
            {
                this.target = xmlElement.GetAttribute("Target");
            }
            else
            {
                this.target = "";
                throw new CryptographicException("Target attribute missing");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SignedProperties", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SignedProperties missing");
            }
            this.signedProperties = new SignedProperties();
            this.signedProperties.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:UnsignedProperties", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.unsignedProperties = new UnsignedProperties();
                this.unsignedProperties.LoadXml((XmlElement)xmlNodeList.Item(0), counterSignedXmlElement);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public QualifyingProperties()
 {
     this.signedProperties   = new SignedProperties();
     this.unsignedProperties = new UnsignedProperties();
 }