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; }
public void ProcessAndDigest(object input, SignatureResourcePool resourcePool, HashAlgorithm hash, DictionaryManager dictionaryManger) { HashStream hashStream = resourcePool.TakeHashStream(hash); XmlReader reader = input as XmlReader; if (reader != null) { this.ProcessReaderInput(reader, resourcePool, hashStream); } else { if (!(input is ISecurityElement)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.IdentityModel.SR.GetString("UnsupportedInputTypeForTransform", new object[] { input.GetType() }))); } XmlDictionaryWriter writer = resourcePool.TakeUtf8Writer(); writer.StartCanonicalization(hashStream, this.IncludeComments, this.GetInclusivePrefixes()); (input as ISecurityElement).WriteTo(writer, dictionaryManger); writer.EndCanonicalization(); } hashStream.FlushHash(); }
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); }
public void ProcessAndDigest(object input, SignatureResourcePool resourcePool, HashAlgorithm hash, DictionaryManager dictionaryManger) { HashStream hashStream = resourcePool.TakeHashStream(hash); XmlReader reader = input as XmlReader; if (reader != null) { this.ProcessReaderInput(reader, resourcePool, hashStream); } else { if (!(input is ISecurityElement)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.IdentityModel.SR.GetString("UnsupportedInputTypeForTransform", new object[] { input.GetType() }))); } XmlDictionaryWriter writer = resourcePool.TakeUtf8Writer(); writer.StartCanonicalization(hashStream, this.IncludeComments, this.GetInclusivePrefixes()); (input as ISecurityElement).WriteTo(writer, dictionaryManger); writer.EndCanonicalization(); } hashStream.FlushHash(); }
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()))); } }
// 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()))); } }