コード例 #1
0
        /// <summary>Loads XML information into the <see langword="&lt;CipherReference&gt;" /> element in XML encryption.</summary>
        /// <param name="value">An <see cref="T:System.Xml.XmlElement" /> object that represents an XML element to use as the reference.</param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="value" /> provided is <see langword="null" />.</exception>
        public override void LoadXml(XmlElement value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            ReferenceType = value.LocalName;
            string attribute = Exml.GetAttribute(value, "URI", "http://www.w3.org/2001/04/xmlenc#");

            if (attribute == null)
            {
                throw new CryptographicException("Cryptography_Xml_UriRequired");
            }
            Uri = attribute;
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(value.OwnerDocument.NameTable);

            nsmgr.AddNamespace("enc", "http://www.w3.org/2001/04/xmlenc#");
            XmlNode xmlNode = value.SelectSingleNode("enc:Transforms", nsmgr);

            if (xmlNode != null)
            {
                TransformChain.LoadXml(xmlNode as XmlElement);
            }
            m_cachedXml = value;
        }
コード例 #2
0
ファイル: Reference.cs プロジェクト: i-e-b/ADSD
 internal Reference(XmlElement element)
 {
     this.m_transformChain = new TransformChain();
     this.m_refTarget      = (object)element;
     this.m_refTargetType  = ReferenceTargetType.XmlElement;
     this.m_cachedXml      = (XmlElement)null;
     this.m_digestMethod   = SignedXml.XmlDsigDigestDefault;
 }
コード例 #3
0
ファイル: Reference.cs プロジェクト: i-e-b/ADSD
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Xml.Reference" /> class with a hash value of the specified <see cref="T:System.IO.Stream" />.</summary>
 /// <param name="stream">The <see cref="T:System.IO.Stream" /> with which to initialize the new instance of <see cref="T:System.Security.Cryptography.Xml.Reference" />. </param>
 public Reference(Stream stream)
 {
     this.m_transformChain = new TransformChain();
     this.m_refTarget      = (object)stream;
     this.m_refTargetType  = ReferenceTargetType.Stream;
     this.m_cachedXml      = (XmlElement)null;
     this.m_digestMethod   = SignedXml.XmlDsigDigestDefault;
 }
コード例 #4
0
ファイル: Reference.cs プロジェクト: i-e-b/ADSD
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Xml.Reference" /> class with the specified <see cref="T:System.Uri" />.</summary>
 /// <param name="uri">The <see cref="T:System.Uri" /> with which to initialize the new instance of <see cref="T:System.Security.Cryptography.Xml.Reference" />. </param>
 public Reference(string uri)
 {
     this.m_transformChain = new TransformChain();
     this.m_refTarget      = (object)uri;
     this.m_uri            = uri;
     this.m_refTargetType  = ReferenceTargetType.UriReference;
     this.m_cachedXml      = (XmlElement)null;
     this.m_digestMethod   = SignedXml.XmlDsigDigestDefault;
 }
コード例 #5
0
        internal new XmlElement GetXml(XmlDocument document)
        {
            if (ReferenceType == null)
            {
                throw new CryptographicException("Cryptography_Xml_ReferenceTypeRequired");
            }
            XmlElement element = document.CreateElement(ReferenceType, "http://www.w3.org/2001/04/xmlenc#");

            if (!string.IsNullOrEmpty(Uri))
            {
                element.SetAttribute("URI", Uri);
            }
            if (TransformChain.Count > 0)
            {
                element.AppendChild((XmlNode)TransformChain.GetXml(document, "http://www.w3.org/2001/04/xmlenc#"));
            }
            return(element);
        }
コード例 #6
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Xml.CipherReference" /> class using the specified Uniform Resource Identifier (URI) and transform chain information.</summary>
 /// <param name="uri">A Uniform Resource Identifier (URI) pointing to the encrypted data.</param>
 /// <param name="transformChain">A <see cref="T:System.Security.Cryptography.Xml.TransformChain" /> object that describes transforms to do on the encrypted data.</param>
 public CipherReference(string uri, TransformChain transformChain)
     : base(uri, transformChain)
 {
     ReferenceType = nameof(CipherReference);
 }
コード例 #7
0
ファイル: EncryptedReference.cs プロジェクト: i-e-b/ADSD
 /// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.Xml.EncryptedReference" /> class using the specified Uniform Resource Identifier (URI) and transform chain.</summary>
 /// <param name="uri">The Uniform Resource Identifier (URI) that points to the data to encrypt.</param>
 /// <param name="transformChain">A <see cref="T:System.Security.Cryptography.Xml.TransformChain" /> object that describes transforms to be done on the data to encrypt.</param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="uri" /> parameter is <see langword="null" />.</exception>
 protected EncryptedReference(string uri, TransformChain transformChain)
 {
     this.TransformChain = transformChain;
     this.Uri            = uri;
     this.m_cachedXml    = (XmlElement)null;
 }