Is it possible to see what type of canonicalization was used whensigned?

A

AK

Hiya,

I need to check what type of canonicalization that was used when an
XML file was signed (if any). Currently I'm trying to do it like this:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(mySignedXmlFile);
SignedXml signedXml = new SignedXml(xmlDoc);

string canonicalizationMethod=
signedXml.SignedInfo.CanonicalizationMethod;

However this returns the same result regardless of which method was
used, or even if it's not signed at all. I'm sure I'm doing something
obviously wrong here, can anyone see what?

Many thanks,

AK
 
J

Jeroen Mostert

AK said:
I need to check what type of canonicalization that was used when an
XML file was signed (if any). Currently I'm trying to do it like this:

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(mySignedXmlFile);
SignedXml signedXml = new SignedXml(xmlDoc);

string canonicalizationMethod=
signedXml.SignedInfo.CanonicalizationMethod;
Try loading the signature first, as described in the MSDN:
http://msdn.microsoft.com/library/ms229950

Disclaimer: I don't know if this actually solves your problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top