Community articlesignForm method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method acts on a button node and creates a digital signature for that button. The signature is created using the signature filter in the button and the private key of the signer.

Method

   public Signature signForm(
      Certificate theSigner,
      StringDictionary theInfo,
      IntHolder theStatus,
   ) throws UWIException;


Parameters

Table 1. Method parameters
ExpressionTypeDescription
theSignerCertificateThe certificate to use to create the signature.
theInfoStringDictionaryAlways use a null value.
theStatusIntHolderThis is a status flag that reports whether the operation was successful. Possible values are:
SecurityUserStatusType.SUSTATUS_OK — the operation was successful.
SecurityUserStatusType.SUSTATUS_ CANCELLED — the operation was cancelled by the user.
SecurityUserStatusType.SUSTATUS_INPUT_ REQUIRED — the operation required user input, but could not receive it (for example, it was run on a server with no user).


Returns

A signature object if the call is successful, or throws a generic exception (UWIException) if an error occurs.

Example

The following example uses dereferenceEx to locate a specific signature button node. getCertificateList is then used to get a list of valid certificates for that button. Finally, signForm signs the button using the first certificate in the list.
   private void createSignature(FormNodeP theForm)throws Exception
   {
   FormNodeP buttonNode;
   IntHolder theStatus;
   Signature theSignature;
   Certificate [] certList;
 
      if ((buttonNode = theForm.dereferenceEx(null, "PAGE1.SIGBUTTON1", 
         0, FormNodeP.UFL_ITEM_REFERENCE, null)) == null)
      {
         throw new UWIException("Could not locate SIGBUTTON1 node.");
      }
      theStatus = new IntHolder();
      certList = buttonNode.getCertificateList(null, theStatus);
      if (theStatus.value == SecurityUserStatusType.SUSTATUS_INPUT_REQUIRED)
      {
         throw new UWIException("User input required to sign form.");
      }
      theSignature = buttonNode.signForm(certList[0], null, theStatus);
            
      if (theStatus.value == SecurityUserStatusType.SUSTATUS_INPUT_REQUIRED)
      {
         throw new UWIException("User input required to sign form.");
      }
   }


Parent topic:
FormNodeP class