> >> representation to the "c#" one underhttp://
www.jensign.com/opensslkey/
> >> Unfortunately I need it the other way around..
> > I found a solution for that problem. Have a look at the Chillkat
> > Component athttp://
www.chilkatsoft.com/refdoc/csPrivateKeyRef.html
> > It provides functiones to load and save RSA Keys in arbitrary formats.
>
> > So here is what I did:
> > I created a RSA keypair with the .Net Framework (using the
> > RSACryptoServiceProvider
> >
http://msdn.microsoft.com/en-us/library/system.security.cryptography....
> > ). Then I converted the private key to PEM format, using the Chilkat
> > component. I rechecked the result with the the tool I posted above
> > (
http://www.jensign.com/opensslkey/) by converting the PEM formatted
> > private key back to the XML representation - the key were the same.
>
> > Unfortunately, there is still a problem, because the SignatureValue
> > generated by the .Net Framework is different from the one produced by
> > xmlseclibs.
> > The DigestValue is the same, though. As far as I understood, the
> > Digest is a hash of the content - which is then encrypted by RSA. Did
> > I get that right?
> > If thats the case, the problem must be somewhere in the encryption
> > process.
>
> > Im a little lost right now, because I don't know where to look for the
> > error. Any Ideas?
>
> I would check the whitespace used in the SignedInfo subtree between the
> 2 documents. In the majority of cases where people have reported a
> problem when comparing the SignatureValue that is calculated it ended up
> being the difference in use of whitespace. Whitespace is significant and
> is taken into account when calculating the SignatureValue.
>
> Rob
Which information is actually used to calculate the Signature? As I
said, so far i was thinking that the Signature does only calculate the
RSA encrypted Value of the Digest. I have noticed that C# does not use
namespaces to specify the Signature XML elements while xmlseclib does.
There is also a small difference in the whitespaces. I uploaded 3
files to show the differences
1. Signature generated by C#
http://www.b-landau.de/upload/c_sharp.xml
2. Signature generated by xmlseclib
http://www.b-landau.de/upload/xmlseclibs.xml
3. input xml
http://www.b-landau.de/upload/input.xml
The generation was done by openening the input.xml, get the contents
and encrypt it, so that copy and paste mistakes can be excluded.
As I mentioned, there is a differnce in the namespace and in the
whitespaces. Could that be the cause? if yes, how can i change this,
because the KeyInfo is auto generated..?
Pascal