Example #1
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            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:SignedSignatureProperties", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SignedSignatureProperties missing");
            }
            this.signedSignatureProperties = new SignedSignatureProperties();
            this.signedSignatureProperties.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:SignedDataObjectProperties", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signedDataObjectProperties = new SignedDataObjectProperties();
                this.signedDataObjectProperties.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
Example #2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignedProperties()
 {
     this.id = DefaultSignedPropertiesId; //This is where signature reference points to
     this.signedSignatureProperties  = new SignedSignatureProperties();
     this.signedDataObjectProperties = new SignedDataObjectProperties();
 }