[From nobody Wed Oct 29 15:06:10 2008
X-Tomcat-ID: 13784148
References: &lt;ObIY2ovFEHA.3984@TK2MSFTNGP10.phx.gbl&gt;
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: shawnfa@online.microsoft.com (&quot;Shawn Farkas&quot;)
Organization: Microsoft
Date: Thu, 01 Apr 2004 00:40:55 GMT
Subject: RE: problem verifying XML signature
X-Tomcat-NG: microsoft.public.dotnet.security
Message-ID: &lt;i8GcJI4FEHA.660@cpmsftngxa06.phx.gbl&gt;
Newsgroups: microsoft.public.dotnet.security
NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
Path: TK2MSFTNGP08.phx.gbl!cpmsftngxa06.phx.gbl
Xref: TK2MSFTNGP08.phx.gbl microsoft.public.dotnet.security:6208

Hi Mark,

	The signature is in fact valid.  Unfortunately, support for X509 cerficiates in v1.1 and v1.0 of the framework is not very good.  The good 
news is that we've put a lot of effort into X509 for v2.0 of the framework.  I've just tried to verify your signature using v2.0, and it does work as 
expected.  There is a technical preview of v2.0 available for MSDN subscribers (check out http://msdn.microsoft.com/vs2005).  I would also 
recommend checking out the Web Service Extensions for v1.1 of the framework.  These include better support for certificates.  (You may have to 
use the extensions to get the key from your certificate manually, then pass that key to the signature verification method)


-Shawn
http://blogs.msdn.com/shawnfa

-- 

This posting is provided &quot;AS IS&quot; with no warranties, and confers no rights.
Note:  For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they 
originated.  
--------------------
&gt;Date: Wed, 31 Mar 2004 10:28:53 +0200
&gt;From: Marko Macek &lt;mark@hermes.si&gt;
&gt;User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
&gt;X-Accept-Language: en-us, en
&gt;MIME-Version: 1.0
&gt;Subject: problem verifying XML signature
&gt;Content-Type: multipart/mixed;
&gt; boundary=&quot;------------010309010308020706040304&quot;
&gt;Message-ID: &lt;ObIY2ovFEHA.3984@TK2MSFTNGP10.phx.gbl&gt;
&gt;Newsgroups: microsoft.public.dotnet.security
&gt;NNTP-Posting-Host: external-7.hermes.si 213.253.102.145
&gt;Lines: 1         
&gt;Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
&gt;Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.security:5600
&gt;X-Tomcat-NG: microsoft.public.dotnet.security
&gt;
&gt;Hello!
&gt;
&gt;I have a problem verifying a signature (attached xml) made with 
&gt;Ubisignature.
&gt;
&gt;I have tried verifying the signature with Microsoft SignedXml class 
&gt;(framework 1.1) and it dies like this:
&gt;
&gt;System.Security.Cryptography.CryptographicException:
&gt;Cryptographic service provider (CSP) for this implementation generated an
&gt;internal error while attempting to verify the signature. at
&gt;System.Security.Cryptography.RSACryptoServiceProvider.VerifyHash(Byte[]
&gt;rgbHash, String str, Byte[] rgbSignature) at
&gt;System.Security.Cryptography.RSAPKCS1SignatureDeformatter.VerifySignature(By
&gt;te[] rgbHash, Byte[] rgbSignature) at
&gt;System.Security.Cryptography.AsymmetricSignatureDeformatter.VerifySignature(
&gt;HashAlgorithm hash, Byte[] rgbSignature) at
&gt;System.Security.Cryptography.Xml.SignedXml.CheckSignature(AsymmetricAlgorith
&gt;m key) at
&gt;System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(Asymme
&gt;tricAlgorithm&amp; signingKey) at
&gt;
&gt;
&gt;I'm also tried to verify it using xmlsec (www.aleksey.com/xmlsec/).
&gt;
&gt;The of xmlsec output is:
&gt;
&gt;C:\work\xmlsec&gt;xmlsec --verify --node-xpath 
&gt;//*[@Id='DepositorSignature'] --trusted-der sigov-ca.crt --print-debug 
&gt;podpis_mm3.xml  = VERIFICATION CONTEXT
&gt;== Status: invalid
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== Id: &quot;DepositorSignature&quot;
&gt;== Key Info Read Ctx:
&gt;= KEY INFO READ CONTEXT
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled key data: all
&gt;== RetrievalMethod level (cur/max): 0/1
&gt;== TRANSFORMS CTX (status=0)
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled transforms: all
&gt;=== uri: NULL
&gt;=== uri xpointer expr: NULL
&gt;== EncryptedKey level (cur/max): 0/1
&gt;== Key Info Write Ctx:
&gt;= KEY INFO WRITE CONTEXT
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled key data: all
&gt;== RetrievalMethod level (cur/max): 0/1
&gt;== TRANSFORMS CTX (status=0)
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled transforms: all
&gt;=== uri: NULL
&gt;=== uri xpointer expr: NULL
&gt;== EncryptedKey level (cur/max): 0/1
&gt;== Signature Transform Ctx:
&gt;== TRANSFORMS CTX (status=2)
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled transforms: all
&gt;=== uri: NULL
&gt;=== uri xpointer expr: NULL
&gt;=== Transform: c14n (href=http://www.w3.org/TR/2001/REC-xml-c14n-20010315)
&gt;=== Transform: rsa-sha1 (href=http://www.w3.org/2000/09/xmldsig#rsa-sha1)
&gt;=== Transform: membuf-transform (href=NULL)
&gt;== Signature Method:
&gt;=== Transform: rsa-sha1 (href=http://www.w3.org/2000/09/xmldsig#rsa-sha1)
&gt;== Signature Key:
&gt;== KEY
&gt;=== method: RSAKeyValue
&gt;=== key type: Public
&gt;=== key usage: 65535
&gt;=== rsa key: size = 1023
&gt;== SignedInfo References List:
&gt;=== list size: 1
&gt;= REFERENCE VERIFICATION CONTEXT
&gt;== Status: succeeded
&gt;== URI: &quot;&quot;
&gt;== Reference Transform Ctx:
&gt;== TRANSFORMS CTX (status=2)
&gt;== flags: 0x00000000
&gt;== flags2: 0x00000000
&gt;== enabled transforms: all
&gt;=== uri: NULL
&gt;=== uri xpointer expr: NULL
&gt;=== Transform: enveloped-signature 
&gt;(href=http://www.w3.org/2000/09/xmldsig#enveloped-signature)
&gt;=== Transform: c14n (href=http://www.w3.org/TR/2001/REC-xml-c14n-20010315)
&gt;=== Transform: sha1 (href=http://www.w3.org/2000/09/xmldsig#sha1)
&gt;=== Transform: membuf-transform (href=NULL)
&gt;== Digest Method:
&gt;=== Transform: sha1 (href=http://www.w3.org/2000/09/xmldsig#sha1)
&gt;== Manifest References List:
&gt;=== list size: 0
&gt;func=:file=..\src\openssl\signatures.c:line=248:obj=rsa-sha1:subj=EVP_VerifyFinal:error=18:data 
&gt;do not match:signature do not match
&gt;FAIL
&gt;SignedInfo References (ok/all): 1/1
&gt;Manifests References (ok/all): 0/0
&gt;Error: failed to verify file &quot;podpis_mm3.xml&quot;
&gt;============================================================
&gt;
&gt;One thing that I find odd is:
&gt;
&gt;=== rsa key: size = 1023
&gt;
&gt;But Ubisignature and Java (apache) implementations verify the signature 
&gt;as valid.
&gt;
&gt;Can anyone help? Is the signature valid or not? Where is the problem?
&gt;
&gt;The CA certificate is at http://www.sigov-ca.gov.si/sigov-ca.crt
&gt;
&gt;Thanks,
&gt;Mark
&gt;
&gt;
&gt;
&gt;
&gt;
&gt;


]
