In some transactions the purported place where the signer was at the time of signature creation may need to be indicated. In order to provide this information a new property may be included in the signature. This property specifies an address associated with the signer at a particular geographical (e.g. city) location. This is a signed property that qualifies the signer. An XML electronic signature aligned with the present document MAY contain at most one SignatureProductionPlace element.
Пример #1
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignedSignatureProperties()
 {
     this.signingTime               = DateTime.MinValue;
     this.signingCertificate        = new SigningCertificate();
     this.signaturePolicyIdentifier = new SignaturePolicyIdentifier();
     this.signatureProductionPlace  = new SignatureProductionPlace();
     this.signerRole = new SignerRole();
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignedSignatureProperties()
 {
     this.signingTime = DateTime.MinValue;
     this.signingCertificate = new SigningCertificate();
     this.signaturePolicyIdentifier = new SignaturePolicyIdentifier();
     this.signatureProductionPlace = new SignatureProductionPlace();
     this.signerRole = new SignerRole();
 }
Пример #3
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:SigningTime", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigningTime missing");
            }
            this.signingTime = XmlConvert.ToDateTime(xmlNodeList.Item(0).InnerText, XmlDateTimeSerializationMode.Utc);

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

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

            xmlNodeList = xmlElement.SelectNodes("xsd:SignatureProductionPlace", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signatureProductionPlace = new SignatureProductionPlace();
                this.signatureProductionPlace.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
            else
            {
                this.signatureProductionPlace = null;
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:SignerRole", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signerRole = new SignerRole();
                this.signerRole.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
            else
            {
                this.signerRole = null;
            }
        }
        /// <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:SigningTime", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigningTime missing");
            }
            this.signingTime = XmlConvert.ToDateTime(xmlNodeList.Item(0).InnerText, XmlDateTimeSerializationMode.Local);

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

            xmlNodeList = xmlElement.SelectNodes("xsd:SignaturePolicyIdentifier", xmlNamespaceManager);
            if (xmlNodeList.Count > 0)
            {
                this.signaturePolicyIdentifier = new SignaturePolicyIdentifier();
                this.signaturePolicyIdentifier.LoadXml((XmlElement)xmlNodeList.Item(0));
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:SignatureProductionPlace", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signatureProductionPlace = new SignatureProductionPlace();
                this.signatureProductionPlace.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
            else
            {
                this.signatureProductionPlace = null;
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:SignerRole", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.signerRole = new SignerRole();
                this.signerRole.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
            else
            {
                this.signerRole = null;
            }
        }