コード例 #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();
 }
コード例 #2
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.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)
            {
                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;
            }
        }