Exemple #1
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);
            }
        }
Exemple #2
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())));
     }
 }