Bug in XML signature??? Are there users than CAN answer???? -
12-07-2007
, 06:24 AM
Hi,
I already posted two items - but no one seems to have the knowledge to help
me out...
In the mean time I found out the following:
My existing signatures are testet using
SignedXml sXml = new SignedXml(licenses);
sXml.LoadXml(signature);
RSA csp = RSA.Create();
csp.FromXmlString(context.GetSavedLicenseKey(typeo f(MyLicense),
Assembly.GetCallingAssembly()));
sXml.SigningKey = csp;
if (sXml.CheckSignature())
m_SignatureState = Signature.Valid;
else
m_SignatureState = Signature.Invalid;
When I create a new signature, mehtod CheckSignature() suddenly returns
FALSE.... I used the same code as the valid signature!!!
I need to include KeyInfo while signing and MUST change to
//sXml.SigningKey = csp;
if (sXml.CheckSignature(csp))
m_SignatureState = Signature.Valid;
else
m_SignatureState = Signature.Invalid;
in order to get it working again.
Old signatures return TRUE on
sXml.SigningKey = csp;
if (sXml.CheckSignature())
m_SignatureState = Signature.Valid;
else
m_SignatureState = Signature.Invalid;
New signatures must have KeyInfo included and return TRUE on
if (sXml.CheckSignature(csp))
m_SignatureState = Signature.Valid;
else
m_SignatureState = Signature.Invalid;
Can anybody tell me why???
Can anybody tell me how to implement a signature WITHOUT <KeyInfo> in the
XML file???
Please help me out,
Hans. |