The OtherCertificate element is a placeholder for potential future new formats of certificates
Inheritance: System.Collections.ArrayList
Example #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;
            IEnumerator                 enumerator;
            XmlElement                  iterationXmlElement;
            EncapsulatedX509Certificate newEncapsulatedX509Certificate;
            OtherCertificate            newOtherCertificate;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

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

            this.encapsulatedX509CertificateCollection.Clear();
            this.otherCertificateCollection.Clear();

            xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedX509Certificate", xmlNamespaceManager);
            enumerator  = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        newEncapsulatedX509Certificate = new EncapsulatedX509Certificate();
                        newEncapsulatedX509Certificate.LoadXml(iterationXmlElement);
                        this.encapsulatedX509CertificateCollection.Add(newEncapsulatedX509Certificate);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }

            xmlNodeList = xmlElement.SelectNodes("xades:OtherCertificate", xmlNamespaceManager);
            enumerator  = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        newOtherCertificate = new OtherCertificate();
                        newOtherCertificate.LoadXml(iterationXmlElement);
                        this.otherCertificateCollection.Add(newOtherCertificate);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
        /// <summary>
        /// Add typed object to the collection
        /// </summary>
        /// <param name="objectToAdd">Typed object to be added to collection</param>
        /// <returns>The object that has been added to collection</returns>
        public OtherCertificate Add(OtherCertificate objectToAdd)
        {
            base.Add(objectToAdd);

            return objectToAdd;
        }
Example #3
0
        /// <summary>
        /// Add typed object to the collection
        /// </summary>
        /// <param name="objectToAdd">Typed object to be added to collection</param>
        /// <returns>The object that has been added to collection</returns>
        public OtherCertificate Add(OtherCertificate objectToAdd)
        {
            base.Add(objectToAdd);

            return(objectToAdd);
        }
Example #4
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;
			EncapsulatedX509Certificate newEncapsulatedX509Certificate;
			OtherCertificate newOtherCertificate;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}
			if (xmlElement.HasAttribute("Id"))
			{
				this.id = xmlElement.GetAttribute("Id");
			}
			else
			{
				this.id = "";
			}

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

			this.encapsulatedX509CertificateCollection.Clear();
			this.otherCertificateCollection.Clear();

			xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedX509Certificate", xmlNamespaceManager);
			enumerator = xmlNodeList.GetEnumerator();
			try 
			{
				while (enumerator.MoveNext()) 
				{
					iterationXmlElement = enumerator.Current as XmlElement;
					if (iterationXmlElement != null)
					{
						newEncapsulatedX509Certificate = new EncapsulatedX509Certificate();
						newEncapsulatedX509Certificate.LoadXml(iterationXmlElement);
						this.encapsulatedX509CertificateCollection.Add(newEncapsulatedX509Certificate);
					}
				}
			}
			finally 
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}

			xmlNodeList = xmlElement.SelectNodes("xades:OtherCertificate", xmlNamespaceManager);
			enumerator = xmlNodeList.GetEnumerator();
			try 
			{
				while (enumerator.MoveNext()) 
				{
					iterationXmlElement = enumerator.Current as XmlElement;
					if (iterationXmlElement != null)
					{
						newOtherCertificate = new OtherCertificate();
						newOtherCertificate.LoadXml(iterationXmlElement);
						this.otherCertificateCollection.Add(newOtherCertificate);
					}
				}
			}
			finally 
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
		}