Reputation: 371
Is it enough to just specify the canonicalization method to canonicalize the input xml as in
signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
or should we also have to new up XmlDsigExcC14NTransform and add it as in
var reference = new Reference { Uri = ""};
reference.AddTransform(new XmlDsigExcC14NTransform());
signedXml.AddReference(reference);
Upvotes: 1
Views: 1131
Reputation: 66
There is a difference on which elements the canonicalization algorithm is applied to.
The canonicalization algorithm specified in CanonicalizationMethod is applied to the SignedInfo element of the signature node and is used for the calculation of SignatureValue
A Reference with an empty URI addresses the node set of the XML resource containing the signature node, so the canonicalization algorithm specified in the Transform element of a reference is applied to this nodeset. In this case the canonicalization is used for the calculation of a DigestValue
Upvotes: 3