Geeks With Blogs

News
Charles Young

A colleague is currently extending an existing .NET 1.1 application, and is adding functionality to handle SAML tokens provided by an identity provider web site.   He came across the problem of handing exclusive XML canonicalisation in the older version of the framework.   Microsoft supports the use of pluggable 'transform' classes to handle XML digital signature transforms (as specified using the element in the XML Digital Signature standard.   The trouble is that version 1.1 of the framework does not contain a transform class for exclusive XML canonicalisation.   Every time he tried to validate the digital signature in the token he got an error message saying:

    "Could not create the XML transformation identified by the URI http://www.w3.org/2001/10/xml-exc-c14n#."

Version 2.0 of the framework has a suitable transform class called XmlDsigExcC14NTransform in the System.Security.Cryptography.Xml namespace (System.Security assembly).   However, this is no use to my colleague, as the code he is working on is written for 1.1.   It turns out that WSE 2.0 has a suitable class of the same name, but different namespace (Microsoft.Web.Services2.Security.Xml).   This is in the Microsoft.Web.Services2 assembly.

In order to handle exclusive XML canonicalisation in Framework 1.1, install WSE 2.0 SP3.   You must also register the transform class in your machine.config file.   Here is the XML you need to add to machine.config:

Transform Configuration
Don't forget to reboot your machine after changing machine.config.

This actually configures two transform classes.   XmlDsigExcC14NWithCommentsTransform has the same functionality as XmlDsigExcC14NTransform, but will handle the serialisation of XML comments.   The 'name' attributes of the elements specify the URIs that can be used in the of the digital signature.   Now, when you call Checksignature() on an instance of SignedXml, the code should be able to handle the transform.

Posted on Monday, May 22, 2006 5:21 PM | Back to top


Comments on this post: Handling Exclusive XML Canonicalisation in .NET 1.1

# re: Handling Exclusive XML Canonicalisation in .NET 1.1
Requesting Gravatar...
Hi, I made the machine.config modifications without success, I still have the same error. How can I check if my modifications has been loaded?
Thanks
Left by Gibson on Jan 18, 2007 4:49 PM

Your comment:
 (will show your gravatar)


Copyright © Charles Young | Powered by: GeeksWithBlogs.net