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