/// <summary> /// Default constructor /// </summary> public SignaturePolicyId() { this.sigPolicyId = new ObjectIdentifier("SigPolicyId"); this.transforms = new Transforms(); this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash"); this.sigPolicyQualifiers = new SigPolicyQualifiers(); }
/// <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); xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri); xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyId", xmlNamespaceManager); if (xmlNodeList.Count == 0) { throw new CryptographicException("SigPolicyId missing"); } this.sigPolicyId = new ObjectIdentifier("SigPolicyId"); this.sigPolicyId.LoadXml((XmlElement)xmlNodeList.Item(0)); xmlNodeList = xmlElement.SelectNodes("ds:Transforms", xmlNamespaceManager); if (xmlNodeList.Count != 0) { this.transforms = new Transforms(); this.transforms.LoadXml((XmlElement)xmlNodeList.Item(0)); } xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyHash", xmlNamespaceManager); if (xmlNodeList.Count == 0) { throw new CryptographicException("SigPolicyHash missing"); } this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash"); this.sigPolicyHash.LoadXml((XmlElement)xmlNodeList.Item(0)); xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyQualifiers", xmlNamespaceManager); if (xmlNodeList.Count != 0) { this.sigPolicyQualifiers = new SigPolicyQualifiers(); this.sigPolicyQualifiers.LoadXml((XmlElement)xmlNodeList.Item(0)); } }