Пример #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 = "";
            }

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

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

            xmlNodeList = xmlElement.SelectNodes("xsd:QualifyingPropertiesReference", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                throw new CryptographicException("Current implementation can't handle QualifyingPropertiesReference element");
            }
        }
Пример #2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public XadesObject()
 {
     this.qualifyingProperties = new QualifyingProperties();
 }