The avaintec.xdss.widget package contains a Dojo widget that provides script support for X-DSS components used to create and validate XML signatures of various types.
Currently supported:
To run X-DSS, install and configure the server-side components:
These packages are configured with {avaintec-config-home}/configuration.xml and {avaintec-config-home}/xdss/configuration.xml. See these files and the documentation provided with them for details on what goes in them.
The main X-DSS integration component is the Signature widget. To use X-DSS in your web application, you need to get it up and running, add the following to your web page, in this order:
Set the Dojo parameters in the config attribute of the bootstrap loader:
<script type="text/javascript" src="/dojo-home/dojo/dojo.js" config="parseOnLoad: true, isDebug: true, locale : 'en'">
<script type="text/javascript">
"avaintec.xdss.widget.Signature"
</script>
<button id="myLittleSignature"
data-dojo-type="avaintec.xdss.widget.Signature"
preSignCall="p_prepareSigning"
postSignCall="p_finishSigning"></button>
The function referenced in preSignCall is triggered when the user initiates signing from the widget. The postSignCall function is triggered when the signature process terminates. Both functions get a pointer to the widget triggering them as an argument.
The preSignCall function must:
The postSignCall function is expected to retrieve the signature created with the widget from the widget's .signedMessage field.
Trivial examples:
function p_prepareSigning( signerWidget )
{
signerWidget.signMessage = dom.byId( "sign_message" ).value;
signerWidget.startSigning();
}
function p_finishSigning( signerWidget )
{
if( signerWidget.status == 0 )
{
document.getElementById( "signature_markup" ).value = signerWidget.signedMessage;
}
else
{
alert( "Whoops, an error occurred when signing!" );
}
}
See the documentation for the Signature widget and the related classes under signers for more information on various settings and options that you can access through the widget.