Пример #1
0
        private CanonicalizationDriver GetConfiguredDriver(SignatureResourcePool resourcePool)
        {
            CanonicalizationDriver driver = resourcePool.TakeCanonicalizationDriver();

            driver.IncludeComments = this.IncludeComments;
            driver.SetInclusivePrefixes(this.inclusivePrefixes);
            return(driver);
        }
 public CanonicalizationDriver TakeCanonicalizationDriver()
 {
     if (this.canonicalizationDriver == null)
     {
         this.canonicalizationDriver = new CanonicalizationDriver();
     }
     else
     {
         this.canonicalizationDriver.Reset();
     }
     return(this.canonicalizationDriver);
 }
 public CanonicalizationDriver TakeCanonicalizationDriver()
 {
     if (this.canonicalizationDriver == null)
     {
         this.canonicalizationDriver = new CanonicalizationDriver();
     }
     else
     {
         this.canonicalizationDriver.Reset();
     }
     return this.canonicalizationDriver;
 }
Пример #4
0
        private void ProcessReaderInput(XmlReader reader, SignatureResourcePool resourcePool, HashStream hashStream)
        {
            reader.MoveToContent();
            XmlDictionaryReader reader2 = reader as XmlDictionaryReader;

            if ((reader2 != null) && reader2.CanCanonicalize)
            {
                reader2.StartCanonicalization(hashStream, this.IncludeComments, this.GetInclusivePrefixes());
                reader2.Skip();
                reader2.EndCanonicalization();
            }
            else
            {
                CanonicalizationDriver configuredDriver = this.GetConfiguredDriver(resourcePool);
                configuredDriver.SetInput(reader);
                configuredDriver.WriteTo(hashStream);
            }
        }
Пример #5
0
        public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager)
        {
            if (input is XmlReader)
            {
                CanonicalizationDriver configuredDriver = this.GetConfiguredDriver(resourcePool);
                configuredDriver.SetInput(input as XmlReader);
                return(configuredDriver.GetMemoryStream());
            }
            if (!(input is ISecurityElement))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.IdentityModel.SR.GetString("UnsupportedInputTypeForTransform", new object[] { input.GetType() })));
            }
            MemoryStream        stream = new MemoryStream();
            XmlDictionaryWriter writer = resourcePool.TakeUtf8Writer();

            writer.StartCanonicalization(stream, false, null);
            (input as ISecurityElement).WriteTo(writer, dictionaryManager);
            writer.EndCanonicalization();
            stream.Seek(0L, SeekOrigin.Begin);
            return(stream);
        }
 // multi-transform case, inefficient path
 public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager)
 {
     if (input is XmlReader)
     {
         CanonicalizationDriver driver = GetConfiguredDriver(resourcePool);
         driver.SetInput(input as XmlReader);
         return(driver.GetMemoryStream());
     }
     else if (input is ISecurityElement)
     {
         MemoryStream        stream     = new MemoryStream();
         XmlDictionaryWriter utf8Writer = resourcePool.TakeUtf8Writer();
         utf8Writer.StartCanonicalization(stream, false, null);
         (input as ISecurityElement).WriteTo(utf8Writer, dictionaryManager);
         utf8Writer.EndCanonicalization();
         stream.Seek(0, SeekOrigin.Begin);
         return(stream);
     }
     else
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedInputTypeForTransform, input.GetType())));
     }
 }