Community articlegetSignature method
Added by IBM contributorIBM on May 2, 2012
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 method returns signature object for a given button or signature item.

Method

   public Signature getSignature() throws UWIException;


Parameters

There are no parameters for this method.

Returns

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

Example

The following example uses getSignature to get the signature object from the signature node, and uses getDataByPath to get the signer's identity from the signature object. It then calls validateHMACWithSecret to validate the signature.
   public short checkSignature(FormNodeP theSignatureNode, 
      Certificate theServerCert)
   {
   Signature theSignatureObject;
   String theSecret;
   String signerCommonName;
   BooleanHolder encodedData;
   IntHolder theStatus;
   short validation;
      
      theSignatureObject = theSignatureNode.getSignature();
      encodedData = new BooleanHolder();
      if ((signerCommonName = theSignatureObject.getDataByPath(
         "SigningCert: Subject: CN", false, encodedData)) == null)
      {
         throw new UWIException("Could not determine signer's name.");
      }
 
      /* Include external code that matches the signer's identity to a shared 
         secret, and sets theSecret to match.  This is most likely a
         database lookup. */
 
      theStatus = new IntHolder();
      
      validation = theSignatureNode.validateHMACWithSecret(theSecret, 
         theServerCert, theStatus);
 
      /* Check the status in case the process required user input. */
 
      if (theStatus.value != SecurityUserStatusType.SUSTATUS_OK)
      {
         throw new UWIException("Validation required user input.");
      }
      return(validation);
   }


Parent topic:
FormNodeP class