After I create the custom signature XML using the 'System.Security.Cryptography.Xml' namespace's classes and insert the signature fragment to the appropriate container element in the document, InfoPath 2010's internal logic does not apper to be able to process the signature correctly.
1. After the signature event has executed, the details button on the view does not bring up the signature details dialog until I have submitted or re-opened the form.
2. The signature is not validated correctly, because InfoPath 2010's validation logic is apparently not able to read namespace (xmlns) declarations for the signature XML from the document's header, and expects to find them from the signature fragment itself instead. The problem is that the XPathNavigator class used to access the form's DOM strips away these ns declarations which it can find from the document already, thus falsely invalidating the signature. This namespace issue might relate to the suspiciously similar sounding problem concerning the SignedXml class, which is also not able to validate a signature if the signature fragment is referencing elements under some namespaces other than the empty default. This supposedly was fixed for .NET 1.1 (http://support.microsoft.com/kb/888999/en-us), but 2.0 still seems to be riddled with the faulty implementation. This issue I was actually able to workaround by grabbing the underlying XDocument's DOM using reflection and injecting the namespace declarations back to where they were stripped from. But this is a bit dirty and I would rather have the signature validation logic work as it should and as it used to with IP 2007.
The same custom signature code I have works perfectly well in InfoPath 2007.