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

String FEATURE_NAME = "Feature1";
String CONTACT_SERVER = "localhost";
String SECRET_KEY_INDEX = "1";
String CHALLENGE_DATA = "12xd78jh";

Attribute attrAppContext = null;
Attribute attrLogin = null;
ApplicationContext appContext = null;
LoginSession session = null;

API Calls

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

>attrAppContext = new Attribute();


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

>appContext = new ApplicationContext(attrAppContext);

>attrLogin = new Attribute();



>session = new LoginSession();

>session.login(appContext, FEATURE_NAME, attrLogin);

>String sessioninfo = session.getSessionInfo(LicensingConstants.SNTL_SESSIONINFO);

If the session.getSessionInfo call is successful, the sessioninfo string contains an XML output having detailed information.

NOTE   The SNTL_SESSIONINFO constant is defined in the LicensingConstants.cs file.