Enabling Digital Signatures in InfoPath forms created from pre-defined schemas
Recently I was working on some InfoPath samples for United Nation's Electronic Documents standards (UNeDOCs: https://www.unece.org/etrades/unedocs/), and one of the key requirements I am looking at with InfoPath is the ability to digitally sign the form. Sounds like a no-brainer, since this feature is given with InfoPath.
However, after I happily imported the schema into InfoPath and attempted to enable digital signature:
Ok, so InfoPath didn't allow me to enable digital signatures. What's wrong with my xsd?
A little click on the least-clicked button in InfoPath (that's the little [?] help button) and a quick search on "Digital Signature" reveals:
Take note of the... well, NOTE. "If a form template was designed based on an XML Schema, you can enable digital signatures for the form template only if the XML Schema has a node that is in the W3C Xml digital signature namespace". Well, that's compliance for you.
So, using the all-powerfull killer app (that's NOTEPAD.exe), I open the xsd file and added a new element for my digital signature and point it to the W3C digital signature namespace: https://www.w3.org/2000/09/xmldsig#
<xsd:any minOccurs="0" maxOccurs="unbounded" namespace="https://www.w3.org/2000/09/xmldsig#" processContents="lax"/>
Voila, now InfoPath allows digital signatures on my form!