本文整理汇总了C#中System.Xml.XmlDictionaryWriter.StartCanonicalization方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.StartCanonicalization方法的具体用法?C# XmlDictionaryWriter.StartCanonicalization怎么用?C# XmlDictionaryWriter.StartCanonicalization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.StartCanonicalization方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddReference
public void AddReference(string headerId, XmlDictionaryReader reader, XmlDictionaryWriter writer)
{
HashStream hashStream = this.TakeHashStream();
writer.StartCanonicalization(hashStream, false, this.InclusivePrefixes);
// The reader must be positioned on the start element of the header / body we want to canonicalize
writer.WriteNode(reader, false);
writer.EndCanonicalization();
writer.Flush();
// Add a reference for this block
this.AddReference(headerId, hashStream.FlushHashAndGetValue());
}
示例2: WriteBodyToSignWithFragments
public void WriteBodyToSignWithFragments(Stream stream, bool includeComments, string[] inclusivePrefixes, XmlDictionaryWriter writer)
{
IFragmentCapableXmlDictionaryWriter fragmentingWriter = (IFragmentCapableXmlDictionaryWriter) writer;
SetBodyId();
BufferedOutputStream fullBodyFragment = new BufferManagerOutputStream(SR.XmlBufferQuotaExceeded, 1024, int.MaxValue, this.securityHeader.StreamBufferManager);
writer.StartCanonicalization(stream, includeComments, inclusivePrefixes);
fragmentingWriter.StartFragment(fullBodyFragment, false);
WriteStartInnerMessageWithId(writer);
this.InnerMessage.WriteBodyContents(writer);
writer.WriteEndElement();
fragmentingWriter.EndFragment();
writer.EndCanonicalization();
this.fullBodyFragment = fullBodyFragment.ToArray(out this.fullBodyFragmentLength);
this.state = BodyState.Signed;
}
示例3: WriteBodyToSignThenEncryptWithFragments
public void WriteBodyToSignThenEncryptWithFragments(
Stream stream, bool includeComments, string[] inclusivePrefixes,
EncryptedData encryptedData, SymmetricAlgorithm algorithm, XmlDictionaryWriter writer)
{
IFragmentCapableXmlDictionaryWriter fragmentingWriter = (IFragmentCapableXmlDictionaryWriter) writer;
SetBodyId();
encryptedData.Id = this.securityHeader.GenerateId();
this.startBodyFragment = new MemoryStream();
BufferedOutputStream bodyContentFragment = new BufferManagerOutputStream(SR.XmlBufferQuotaExceeded, 1024, int.MaxValue, this.securityHeader.StreamBufferManager);
this.endBodyFragment = new MemoryStream();
writer.StartCanonicalization(stream, includeComments, inclusivePrefixes);
fragmentingWriter.StartFragment(this.startBodyFragment, false);
WriteStartInnerMessageWithId(writer);
fragmentingWriter.EndFragment();
fragmentingWriter.StartFragment(bodyContentFragment, true);
this.InnerMessage.WriteBodyContents(writer);
fragmentingWriter.EndFragment();
fragmentingWriter.StartFragment(this.endBodyFragment, false);
writer.WriteEndElement();
fragmentingWriter.EndFragment();
writer.EndCanonicalization();
int bodyLength;
byte[] bodyBuffer = bodyContentFragment.ToArray(out bodyLength);
encryptedData.SetUpEncryption(algorithm, new ArraySegment<byte>(bodyBuffer, 0, bodyLength));
this.encryptedBodyContent = encryptedData;
this.state = BodyState.SignedThenEncrypted;
}
示例4: WriteBodyToSignWithFragments
public void WriteBodyToSignWithFragments(Stream stream, bool includeComments, string[] inclusivePrefixes, XmlDictionaryWriter writer)
{
IFragmentCapableXmlDictionaryWriter writer2 = (IFragmentCapableXmlDictionaryWriter) writer;
this.SetBodyId();
BufferedOutputStream stream2 = new BufferManagerOutputStream("XmlBufferQuotaExceeded", 0x400, 0x7fffffff, BufferManager.CreateBufferManager(0L, 0x7fffffff));
writer.StartCanonicalization(stream, includeComments, inclusivePrefixes);
writer2.StartFragment(stream2, false);
this.WriteStartInnerMessageWithId(writer);
base.InnerMessage.WriteBodyContents(writer);
writer.WriteEndElement();
writer2.EndFragment();
writer.EndCanonicalization();
this.fullBodyFragment = stream2.ToArray(out this.fullBodyFragmentLength);
this.state = BodyState.Signed;
}
示例5: WriteBodyToSignThenEncryptWithFragments
public void WriteBodyToSignThenEncryptWithFragments(Stream stream, bool includeComments, string[] inclusivePrefixes, EncryptedData encryptedData, SymmetricAlgorithm algorithm, XmlDictionaryWriter writer)
{
int num;
IFragmentCapableXmlDictionaryWriter writer2 = (IFragmentCapableXmlDictionaryWriter) writer;
this.SetBodyId();
encryptedData.Id = this.securityHeader.GenerateId();
this.startBodyFragment = new MemoryStream();
BufferedOutputStream stream2 = new BufferManagerOutputStream("XmlBufferQuotaExceeded", 0x400, 0x7fffffff, BufferManager.CreateBufferManager(0L, 0x7fffffff));
this.endBodyFragment = new MemoryStream();
writer.StartCanonicalization(stream, includeComments, inclusivePrefixes);
writer2.StartFragment(this.startBodyFragment, false);
this.WriteStartInnerMessageWithId(writer);
writer2.EndFragment();
writer2.StartFragment(stream2, true);
base.InnerMessage.WriteBodyContents(writer);
writer2.EndFragment();
writer2.StartFragment(this.endBodyFragment, false);
writer.WriteEndElement();
writer2.EndFragment();
writer.EndCanonicalization();
byte[] array = stream2.ToArray(out num);
encryptedData.SetUpEncryption(algorithm, new ArraySegment<byte>(array, 0, num));
this.encryptedBodyContent = encryptedData;
this.state = BodyState.SignedThenEncrypted;
}
示例6: WriteCanonicalizedBodyWithFragments
void WriteCanonicalizedBodyWithFragments(Stream canonicalStream, XmlDictionaryWriter writer)
{
byte[] buffer = null;
if (this.discoveryInfo.SupportsInclusivePrefixes)
{
buffer = this.BufferBodyAndGetInclusivePrefixes();
}
using (MemoryStream bodyBufferStream = new MemoryStream())
{
writer.StartCanonicalization(canonicalStream, false, this.inclusivePrefixes);
IFragmentCapableXmlDictionaryWriter fragmentingWriter = (IFragmentCapableXmlDictionaryWriter)writer;
fragmentingWriter.StartFragment(bodyBufferStream, false);
this.WriteBufferOrMessageBody(writer, buffer);
fragmentingWriter.EndFragment();
writer.EndCanonicalization();
writer.Flush();
this.fullBodyFragmentLength = (int)bodyBufferStream.Length;
this.fullBodyFragment = bodyBufferStream.ToArray();
}
}