The SignaturePolicyId element is an explicit and unambiguous identifier of a Signature Policy together with a hash value of the signature policy, so it can be verified that the policy selected by the signer is the one being used by the verifier. An explicit signature policy has a globally unique reference, which, in this way, is bound to an electronic signature by the signer as part of the signature calculation.
Exemple #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("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SignaturePolicyId", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signaturePolicyId = new SignaturePolicyId();
                this.signaturePolicyId.LoadXml((XmlElement)xmlNodeList.Item(0));
                this.signaturePolicyImplied = false;
            }
            else
            {
                xmlNodeList = xmlElement.SelectNodes("xsd:SignaturePolicyImplied", xmlNamespaceManager);
                if (xmlNodeList.Count != 0)
                {
                    this.signaturePolicyImplied = true;
                    this.signaturePolicyId      = null;
                }
                else
                {
                    throw new CryptographicException("SignaturePolicyId or SignaturePolicyImplied missing");
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignaturePolicyIdentifier()
 {
     this.signaturePolicyId      = new SignaturePolicyId();
     this.signaturePolicyImplied = false;
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignaturePolicyIdentifier()
 {
     this.signaturePolicyId = new SignaturePolicyId();
     this.signaturePolicyImplied = false;
 }
        /// <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("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SignaturePolicyId", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signaturePolicyId = new SignaturePolicyId();
                this.signaturePolicyId.LoadXml((XmlElement)xmlNodeList.Item(0));
                this.signaturePolicyImplied = false;
            }
            else
            {
                xmlNodeList = xmlElement.SelectNodes("xsd:SignaturePolicyImplied", xmlNamespaceManager);
                if (xmlNodeList.Count != 0)
                {
                    this.signaturePolicyImplied = true;
                    this.signaturePolicyId = null;
                }
                else
                {
                    throw new CryptographicException("SignaturePolicyId or SignaturePolicyImplied missing");
                }
            }
        }