ObjectIdentifier allows the specification of an unique and permanent object of an object and some additional information about the nature of the data object
 /// <summary>
 /// Default constructor
 /// </summary>
 public CommitmentTypeIndication()
 {
     this.commitmentTypeId = new ObjectIdentifier("CommitmentTypeId");
     this.objectReferenceCollection = new ObjectReferenceCollection();
     this.allSignedDataObjects = true;
     this.commitmentTypeQualifiers = new CommitmentTypeQualifiers();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SignaturePolicyId()
 {
     this.sigPolicyId = new ObjectIdentifier("SigPolicyId");
     this.transforms = new Transforms();
     this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash");
     this.sigPolicyQualifiers = new SigPolicyQualifiers();
 }
Exemplo n.º 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");
			}

			if (xmlElement.HasAttribute("ObjectReference"))
			{
				this.objectReferenceAttribute = xmlElement.GetAttribute("ObjectReference");
			}
			else
			{
				this.objectReferenceAttribute = "";
				throw new CryptographicException("ObjectReference attribute missing");
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

			xmlNodeList = xmlElement.SelectNodes("xsd:Description", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.description = xmlNodeList.Item(0).InnerText;
			}

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

			xmlNodeList = xmlElement.SelectNodes("xsd:MimeType", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.mimeType = xmlNodeList.Item(0).InnerText;
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:Encoding", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.encoding = xmlNodeList.Item(0).InnerText;
			}
		}
Exemplo n.º 4
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public DataObjectFormat()
		{
			this.objectIdentifier = new ObjectIdentifier("ObjectIdentifier");
		}
Exemplo n.º 5
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);
			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));
			}
		}
        /// <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;
            IEnumerator enumerator;
            XmlElement iterationXmlElement;
            ObjectReference newObjectReference;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:CommitmentTypeId", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                this.commitmentTypeId = null;
                throw new CryptographicException("CommitmentTypeId missing");
            }
            else
            {
                this.commitmentTypeId = new ObjectIdentifier("CommitmentTypeId");
                this.commitmentTypeId.LoadXml((XmlElement)xmlNodeList.Item(0));
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:ObjectReference", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.objectReferenceCollection.Clear();
                this.allSignedDataObjects = false;
                enumerator = xmlNodeList.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        iterationXmlElement = enumerator.Current as XmlElement;
                        if (iterationXmlElement != null)
                        {
                            newObjectReference = new ObjectReference();
                            newObjectReference.LoadXml(iterationXmlElement);
                            this.objectReferenceCollection.Add(newObjectReference);
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }

            }
            else
            {
                this.objectReferenceCollection.Clear();
                this.allSignedDataObjects = true;
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:CommitmentTypeQualifiers", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.commitmentTypeQualifiers = new CommitmentTypeQualifiers();
                this.commitmentTypeQualifiers.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
Exemplo n.º 7
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;
            IEnumerator         enumerator;
            XmlElement          iterationXmlElement;
            ObjectReference     newObjectReference;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:CommitmentTypeId", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                this.commitmentTypeId = null;
                throw new CryptographicException("CommitmentTypeId missing");
            }
            else
            {
                this.commitmentTypeId = new ObjectIdentifier("CommitmentTypeId");
                this.commitmentTypeId.LoadXml((XmlElement)xmlNodeList.Item(0));
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:ObjectReference", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.objectReferenceCollection.Clear();
                this.allSignedDataObjects = false;
                enumerator = xmlNodeList.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        iterationXmlElement = enumerator.Current as XmlElement;
                        if (iterationXmlElement != null)
                        {
                            newObjectReference = new ObjectReference();
                            newObjectReference.LoadXml(iterationXmlElement);
                            this.objectReferenceCollection.Add(newObjectReference);
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            else
            {
                this.objectReferenceCollection.Clear();
                this.allSignedDataObjects = true;
            }

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