Example #1
0
        public void ApplyBodySecurity(XmlDictionaryWriter writer)
        {
            SignedMessage message    = this.SignedMessage;
            HashStream    hashStream = this.signer.TakeHashStream();

            message.WriteBodyToSign(hashStream, writer);
            this.signer.InclusivePrefixes = message.InclusivePrefixes;
            this.signer.AddReference(message.BodyId, hashStream.FlushHashAndGetValue());
        }
Example #2
0
        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());
        }
Example #3
0
        public void AddReference(
            MessageHeaders headers,
            int i,
            XmlDictionaryWriter writer,
            string headerId,
            bool idInserted)
        {
            HashStream hashStream = this.TakeHashStream();

            writer.StartCanonicalization(hashStream, false, this.InclusivePrefixes);
            headers.WriteStartHeader(i, writer);
            if (idInserted)
            {
                writer.WriteAttributeString(this.discoveryInfo.DiscoveryPrefix, ProtocolStrings.IdAttributeName, this.discoveryInfo.DiscoveryNamespace, headerId);
            }

            headers.WriteHeaderContents(i, writer);
            writer.WriteEndElement();
            writer.EndCanonicalization();
            writer.Flush();

            // Add a pre-digested reference for this header
            this.AddReference(headerId, hashStream.FlushHashAndGetValue());
        }