Exemple #1
0
 public void Dispose()
 {
     if (this.signer != null)
     {
         this.signer.Dispose();
         this.signer = null;
     }
 }
Exemple #2
0
        void VerifySignature(string refs, string sig, string inclusivePrefixes, X509Certificate2 certificate)
        {
            int noHeaders = this.Message.Headers.Count;

            string[] references = refs.Split(ProtocolStrings.WhitespaceChars, StringSplitOptions.RemoveEmptyEntries);

            using (SignatureProcessor signer = new SignatureProcessor(certificate, this.DiscoveryInfo))
            {
                if (!String.IsNullOrEmpty(inclusivePrefixes))
                {
                    signer.InclusivePrefixes = inclusivePrefixes.Split(
                        ProtocolStrings.WhitespaceChars, StringSplitOptions.RemoveEmptyEntries);
                }

                XmlDictionaryWriter writer = signer.TakeUtf8Writer();
                bool bodyReferenced        = false;
                foreach (string s in references)
                {
                    // Look for the element that has this ID - body or one of the headers
                    XPathNavigator      nav;
                    XmlDictionaryReader reader;
                    if (!bodyReferenced && this.TryGetBodyBlock(s, out nav))
                    {
                        signer.AddReference(s, nav, writer);
                    }
                    else if (this.TryGetHeaderBlockWithId(s, out reader))
                    {
                        signer.AddReference(s, reader, writer);
                        reader.Close();
                    }
                    else
                    {
                        throw new CompactSignatureSecurityException(
                                  string.Format(CultureInfo.CurrentCulture, "Reference with id {0} doesn't exist", s));
                    }
                }

                signer.VerifySignature(sig);
            }
        }
 public void Dispose()
 {
     if (this.signer != null)
     {
         this.signer.Dispose();
         this.signer = null;
     }
 }
 public void StartSignature()
 {
     this.signer = new SignatureProcessor(this.certificate, this.DiscoveryInfo);
 }
Exemple #5
0
 public void StartSignature()
 {
     this.signer = new SignatureProcessor(this.certificate, this.DiscoveryInfo);
 }