Package avaintec.xdss.widget

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:

Installation

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.

Integration into web application

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:

1. Include the Dojo bootstrap on your web page

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'">
parseOnLoad (boolean)
Do widgets get parsed when the page is loaded? Must be set to "true" unless you want to parse the widgets manually.
isDebug (boolean)
Are debug messages logged on the console?
locale
Language of UI messages. Supported locales: en, fi, (se).

2. Import the X-DSS Signature widget script

<script type="text/javascript">
"avaintec.xdss.widget.Signature"
</script>

3. Instantiate the widget somewhere on your page

<button id="myLittleSignature" data-dojo-type="avaintec.xdss.widget.Signature" preSignCall="p_prepareSigning" postSignCall="p_finishSigning"></button>

4. Write the preSignCall and postSignCall functions referenced above

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 also

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.