Coding the Challenge-Response Mechanism

NOTE   A license containing secrets (character set: A-Z, a-z, and 0-9) must be loaded on the License Manager.

Declare Variables/Constants

#define FEATURE_NAME           "Feature1"
#define CONTACT_SERVER         "localhost"
#define SECRET_KEY_INDEX       "1"
#define CHALLENGE_DATA_SIZE    "8"
#define CHALLENGE_DATA         "12xd78jh "

sntl_licensing_attr_t *pAttr = NULL;
sntl_licensing_app_context_t *pAppContext = NULL;
sntl_licensing_login_session_t *pLoginSession = NULL;

char* pcSessionInfo = NULL;

API Calls

To use the challenge-response mechanism while requesting a license, execute the APIs in the specified sequential order only:

sntl_licensing_attr_new(&pAttrAppContext);
sntl_licensing_attr_set_appcontext_contact_server (pAttrAppContext, CONTACT_SERVER);

If instead the LSFORCEHOST or LSHOST environment variables are set, then the above-mentioned steps are not required.

sntl_licensing_app_context_new(0, pAttr, &pAppContext); 
sntl_licensing_attr_set_login_challenge_secret(pAttr, SECRET_KEY_INDEX);
sntl_licensing_attr_set_login_challenge_data(pAttr, CHALLENGE_DATA);
sntl_licensing_login_attr(pAppContext, FEATURE_NAME, pAttr, &pLoginSession);
sntl_licensing_get_session_info(pLoginSession,SNTL_SESSIONINFO, &pcSessionInfo);

If the sntl_licensing_get_session_info call is successful, the pcSessionInfo parameter contains an XML output having the detailed information (an example output of sntl_licensing_get_session_info() API is shown here).

Note

>The SNTL_SESSIONINFO constant is defined in the licensing.h header file.

>Refer to the C sample of the Unified API (installed in the Sentinel RMS SDK) for a specific API function, its parameters, and usage.