示例#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");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);

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

            xmlNodeList = xmlElement.SelectNodes("ds:DigestValue", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("DigestValue missing");
            }
            this.digestValue = Convert.FromBase64String(xmlNodeList.Item(0).InnerText);
        }
示例#2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public DigestAlgAndValueType()
 {
     this.digestMethod = new DigestMethod();
     this.digestValue  = null;
 }