Community articleUFLGetSecurityEngineName function
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 function returns the name of the appropriate security engine for a given button or signature node. This is useful for determining which validation call you need to make to validate the signature.

Function

   r_error UFLGetSecurityEngineName(
      formNodeP sigNode,
      r_u_long theOperation,
      r_charP *theName
   );


Parameters

Table 1. get security engine name parameters
ExpressionTypeDescription
sigNode formNodePThe button or signature node to find a security engine for.
theOperationr_u_longThe operation you want the security engine for. Possible values are:
SEOPERATION_SIGN — the engine that is needed to sign the form.
SEOPERATION_VERIFY — the engine that is needed to verify the signature.
SEOPERATION_LISTIDENTITIES — the engine that is needed to generate a list of valid certificates for signing.
theName r_charP*The name of the appropriate security engine. The possible names are:
  • CryptoAPI
  • Netscape
  • ClickWrap
  • HMAC-ClickWrap
  • PenOp
Note that this string must be freed by the caller.


Returns

OK on success or an error code on failure.

Example

The following example uses UFLGetSecurityEngineName to get the appropriate engine for a signature verification. If the engine is HMAC-ClickWrap, the example calls a function that will verify an HMAC signature. Otherwise, the example calls a function that verifies other types of signatures.
   r_error validateSignature(formNodeP sigNode)
   {
   r_charP engineName;
   r_error error;
 
      if ((error = UFLGetSecurityEngineName(sigNode, SEOPERATION_VERIFY,
         &engineName)) == OK)
      {
         fprintf (stderr, "UFLGetSecurityEngineName error %hd.\n", error);
         return(NOTOK);
      }
      if (cp_strcmp(engineName, "HMAC-ClickWrap") == 0)
      {
         if ((error = validateAuthenticatedClickwrapSignature(sigNode))
            != OK)
         {
            fprintf (stderr, "validateAuthenticatedClickwrapSignature error
               %hd./n", error);
            return(NOTOK);
         }
      }
      else
      {
         if ((error = validateNormalSignature(sigNode)) != OK)
         {
            fprintf (stderr, "validateNormalSignature error %hd./n",
               error);
            return(NOTOK);
         }
      }
      cp_free(engineName);
   }


Parent topic:
FormNodeP functions