当前位置: 首页>>代码示例>>C#>>正文


C# XmlDictionaryReader.EndCanonicalization方法代码示例

本文整理汇总了C#中System.Xml.XmlDictionaryReader.EndCanonicalization方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.EndCanonicalization方法的具体用法?C# XmlDictionaryReader.EndCanonicalization怎么用?C# XmlDictionaryReader.EndCanonicalization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDictionaryReader的用法示例。


在下文中一共展示了XmlDictionaryReader.EndCanonicalization方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadTimestamp

 internal override SecurityTimestamp ReadTimestamp(XmlDictionaryReader reader, string digestAlgorithm, SignatureResourcePool resourcePool)
 {
     DateTime maxUtcDateTime;
     byte[] buffer;
     bool flag = (digestAlgorithm != null) && reader.CanCanonicalize;
     HashStream stream = null;
     reader.MoveToStartElement(System.ServiceModel.XD.UtilityDictionary.Timestamp, System.ServiceModel.XD.UtilityDictionary.Namespace);
     if (flag)
     {
         stream = resourcePool.TakeHashStream(digestAlgorithm);
         reader.StartCanonicalization(stream, false, null);
     }
     string attribute = reader.GetAttribute(System.ServiceModel.XD.UtilityDictionary.IdAttribute, System.ServiceModel.XD.UtilityDictionary.Namespace);
     reader.ReadStartElement();
     reader.ReadStartElement(System.ServiceModel.XD.UtilityDictionary.CreatedElement, System.ServiceModel.XD.UtilityDictionary.Namespace);
     DateTime creationTimeUtc = reader.ReadContentAsDateTime().ToUniversalTime();
     reader.ReadEndElement();
     if (reader.IsStartElement(System.ServiceModel.XD.UtilityDictionary.ExpiresElement, System.ServiceModel.XD.UtilityDictionary.Namespace))
     {
         reader.ReadStartElement();
         maxUtcDateTime = reader.ReadContentAsDateTime().ToUniversalTime();
         reader.ReadEndElement();
     }
     else
     {
         maxUtcDateTime = System.ServiceModel.Security.SecurityUtils.MaxUtcDateTime;
     }
     reader.ReadEndElement();
     if (flag)
     {
         reader.EndCanonicalization();
         buffer = stream.FlushHashAndGetValue();
     }
     else
     {
         buffer = null;
     }
     return new SecurityTimestamp(creationTimeUtc, maxUtcDateTime, attribute, digestAlgorithm, buffer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:39,代码来源:WSUtilitySpecificationVersion.cs

示例2: ReadFrom

        public override void ReadFrom(XmlDictionaryReader reader, TransformFactory transformFactory, DictionaryManager dictionaryManager)
        {
            this.SendSide = false;
            if (reader.CanCanonicalize)
            {
                this.CanonicalStream = new MemoryStream();
                reader.StartCanonicalization(this.CanonicalStream, false, null);
            }

            reader.MoveToStartElement(dictionaryManager.XmlSignatureDictionary.SignedInfo, dictionaryManager.XmlSignatureDictionary.Namespace);
            this.prefix = reader.Prefix;
            this.Id = reader.GetAttribute(dictionaryManager.UtilityDictionary.IdAttribute, null);
            reader.Read();

            ReadCanonicalizationMethod(reader, dictionaryManager);
            ReadSignatureMethod(reader, dictionaryManager);
            while (reader.IsStartElement(dictionaryManager.XmlSignatureDictionary.Reference, dictionaryManager.XmlSignatureDictionary.Namespace))
            {
                Reference reference = new Reference(dictionaryManager);
                reference.ReadFrom(reader, transformFactory, dictionaryManager);
                AddReference(reference);
            }
            reader.ReadEndElement(); // SignedInfo

            if (reader.CanCanonicalize)
                reader.EndCanonicalization();

            string[] inclusivePrefixes = GetInclusivePrefixes();
            if (inclusivePrefixes != null)
            {
                // Clear the canonicalized stream. We cannot use this while inclusive prefixes are
                // specified.
                this.CanonicalStream = null;
                this.context = new Dictionary<string, string>(inclusivePrefixes.Length);
                for (int i = 0; i < inclusivePrefixes.Length; i++)
                {
                    this.context.Add(inclusivePrefixes[i], reader.LookupNamespace(inclusivePrefixes[i]));
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:40,代码来源:SignedXml.cs

示例3: ReadTimestamp

            internal override SecurityTimestamp ReadTimestamp(XmlDictionaryReader reader, string digestAlgorithm, SignatureResourcePool resourcePool)
            {
                bool canonicalize = digestAlgorithm != null && reader.CanCanonicalize;
                HashStream hashStream = null;

                reader.MoveToStartElement(XD.UtilityDictionary.Timestamp, XD.UtilityDictionary.Namespace);
                if (canonicalize)
                {
                    hashStream = resourcePool.TakeHashStream(digestAlgorithm);
                    reader.StartCanonicalization(hashStream, false, null);
                }
                string id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace);
                reader.ReadStartElement();

                reader.ReadStartElement(XD.UtilityDictionary.CreatedElement, XD.UtilityDictionary.Namespace);
                DateTime creationTimeUtc = reader.ReadContentAsDateTime().ToUniversalTime();
                reader.ReadEndElement();

                DateTime expiryTimeUtc;
                if (reader.IsStartElement(XD.UtilityDictionary.ExpiresElement, XD.UtilityDictionary.Namespace))
                {
                    reader.ReadStartElement();
                    expiryTimeUtc = reader.ReadContentAsDateTime().ToUniversalTime();
                    reader.ReadEndElement();
                }
                else
                {
                    expiryTimeUtc = SecurityUtils.MaxUtcDateTime;
                }

                reader.ReadEndElement();

                byte[] digest;
                if (canonicalize)
                {
                    reader.EndCanonicalization();
                    digest = hashStream.FlushHashAndGetValue();
                }
                else
                {
                    digest = null;
                }
                return new SecurityTimestamp(creationTimeUtc, expiryTimeUtc, id, digestAlgorithm, digest);
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:44,代码来源:WSUtilitySpecificationVersion.cs


注:本文中的System.Xml.XmlDictionaryReader.EndCanonicalization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。