Community articleUFLSignForm function
Added by IBM contributorIBM on August 16, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.



Description

This function takes 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.
This function returns a signature object that is tracked by reference counts. If you do not need to use the object, remember to release the reference to it.

Function

   r_error UFLSignForm(
      formNodeP theButton,
      Certificate *theSigner,
      StringDictionary *theInfo,
      SecurityUserStatusType *theStatus,
      Signature **theSignature
   );


Parameters

Table 1. Function parameters
ExpressionTypeDescription
theButton formNodePThe form node that represents the signature button.
theSignerCertificate* The certificate to use to create the signature.
theInfoStringDictionary*Always use a NULL value.
theStatusSecurityUserStatusType*This is a status flag that reports whether the operation was successful. Possible values are:
SUSTATUS_OK — the operation was successful.
SUSTATUS_CANCELLED — the operation was cancelled by the user.
SUSTATUS_INPUT_REQUIRED — the operation required user input, but could not receive it (for example, it was run on a server with no user).
theSignature Signature **The signature object that the function creates. Note that this object is tracked by reference counts, and must be released.


Returns

OK on success or an error code on failure.

Example

In the following example, UFLDereferenceEx is used to retrieve the node of a specific signature button. UFLSignForm is then used to create a signature object. Since we do not need to use the signature object, we then release the reference count to that object.
   r_error createSignature(formNodeP form, Certificate *theSigner)
   {
   Signature *theSignature;
   SecurityUserStatusType theStatus;
   formNodeP buttonNode;
   r_error error;
 
      if ((buttonNode = UFLDereferenceEx(form, NULL, "PAGE1.SIGNBUTTON", 
         0, UFL_ITEM_REFERENCE, NULL)) == NULL)
      {
         fprintf(stderr, "Could not locate SIGNBUTTON node.\n");
         return(NOTOK);
      }
      if ((error = UFLSignForm(buttonNode, theSigner, NULL, &theStatus, 
         &theSignature)) != OK)
      {
         fprintf(stderr, "UFLSignForm error %hd.\n", error);
         return(NOTOK);
      }
 
      /* Check the status in case the process required user input. */
 
      if (theStatus != SUSTATUS_OK)
      {
         fprintf(stderr, "User input required to sign form./n");
         return(NOTOK);
      }
 
      /* Release the signature object. */
 
      IFSObject_ReleaseRef((IFSObject*)theSignature);
      return(OK);
   }


Parent topic:
FormNodeP functions