com.vs.ezlicrun
Class EzLicenseInfo

java.lang.Object
  extended by com.vs.ezlicrun.EzLicenseInfo
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EzLicenseExtendedAPI

public class EzLicenseInfo
extends java.lang.Object
implements java.io.Serializable

The class manages the state of the information pertaining to a license key and provides a method to check a license key. How to use for checking a license key in an ISV product:
1. Instantiate this class: info = new EzLicenseInfo();
2. Check the license key: int warningBitmap = info.checkLicenseKey( licenseKey, etc.);
3. If no exception, the key is good, and the accessors for the class can be invoked to obtain the decomposed info such as quota limit, expiration date, concurrent-user limit, etc.
4. If the returned warning bit map is non-zero, appropriate warning messages / alerts may be issued by the ISV application to the end user informing them of impending expirations, quota exhaustion, etc.
Changes for 2.0: 1. If OS enforcement: user / host / net arg is optional 2. Windows: OS enforcement is based on case-insensitive comparison. 3. Custom key handler is invoked after entire key is assembled. 4. Allow for small (6-hr) timestamp discrepancies when checking system clock. 5. System-clock-change-check: hard-enforce w/ file in user home dir. 6. Expiration dates: base on absolute timestamps. 7. Custom key handler: invoked irrespective of existence of custom key value. 8. Context initialization for factory methods. New in 2.0: 1. Additional key content: key version, application password 2. Private-key-encrypted custom key and cookie if application password specified. 3. Application password public key argument for check API calls. 4. Visible additional key content: key version. 5. Automatic, secure application state management in key cookie using secure API extensions. Quota consumption is built-in, and in addition the application can store and update arbitrary application-managed state in the key cookie. 6. Optional disabling of system clock checking for perpetual keys (enabled by default). If enabled, or if a key is time limited, a cross-check is made against a hidden file and (for the secure API's) the key cookie's timestamp. This applies to all flavors of license key checking API calls. 7. Optional hidden-file location specification. By default, the hidden file is located at the current directory ("."). New in 2.5: 1. Additional license checking API call signatures accepting a "strict" password check, which if set forces a password check. 2. Library version and status message introspection functions 3. Changed semantics for disabling of system clock checking to encompass time-limited licenses as well. 4. Added API call to set time tolerance. 5. Hidden file directory specification can specify an explicit file name ending in ".ehf". 6. Atomic hidden file update mgmt to protect from file corruption due to crash / concurrency conflict.

See Also:
Serialized Form

Nested Class Summary
static class EzLicenseInfo.Hfile
           
static class EzLicenseInfo.Util
           
 
Field Summary
static int EZLIC_DEFAULT_TIME_TOLERANCE_HRS
          Default time tolerance in hours
static int EZLIC_KEY_VSN
          Previous key version
static int EZLIC_KEY_VSN_CURR
          Current new-feature key version
static int EZLIC_KEY_VSN_CURR_S
          Current new-feature + secure key version
static int EZLIC_KEY_VSN_NEXT
          Future key version
static int EZLIC_MODE_CUSTOM_COOKIE
          Custom cookie
static int EZLIC_MODE_CUSTOM_KEY
          Custom key
static int EZLIC_MODE_METERED
          Metered
static int EZLIC_MODE_OPTIONS
          Option-enabling
static int EZLIC_MODE_TIME
          Time limited
static int EZLIC_MODEL_SERVER
          Server license model
static int EZLIC_MODEL_USER
          Single-user license model
static int EZLIC_TYPE_SVR_CONC
          Concurrent user
static int EZLIC_TYPE_SVR_CPU
          CPU count
static int EZLIC_TYPE_SVR_MHZ
          CPU MHZ
static int EZLIC_TYPE_SVR_NMU
          Named-user
static int EZLIC_TYPE_U_FLOAT
          Floating
static int EZLIC_TYPE_U_NODE
          Node-locked
static int EZLIC_TYPE_U_USER
          User-locked
static int EZLM_MAJOR_VERSION_NUMBER
          Runtime library normalized major version number
static int EZLM_MINOR_VERSION_NUMBER
          Runtime library normalized minor version number
 
Constructor Summary
EzLicenseInfo()
           
 
Method Summary
 int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue)
          (Full version, no application password:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword)
          (Full version with application password check for access-controlled keys, but no hidden-timestamp-file control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, boolean strictPwdCheck)
          (Full version with application password check for access-controlled keys, but no hidden-timestamp-file control and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String hfileDirectory, boolean alwaysCheckTimestamp)
          (Full version with application password check for access-controlled keys, with hidden-file-timestamp-check control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkLicenseKey(java.lang.String licenseKey, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String hfileDirectory, boolean alwaysCheckTimestamp, boolean strictPwdCheck)
          (Full version with application password check for access-controlled keys, with hidden-file-timestamp-check control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue)
          (Basic secure version:) Check the specified license key against the provided info for key violations, and set the class context based on the key.
 java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String appState)
          (Full secure version w/o hidden-file-timestamp check control:) Check the specified license key against the provided info for key violations, and set the class context based on the key.
 java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String appState, boolean strictPwdCheck)
          (Full secure version w/o hidden-file-timestamp check control with strict password check:) Check the specified license key against the provided info for key violations, and set the class context based on the key.
 java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String appState, java.lang.String hfileDirectory, boolean alwaysCheckTimestamp)
          (Full secure version with hidden-file-timestamp check control:) Check the specified license key against the provided info for key violations, and set the class context based on the key.
 java.lang.String checkLicenseKeySecure(java.lang.String licenseKey, java.lang.String keyCookie, EzLicExceptionBase customException, EzLicCustomLicenseInterface customKeyHandler, java.lang.Object customKeyContext, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostNet, long currUsageValue, java.lang.String product, java.lang.String appPassword, java.lang.String appState, java.lang.String hfileDirectory, boolean alwaysCheckTimestamp, boolean strictPwdCheck)
          (Full secure version with hidden-file-timestamp check control and strict passpowd check:) Check the specified license key against the provided info for key violations, and set the class context based on the key.
 int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String hostNetName, long currUsageValue)
          (Basic multi-user license check w/ no access control check, for backward compatibility:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String hostNetName, long currUsageValue, java.lang.String product, java.lang.String appPassword)
          (Basic multi-user license check w/ access control check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String hostNetName, long currUsageValue, java.lang.String product, java.lang.String appPassword, boolean strictPwdCheck)
          (Basic multi-user license check w/ access control check and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostName)
          (Basic single-user license check w/ no access-control check, for backward compatibility:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostName, java.lang.String product, java.lang.String appPassword)
          (Basic single-user license check w/ access-control check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
 int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey, int daysLeftThreshold, long quotaUsageToDate, long quotaThreshold, int daysGracePeriod, long quotaGrace, java.lang.String userHostName, java.lang.String product, java.lang.String appPassword, boolean strictPwdCheck)
          (Basic single-user license check w/ access-control check and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key.
static boolean cleanupKeyCookie(java.lang.String keyCookie, java.lang.String productName, java.lang.String appPassword)
          Clean up persistent structures associated with key cookie.
static boolean cleanupKeyCookie(java.lang.String keyCookie, java.lang.String productName, java.lang.String appPassword, java.lang.String hfileDirectory, boolean check)
          (hidden-file-timestamp-check-control version): Clean up persistent structures associated with key cookie.
static java.lang.String createKeyCookieSeed(java.lang.String productName)
          createKeyCookieSeed: Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application.
static java.lang.String createKeyCookieSeed(java.lang.String productName, java.lang.String appPassword, java.lang.String appState, boolean check)
          createKeyCookieSeed: Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application based on an application password, and specifying an application-managed state to be maintained securely in the key cookie.
static java.lang.String createKeyCookieSeed(java.lang.String productName, java.lang.String appPassword, java.lang.String appState, boolean check, java.lang.String hfileDirectory)
          createKeyCookieSeed (controlled-hidden-file-location version): Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application based on an application password, and specifying an application-managed state to be maintained securely in the key cookie.
 java.lang.String getAppPwd()
          FOR INTERNAL USE ONLY
 java.lang.String getChainedKeyId()
          getChainedKeyId: returns chained key id, null if none.
 java.lang.String getCustomCookie()
          getCustomCookie: returns custom cookie contained in the license key, null if none
 java.lang.String getCustomKey()
          getCustomKey: returns custom key contained in the license key, null if none
 boolean getEnforce()
          getEnforce: returns whether user / host name check is enforced
 java.util.Date getExpirationDate()
          getExpirationDate: returns expiration date, null if none
 long getExpirationTs()
          getExpirationTs: returns expiration timestamp, 0 if none.
static java.lang.String[] getEzlmVersionInfo()
          Get version information string
static java.lang.String getKeyCookieAppState(java.lang.String keyCookie, java.lang.String productName, java.lang.String appPassword)
          Get application state stored in key cookie.
static long getKeyCookieQuotaToDate(java.lang.String keyCookie, java.lang.String productName, java.lang.String appPassword)
          Get quota-to-date stored in key cookie.
static long getKeyCookieTs(java.lang.String keyCookie, java.lang.String productName, java.lang.String appPassword)
          Get last-update timestamp stored in key cookie.
 int getKeyVersion()
          getKeyVersion: returns 2-digit key version.
 java.lang.String getLicenseKey()
          getLicenseKey: returns license key
 int getLicenseModeBitmap()
          getLicenseModeBitmap: returns license mode bitmap, bits set per EZLIC_MODE_*.
 int getLicenseModelCode()
          getLicenseModelCode: returns license model code
 int getLicenseTypeCode()
          getLicenseTypeCode: returns license type code
 java.lang.String getOptions()
          getOptions: returns options string, null if none
 long getQuotaValue()
          getQuotaValue: returns quota limit value, -1 if no quota limit.
static int getTimeToleranceHrs()
          Get the current setting for the time tolerance.
 long getUsageValue()
          getUsageValue: returns usage limit value (cpu / CPU MHZ etc.) for the license key, -1 if no limit.
 java.lang.String getUserHostNetName()
          getUserOrHostName: returns user / host name, null if none
 int getWarningsBitmap()
          getWarningsBitmap: returns warning bitmap for license key
 void setCustomCookie(java.lang.String customCookie)
          setCustomCookie: sets custom cookie value N/A during run time license key check
 void setCustomKey(java.lang.String customKey)
          setCustomKey: sets custom key value N/A during run time license key check
 void setEnforce(boolean enforce)
          setEnforce: sets user / host enforcement policy N/A during run time license key check
 void setExpirationDate(java.util.Date expirationDate)
          setExpirationDate: sets license expiration date N/A during run time license key check
 void setKeyVersion(int keyVsn)
          setKeyVersion: sets key version value N/A during run time license key check
 void setLicenseKey(java.lang.String licenseKey)
          setLicenseKey: sets license key N/A during run time license key check
 void setLicenseModeBitmap(int licenseModeBitmap)
          setLicenseModeBitmap: sets license mode bitmap N/A during run time license key check
 void setLicenseModelCode(int licenseModelCode)
          setLicenseModelCode: sets license model code N/A during run time license key check
 void setLicenseTypeCode(int licenseTypeCode)
          setLicenseTypeCode: sets license type code N/A during run time license key check
 void setOptions(java.lang.String options)
          setOptions: sets options string N/A during run time license key check
 void setQuotaValue(long quotaValue)
          setQuotaValue: sets usage quota value N/A during run time license key check
static void setTimeToleranceHrs(int tolerance)
          Set the time tolerance for system clock checking.
 void setUsageValue(long usageValue)
          setUsageValue: sets value for usage limit N/A during run time license key check
 void setUserHostNetName(java.lang.String userHostNetName)
          setUserHostNetName: sets user / host / network name according to context N/A during run time license key check
 void setWarningsBitmap(int warningsBitmap)
          setWarningsBitmap: sets warning bitmap N/A during run time license key check
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EZLM_MAJOR_VERSION_NUMBER

public static final int EZLM_MAJOR_VERSION_NUMBER
Runtime library normalized major version number

See Also:
Constant Field Values

EZLM_MINOR_VERSION_NUMBER

public static final int EZLM_MINOR_VERSION_NUMBER
Runtime library normalized minor version number

See Also:
Constant Field Values

EZLIC_KEY_VSN

public static final int EZLIC_KEY_VSN
Previous key version

See Also:
Constant Field Values

EZLIC_KEY_VSN_CURR

public static final int EZLIC_KEY_VSN_CURR
Current new-feature key version

See Also:
Constant Field Values

EZLIC_KEY_VSN_CURR_S

public static final int EZLIC_KEY_VSN_CURR_S
Current new-feature + secure key version

See Also:
Constant Field Values

EZLIC_KEY_VSN_NEXT

public static final int EZLIC_KEY_VSN_NEXT
Future key version

See Also:
Constant Field Values

EZLIC_MODEL_USER

public static final int EZLIC_MODEL_USER
Single-user license model

See Also:
Constant Field Values

EZLIC_MODEL_SERVER

public static final int EZLIC_MODEL_SERVER
Server license model

See Also:
Constant Field Values

EZLIC_TYPE_U_USER

public static final int EZLIC_TYPE_U_USER
User-locked

See Also:
Constant Field Values

EZLIC_TYPE_U_NODE

public static final int EZLIC_TYPE_U_NODE
Node-locked

See Also:
Constant Field Values

EZLIC_TYPE_U_FLOAT

public static final int EZLIC_TYPE_U_FLOAT
Floating

See Also:
Constant Field Values

EZLIC_TYPE_SVR_CONC

public static final int EZLIC_TYPE_SVR_CONC
Concurrent user

See Also:
Constant Field Values

EZLIC_TYPE_SVR_CPU

public static final int EZLIC_TYPE_SVR_CPU
CPU count

See Also:
Constant Field Values

EZLIC_TYPE_SVR_MHZ

public static final int EZLIC_TYPE_SVR_MHZ
CPU MHZ

See Also:
Constant Field Values

EZLIC_TYPE_SVR_NMU

public static final int EZLIC_TYPE_SVR_NMU
Named-user

See Also:
Constant Field Values

EZLIC_MODE_TIME

public static final int EZLIC_MODE_TIME
Time limited

See Also:
Constant Field Values

EZLIC_MODE_METERED

public static final int EZLIC_MODE_METERED
Metered

See Also:
Constant Field Values

EZLIC_MODE_OPTIONS

public static final int EZLIC_MODE_OPTIONS
Option-enabling

See Also:
Constant Field Values

EZLIC_MODE_CUSTOM_KEY

public static final int EZLIC_MODE_CUSTOM_KEY
Custom key

See Also:
Constant Field Values

EZLIC_MODE_CUSTOM_COOKIE

public static final int EZLIC_MODE_CUSTOM_COOKIE
Custom cookie

See Also:
Constant Field Values

EZLIC_DEFAULT_TIME_TOLERANCE_HRS

public static final int EZLIC_DEFAULT_TIME_TOLERANCE_HRS
Default time tolerance in hours

See Also:
Constant Field Values
Constructor Detail

EzLicenseInfo

public EzLicenseInfo()
Method Detail

getEzlmVersionInfo

public static java.lang.String[] getEzlmVersionInfo()
Get version information string

Returns:
2-element vector of major and minor version strings

setTimeToleranceHrs

public static void setTimeToleranceHrs(int tolerance)
Set the time tolerance for system clock checking.

Parameters:
tolerance - # of hrs of clock drift to tolerate. -1 implies system clock checking is nullified, and any discrepancy is allowed.

getTimeToleranceHrs

public static int getTimeToleranceHrs()
Get the current setting for the time tolerance.

Returns:
current value for time tolerance.

getLicenseKey

public java.lang.String getLicenseKey()
getLicenseKey: returns license key

Returns:
license key string

getLicenseModelCode

public int getLicenseModelCode()
getLicenseModelCode: returns license model code

Returns:
license model code for the license key

getLicenseTypeCode

public int getLicenseTypeCode()
getLicenseTypeCode: returns license type code

Returns:
license type code for the license key

getLicenseModeBitmap

public int getLicenseModeBitmap()
getLicenseModeBitmap: returns license mode bitmap, bits set per EZLIC_MODE_*.

Returns:
bitmap of license modes for the license key

getCustomKey

public java.lang.String getCustomKey()
getCustomKey: returns custom key contained in the license key, null if none

Returns:
custom key for the license key

getCustomCookie

public java.lang.String getCustomCookie()
getCustomCookie: returns custom cookie contained in the license key, null if none

Returns:
custom cookie for the license key

getUserHostNetName

public java.lang.String getUserHostNetName()
getUserOrHostName: returns user / host name, null if none

Returns:
user / host name for the license key

getExpirationDate

public java.util.Date getExpirationDate()
getExpirationDate: returns expiration date, null if none

Returns:
license model code for the license key

getExpirationTs

public long getExpirationTs()
getExpirationTs: returns expiration timestamp, 0 if none.

Returns:
expiration timestamp

getOptions

public java.lang.String getOptions()
getOptions: returns options string, null if none

Returns:
option string for the license key

getEnforce

public boolean getEnforce()
getEnforce: returns whether user / host name check is enforced

Returns:
whether enforced

getQuotaValue

public long getQuotaValue()
getQuotaValue: returns quota limit value, -1 if no quota limit.

Returns:
quota limit for the license key

getUsageValue

public long getUsageValue()
getUsageValue: returns usage limit value (cpu / CPU MHZ etc.) for the license key, -1 if no limit.

Returns:
usage limit for the license key

getWarningsBitmap

public int getWarningsBitmap()
getWarningsBitmap: returns warning bitmap for license key

Returns:
warning bitmap

getKeyVersion

public int getKeyVersion()
getKeyVersion: returns 2-digit key version. A value of -1 signifies a legacy value from keys generated w/o version stamps. A value == EZLIC_KEY_VSN signifies a current version. The run time library is guaranteed to work with key versions <= EZLIC_KEY_VSN and > EZLIC_KEY_VSN - 20.

Returns:
2-digit key version number, first digit being major version. Example of return value: 20 for 2.0.

getAppPwd

public java.lang.String getAppPwd()
FOR INTERNAL USE ONLY


getChainedKeyId

public java.lang.String getChainedKeyId()
getChainedKeyId: returns chained key id, null if none. Only used by Orion network license server.

Returns:
unique id of key to which this key is chained.

setLicenseKey

public void setLicenseKey(java.lang.String licenseKey)
setLicenseKey: sets license key N/A during run time license key check

Parameters:
licenseKey - the license key

setLicenseModelCode

public void setLicenseModelCode(int licenseModelCode)
setLicenseModelCode: sets license model code N/A during run time license key check

Parameters:
licenseModelCode - license model code for the license key

setLicenseTypeCode

public void setLicenseTypeCode(int licenseTypeCode)
setLicenseTypeCode: sets license type code N/A during run time license key check

Parameters:
licenseTypeCode - license type code for the license key

setLicenseModeBitmap

public void setLicenseModeBitmap(int licenseModeBitmap)
setLicenseModeBitmap: sets license mode bitmap N/A during run time license key check

Parameters:
licenseModeBitmap - license mode bitmap for the license key

setCustomKey

public void setCustomKey(java.lang.String customKey)
setCustomKey: sets custom key value N/A during run time license key check

Parameters:
customKey - custom key for the license key

setCustomCookie

public void setCustomCookie(java.lang.String customCookie)
setCustomCookie: sets custom cookie value N/A during run time license key check

Parameters:
customCookie - custom cookie for the license key

setUserHostNetName

public void setUserHostNetName(java.lang.String userHostNetName)
setUserHostNetName: sets user / host / network name according to context N/A during run time license key check

Parameters:
userHostNetName - user / host / network name

setExpirationDate

public void setExpirationDate(java.util.Date expirationDate)
setExpirationDate: sets license expiration date N/A during run time license key check

Parameters:
expirationDate - license key expiration date

setOptions

public void setOptions(java.lang.String options)
setOptions: sets options string N/A during run time license key check

Parameters:
options - String representing options

setEnforce

public void setEnforce(boolean enforce)
setEnforce: sets user / host enforcement policy N/A during run time license key check

Parameters:
enforce - user / host enforcement policy

setQuotaValue

public void setQuotaValue(long quotaValue)
setQuotaValue: sets usage quota value N/A during run time license key check

Parameters:
quotaValue - value for usage quota

setUsageValue

public void setUsageValue(long usageValue)
setUsageValue: sets value for usage limit N/A during run time license key check

Parameters:
usageValue - usage limit value.

setWarningsBitmap

public void setWarningsBitmap(int warningsBitmap)
setWarningsBitmap: sets warning bitmap N/A during run time license key check

Parameters:
warningsBitmap - warning bitmap

setKeyVersion

public void setKeyVersion(int keyVsn)
setKeyVersion: sets key version value N/A during run time license key check

Parameters:
keyVsn - value for key version

createKeyCookieSeed

public static java.lang.String createKeyCookieSeed(java.lang.String productName)
createKeyCookieSeed: Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application. A system clock check is not performed, and no application state is managed in the encrypted cookie. An application invokes this method the first time it is executed after receiving a license key (typically during product installation), and saves the returned key cookie in persistent store. Subsequently, the value in the persistent store is supplied to the "checkLicenseKeySecure" API call, which upon a successful license key check returns an updated key cookie that the application replaces the previous value with. The cookie mechanism automatically manages quota consumption and optionally arbitrary application-managed state. The combination of the "createKeyCookieSeed" and "checkLicenseKeySecure" API's enables an application to be both spoof-proof and protect itself from hackers turning back the system clock to re-run quota- and time-limited copies of programs. IMPORTANT COMPATIBILITY NOTE: what used to be the "user host name" is now a "product name". This is syntactictally compatible with previous versions of EasyLicenser but does require that you provide the product name exactly as it was specified at the time of key generation.

Parameters:
productName - the product name corresponding to the key
Returns:
generated key cookie string.

createKeyCookieSeed

public static java.lang.String createKeyCookieSeed(java.lang.String productName,
                                                   java.lang.String appPassword,
                                                   java.lang.String appState,
                                                   boolean check)
                                            throws EzLicExceptionBase
createKeyCookieSeed: Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application based on an application password, and specifying an application-managed state to be maintained securely in the key cookie. Encode the cookie using the specified secret password that also matches the password passed into the license key check API calls. Optionally, initialize the cookie with application state information. An application invokes this method the first time it is executed after receiving a license key (typically during product installation), and saves the returned key cookie in persistent store. Subsequently, the value in the persistent store is supplied to the "checkLicenseKeySecure" API call, which upon a successful license key check returns an updated key cookie that the application replaces the previous value with. The combination of the "createKeyCookieSeed" and "checkLicenseKey" API's enables an application to be both spoof-proof and protect itself from hackers turning back the system clock to re-run time-limited copies of programs.

Parameters:
productName - the product name corresponding to the key
appPassword - application password - same as what's passed into the license key check API call.
appState - arbitrary stringified initial application state
check - check whether the system clock or its checking mechanism has been tampered with
Returns:
generated key cookie string.
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

createKeyCookieSeed

public static java.lang.String createKeyCookieSeed(java.lang.String productName,
                                                   java.lang.String appPassword,
                                                   java.lang.String appState,
                                                   boolean check,
                                                   java.lang.String hfileDirectory)
                                            throws EzLicExceptionBase
createKeyCookieSeed (controlled-hidden-file-location version): Create a key cookie seed that is the first key cookie passed into the "checkLicenseKeySecure" API call by an application based on an application password, and specifying an application-managed state to be maintained securely in the key cookie. Encode the cookie using the specified secret password that also matches the password passed into the license key check API calls. Optionally, initialize the cookie with application state information. An application invokes this method the first time it is executed after receiving a license key (typically during product installation), and saves the returned key cookie in persistent store. Subsequently, the value in the persistent store is supplied to the "checkLicenseKeySecure" API call, which upon a successful license key check returns an updated key cookie that the application replaces the previous value with. The combination of the "createKeyCookieSeed" and "checkLicenseKey" API's enables an application to be both spoof-proof and protect itself from hackers turning back the system clock to re-run time-limited copies of programs.

Parameters:
productName - the product name corresponding to the key
appPassword - application password - same as what's passed into the license key check API call.
appState - arbitrary stringified initial application state
check - check whether the system clock or its checking mechanism has been tampered with
hfileDirectory - directory in which the hidden file is to be located.
Returns:
generated key cookie string.
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

cleanupKeyCookie

public static boolean cleanupKeyCookie(java.lang.String keyCookie,
                                       java.lang.String productName,
                                       java.lang.String appPassword)
                                throws EzLicExceptionBase
Clean up persistent structures associated with key cookie. Typically invoked at uninstallation time.

Parameters:
keyCookie - last-valid key cookie
productName - product name
appPassword - application password, same as that specified to checkLicenseKeySecure() and createKeyCookieSeed().
Returns:
true if cleanup succeeded, false if no cleanup was required.
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

cleanupKeyCookie

public static boolean cleanupKeyCookie(java.lang.String keyCookie,
                                       java.lang.String productName,
                                       java.lang.String appPassword,
                                       java.lang.String hfileDirectory,
                                       boolean check)
                                throws EzLicExceptionBase
(hidden-file-timestamp-check-control version): Clean up persistent structures associated with key cookie. Typically invoked at uninstallation time.

Parameters:
keyCookie - last-valid key cookie
productName - product name
appPassword - application password, same as that specified to checkLicenseKeySecure() and createKeyCookieSeed().
hfileDirectory - directory where hidden file is supposed to be
check - whether to do a timestamp check
Returns:
true if cleanup succeeded, false if no cleanup was required.
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

getKeyCookieAppState

public static java.lang.String getKeyCookieAppState(java.lang.String keyCookie,
                                                    java.lang.String productName,
                                                    java.lang.String appPassword)
                                             throws EzLicExceptionBase
Get application state stored in key cookie. Invoked as needed during application execution, to retrieve and process its extended licensing state.

Parameters:
keyCookie - last-valid key cookie
productName - product name
appPassword - application password, same as that specified to checkLicenseKeySecure() and createKeyCookieSeed().
Returns:
application state - null if no application state was stored
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

getKeyCookieQuotaToDate

public static long getKeyCookieQuotaToDate(java.lang.String keyCookie,
                                           java.lang.String productName,
                                           java.lang.String appPassword)
                                    throws EzLicExceptionBase
Get quota-to-date stored in key cookie. Invoked as needed during application execution, to retrieve and process its metered quota consumption.

Parameters:
keyCookie - last-valid key cookie
productName - product name
appPassword - application password, same as that specified to checkLicenseKeySecure() and createKeyCookieSeed().
Returns:
quota-to-date value, 0 if not managed by key cookie or if not a metered license
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

getKeyCookieTs

public static long getKeyCookieTs(java.lang.String keyCookie,
                                  java.lang.String productName,
                                  java.lang.String appPassword)
                           throws EzLicExceptionBase
Get last-update timestamp stored in key cookie. Invoked as needed during application execution, to retrieve and process last-use timestamp. Timestamp is expressed in milliseconds since the epoch.

Parameters:
keyCookie - last-valid key cookie
productName - product name
appPassword - application password, same as that specified to checkLicenseKeySecure() and createKeyCookieSeed().
Returns:
last-use timestamp saved inside cookie.
Throws:
EzLicExceptionBase - or a subclass if an error condition is encountered.

checkSingleUserLicenseKeyBasic

public int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey,
                                          int daysLeftThreshold,
                                          long quotaUsageToDate,
                                          long quotaThreshold,
                                          int daysGracePeriod,
                                          long quotaGrace,
                                          java.lang.String userHostName)
                                   throws EzLicExceptionBase
(Basic single-user license check w/ no access-control check, for backward compatibility:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of used quota to date expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
userHostName - user or host name, for a user / node locked license. This may be null if the key was generated with OS enforcement.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkSingleUserLicenseKeyBasic

public int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey,
                                          int daysLeftThreshold,
                                          long quotaUsageToDate,
                                          long quotaThreshold,
                                          int daysGracePeriod,
                                          long quotaGrace,
                                          java.lang.String userHostName,
                                          java.lang.String product,
                                          java.lang.String appPassword)
                                   throws EzLicExceptionBase
(Basic single-user license check w/ access-control check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of used quota to date expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
userHostName - user or host name, for a user / node locked license. This may be null if the key was generated with OS enforcement.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkSingleUserLicenseKeyBasic

public int checkSingleUserLicenseKeyBasic(java.lang.String licenseKey,
                                          int daysLeftThreshold,
                                          long quotaUsageToDate,
                                          long quotaThreshold,
                                          int daysGracePeriod,
                                          long quotaGrace,
                                          java.lang.String userHostName,
                                          java.lang.String product,
                                          java.lang.String appPassword,
                                          boolean strictPwdCheck)
                                   throws EzLicExceptionBase
(Basic single-user license check w/ access-control check and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of used quota to date expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
userHostName - user or host name, for a user / node locked license. This may be null if the key was generated with OS enforcement.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkMultiUserLicenseKeyBasic

public int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey,
                                         int daysLeftThreshold,
                                         long quotaUsageToDate,
                                         long quotaThreshold,
                                         int daysGracePeriod,
                                         long quotaGrace,
                                         java.lang.String hostNetName,
                                         long currUsageValue)
                                  throws EzLicExceptionBase
(Basic multi-user license check w/ no access control check, for backward compatibility:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
hostNetName - (floating) network or (server) host name for floating / server license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkMultiUserLicenseKeyBasic

public int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey,
                                         int daysLeftThreshold,
                                         long quotaUsageToDate,
                                         long quotaThreshold,
                                         int daysGracePeriod,
                                         long quotaGrace,
                                         java.lang.String hostNetName,
                                         long currUsageValue,
                                         java.lang.String product,
                                         java.lang.String appPassword)
                                  throws EzLicExceptionBase
(Basic multi-user license check w/ access control check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
hostNetName - (floating) network or (server) host name for floating / server license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkMultiUserLicenseKeyBasic

public int checkMultiUserLicenseKeyBasic(java.lang.String licenseKey,
                                         int daysLeftThreshold,
                                         long quotaUsageToDate,
                                         long quotaThreshold,
                                         int daysGracePeriod,
                                         long quotaGrace,
                                         java.lang.String hostNetName,
                                         long currUsageValue,
                                         java.lang.String product,
                                         java.lang.String appPassword,
                                         boolean strictPwdCheck)
                                  throws EzLicExceptionBase
(Basic multi-user license check w/ access control check and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
hostNetName - (floating) network or (server) host name for floating / server license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKey

public int checkLicenseKey(java.lang.String licenseKey,
                           EzLicCustomLicenseInterface customKeyHandler,
                           java.lang.Object customKeyContext,
                           int daysLeftThreshold,
                           long quotaUsageToDate,
                           long quotaThreshold,
                           int daysGracePeriod,
                           long quotaGrace,
                           java.lang.String userHostNet,
                           long currUsageValue)
                    throws EzLicExceptionBase
(Full version, no application password:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license. This may be null if the key was generated with OS enforcement.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKey

public int checkLicenseKey(java.lang.String licenseKey,
                           EzLicCustomLicenseInterface customKeyHandler,
                           java.lang.Object customKeyContext,
                           int daysLeftThreshold,
                           long quotaUsageToDate,
                           long quotaThreshold,
                           int daysGracePeriod,
                           long quotaGrace,
                           java.lang.String userHostNet,
                           long currUsageValue,
                           java.lang.String product,
                           java.lang.String appPassword)
                    throws EzLicExceptionBase
(Full version with application password check for access-controlled keys, but no hidden-timestamp-file control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation, or the application password doesn't match what's in the key. There is an application password mismatch if the key contains an application password and either no password is passed as a parameter or the corresponding public key doesn't match the supplied application password public key. It is not an error if an application password is specified but the key was not generated with an application password. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license. If OS enforcement is enabled for the key and the app knows this, the parameter can be specified to be null - but if it is specified, it has to match what's in the key.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKey

public int checkLicenseKey(java.lang.String licenseKey,
                           EzLicCustomLicenseInterface customKeyHandler,
                           java.lang.Object customKeyContext,
                           int daysLeftThreshold,
                           long quotaUsageToDate,
                           long quotaThreshold,
                           int daysGracePeriod,
                           long quotaGrace,
                           java.lang.String userHostNet,
                           long currUsageValue,
                           java.lang.String product,
                           java.lang.String appPassword,
                           boolean strictPwdCheck)
                    throws EzLicExceptionBase
(Full version with application password check for access-controlled keys, but no hidden-timestamp-file control and strict password check:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation, or the application password doesn't match what's in the key. There is an application password mismatch if the key contains an application password and either no password is passed as a parameter or the corresponding public key doesn't match the supplied application password public key. It is not an error if an application password is specified but the key was not generated with an application password. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license. If OS enforcement is enabled for the key and the app knows this, the parameter can be specified to be null - but if it is specified, it has to match what's in the key.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKey

public int checkLicenseKey(java.lang.String licenseKey,
                           EzLicCustomLicenseInterface customKeyHandler,
                           java.lang.Object customKeyContext,
                           int daysLeftThreshold,
                           long quotaUsageToDate,
                           long quotaThreshold,
                           int daysGracePeriod,
                           long quotaGrace,
                           java.lang.String userHostNet,
                           long currUsageValue,
                           java.lang.String product,
                           java.lang.String appPassword,
                           java.lang.String hfileDirectory,
                           boolean alwaysCheckTimestamp)
                    throws EzLicExceptionBase
(Full version with application password check for access-controlled keys, with hidden-file-timestamp-check control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation, or the application password doesn't match what's in the key. There is an application password mismatch if the key contains an application password and either no password is passed as a parameter or the corresponding public key doesn't match the supplied application password public key. It is not an error if an application password is specified but the key was not generated with an application password. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license. If OS enforcement is enabled for the key and the app knows this, the parameter can be specified to be null - but if it is specified, it has to match what's in the key.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
hfileDirectory - preferred hidden-file directory. If null, and if hidden-file checking is enabled, the Java "user.home" property is used.
alwaysCheckTimestamp - whether to unconditionally check the hidden file's timestamp against the system clock.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKey

public int checkLicenseKey(java.lang.String licenseKey,
                           EzLicCustomLicenseInterface customKeyHandler,
                           java.lang.Object customKeyContext,
                           int daysLeftThreshold,
                           long quotaUsageToDate,
                           long quotaThreshold,
                           int daysGracePeriod,
                           long quotaGrace,
                           java.lang.String userHostNet,
                           long currUsageValue,
                           java.lang.String product,
                           java.lang.String appPassword,
                           java.lang.String hfileDirectory,
                           boolean alwaysCheckTimestamp,
                           boolean strictPwdCheck)
                    throws EzLicExceptionBase
(Full version with application password check for access-controlled keys, with hidden-file-timestamp-check control:) Check the specified license key against the provided info for key violations, and sets the class context based on the key. Throws an appropriate exception if the key is invalid or there is a license violation, or the application password doesn't match what's in the key. There is an application password mismatch if the key contains an application password and either no password is passed as a parameter or the corresponding public key doesn't match the supplied application password public key. It is not an error if an application password is specified but the key was not generated with an application password if the value for strictPwdCheck parameter is false. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license. If OS enforcement is enabled for the key and the app knows this, the parameter can be specified to be null - but if it is specified, it has to match what's in the key.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
hfileDirectory - preferred hidden-file directory. If null, and if hidden-file checking is enabled, the Java "user.home" property is used.
alwaysCheckTimestamp - whether to unconditionally check the hidden file's timestamp against the system clock.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
bitmap of warning codes, 0 if none. Warning codes are per those defined in EzLicExceptionBase, possibly augmented by ISV's custom warning codes for use in conjunction with custom key handler.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license.
See Also:
EzLicExceptionBase

checkLicenseKeySecure

public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey,
                                              java.lang.String keyCookie,
                                              EzLicExceptionBase customException,
                                              EzLicCustomLicenseInterface customKeyHandler,
                                              java.lang.Object customKeyContext,
                                              int daysLeftThreshold,
                                              long quotaUsageToDate,
                                              long quotaThreshold,
                                              int daysGracePeriod,
                                              long quotaGrace,
                                              java.lang.String userHostNet,
                                              long currUsageValue)
                                       throws EzLicExceptionBase
(Basic secure version:) Check the specified license key against the provided info for key violations, and set the class context based on the key. Throw an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
keyCookie - the key cookie that was returned from the previous call to this method for this key, or from the createKeyCookieSeed() method if none.
customException - a "success" exception class custom-defined by the application to be a subclass of EzLicExceptionBase. If the caller catches this exception, it signifies success, in which case the handler's "getMessage()" method returns the new cookie, and its "getMessageCode()" method returns the warning bitmap. If a null handler is specified, control returns normally from this call with the new cookie as the return value. The reason for specifying a custom exception handler is to help foil attempts at hacking the application code by manipulating binary code that corresponds to the check for the return value of the license key check call.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of remaining quota expressed in license units, if this is expected to be a metered license.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
Returns:
new key cookie value, if the license key check is successful and a null custom exception handler is provided.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license, and also in the event of a successful license key when a non-null custom exception class is provided.
See Also:
EzLicExceptionBase

checkLicenseKeySecure

public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey,
                                              java.lang.String keyCookie,
                                              EzLicExceptionBase customException,
                                              EzLicCustomLicenseInterface customKeyHandler,
                                              java.lang.Object customKeyContext,
                                              int daysLeftThreshold,
                                              long quotaUsageToDate,
                                              long quotaThreshold,
                                              int daysGracePeriod,
                                              long quotaGrace,
                                              java.lang.String userHostNet,
                                              long currUsageValue,
                                              java.lang.String product,
                                              java.lang.String appPassword,
                                              java.lang.String appState)
                                       throws EzLicExceptionBase
(Full secure version w/o hidden-file-timestamp check control:) Check the specified license key against the provided info for key violations, and set the class context based on the key. This version matches product name and application password, and also accepts an application context for embedding into the key cookie. Throw an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
keyCookie - the key cookie that was returned from the previous call to this method for this key, or from the createKeyCookieSeed() method if none.
customException - a "success" exception class custom-defined by the application to be a subclass of EzLicExceptionBase. If the caller catches this exception, it signifies success, in which case the handler's "getMessage()" method returns the new cookie, and its "getMessageCode()" method returns the warning bitmap. If a null handler is specified, control returns normally from this call with the new cookie as the return value. The reason for specifying a custom exception handler is to help foil attempts at hacking the application code by manipulating binary code that corresponds to the check for the return value of the license key check call.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of consumed quota, if this is expected to be a metered license and the value is positive. If the value is negative, it represents the incremental quota consumption by which to reduce the available balance that is stored in the key cookie.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
appState - stringified generic license related application state to embed in the key cookie for later retrieval.
Returns:
new key cookie value, if the license key check is successful and a null custom exception handler is provided.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license, and also in the event of a successful license key when a non-null custom exception class is provided.
See Also:
EzLicExceptionBase

checkLicenseKeySecure

public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey,
                                              java.lang.String keyCookie,
                                              EzLicExceptionBase customException,
                                              EzLicCustomLicenseInterface customKeyHandler,
                                              java.lang.Object customKeyContext,
                                              int daysLeftThreshold,
                                              long quotaUsageToDate,
                                              long quotaThreshold,
                                              int daysGracePeriod,
                                              long quotaGrace,
                                              java.lang.String userHostNet,
                                              long currUsageValue,
                                              java.lang.String product,
                                              java.lang.String appPassword,
                                              java.lang.String appState,
                                              boolean strictPwdCheck)
                                       throws EzLicExceptionBase
(Full secure version w/o hidden-file-timestamp check control with strict password check:) Check the specified license key against the provided info for key violations, and set the class context based on the key. This version matches product name and application password, and also accepts an application context for embedding into the key cookie. Throw an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
keyCookie - the key cookie that was returned from the previous call to this method for this key, or from the createKeyCookieSeed() method if none.
customException - a "success" exception class custom-defined by the application to be a subclass of EzLicExceptionBase. If the caller catches this exception, it signifies success, in which case the handler's "getMessage()" method returns the new cookie, and its "getMessageCode()" method returns the warning bitmap. If a null handler is specified, control returns normally from this call with the new cookie as the return value. The reason for specifying a custom exception handler is to help foil attempts at hacking the application code by manipulating binary code that corresponds to the check for the return value of the license key check call.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of consumed quota, if this is expected to be a metered license and the value is positive. If the value is negative, it represents the incremental quota consumption by which to reduce the available balance that is stored in the key cookie.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
appState - stringified generic license related application state to embed in the key cookie for later retrieval.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
new key cookie value, if the license key check is successful and a null custom exception handler is provided.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license, and also in the event of a successful license key when a non-null custom exception class is provided.
See Also:
EzLicExceptionBase

checkLicenseKeySecure

public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey,
                                              java.lang.String keyCookie,
                                              EzLicExceptionBase customException,
                                              EzLicCustomLicenseInterface customKeyHandler,
                                              java.lang.Object customKeyContext,
                                              int daysLeftThreshold,
                                              long quotaUsageToDate,
                                              long quotaThreshold,
                                              int daysGracePeriod,
                                              long quotaGrace,
                                              java.lang.String userHostNet,
                                              long currUsageValue,
                                              java.lang.String product,
                                              java.lang.String appPassword,
                                              java.lang.String appState,
                                              java.lang.String hfileDirectory,
                                              boolean alwaysCheckTimestamp)
                                       throws EzLicExceptionBase
(Full secure version with hidden-file-timestamp check control:) Check the specified license key against the provided info for key violations, and set the class context based on the key. This version matches product name and application password, and also accepts an application context for embedding into the key cookie. Throw an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
keyCookie - the key cookie that was returned from the previous call to this method for this key, or from the createKeyCookieSeed() method if none.
customException - a "success" exception class custom-defined by the application to be a subclass of EzLicExceptionBase. If the caller catches this exception, it signifies success, in which case the handler's "getMessage()" method returns the new cookie, and its "getMessageCode()" method returns the warning bitmap. If a null handler is specified, control returns normally from this call with the new cookie as the return value. The reason for specifying a custom exception handler is to help foil attempts at hacking the application code by manipulating binary code that corresponds to the check for the return value of the license key check call.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of consumed quota, if this is expected to be a metered license and the value is positive. If the value is negative, it represents the incremental quota consumption by which to reduce the available balance that is stored in the key cookie.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
appState - stringified generic license related application state to embed in the key cookie for later retrieval.
hfileDirectory - preferred hidden-file directory. If null, and if hidden-file checking is enabled, the Java "user.home" property is used.
alwaysCheckTimestamp - whether to unconditionally check the hidden file's timestamp against the system clock.
Returns:
new key cookie value, if the license key check is successful and a null custom exception handler is provided.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license, and also in the event of a successful license key when a non-null custom exception class is provided.
See Also:
EzLicExceptionBase

checkLicenseKeySecure

public java.lang.String checkLicenseKeySecure(java.lang.String licenseKey,
                                              java.lang.String keyCookie,
                                              EzLicExceptionBase customException,
                                              EzLicCustomLicenseInterface customKeyHandler,
                                              java.lang.Object customKeyContext,
                                              int daysLeftThreshold,
                                              long quotaUsageToDate,
                                              long quotaThreshold,
                                              int daysGracePeriod,
                                              long quotaGrace,
                                              java.lang.String userHostNet,
                                              long currUsageValue,
                                              java.lang.String product,
                                              java.lang.String appPassword,
                                              java.lang.String appState,
                                              java.lang.String hfileDirectory,
                                              boolean alwaysCheckTimestamp,
                                              boolean strictPwdCheck)
                                       throws EzLicExceptionBase
(Full secure version with hidden-file-timestamp check control and strict passpowd check:) Check the specified license key against the provided info for key violations, and set the class context based on the key. This version matches product name and application password, and also accepts an application context for embedding into the key cookie. Throw an appropriate exception if the key is invalid or there is a license violation. Returns warning code bitmap to indicate almost-out-of-quota, expiring, etc. conditions that are not yet errors.

Parameters:
licenseKey - license key.
keyCookie - the key cookie that was returned from the previous call to this method for this key, or from the createKeyCookieSeed() method if none.
customException - a "success" exception class custom-defined by the application to be a subclass of EzLicExceptionBase. If the caller catches this exception, it signifies success, in which case the handler's "getMessage()" method returns the new cookie, and its "getMessageCode()" method returns the warning bitmap. If a null handler is specified, control returns normally from this call with the new cookie as the return value. The reason for specifying a custom exception handler is to help foil attempts at hacking the application code by manipulating binary code that corresponds to the check for the return value of the license key check call.
customKeyHandler - optional custom license key handler for processing custom key in an ISV specific manner. Null if not specified.
customKeyContext - optional run time context for custom license key handler above.
daysLeftThreshold - threshold for # of days remaining in a time-limited license in order to trigger an "about-to-expire" warning.
quotaUsageToDate - amount of consumed quota, if this is expected to be a metered license and the value is positive. If the value is negative, it represents the incremental quota consumption by which to reduce the available balance that is stored in the key cookie.
quotaThreshold - threshold for # of license units remaining in a metered license in order to trigger an "about-to-expire" warning.
daysGracePeriod - grace period for time limited license - if today is past expiration date by less than this many days, set a warning instead of throwing an exception.
quotaGrace - grace quota - if quota is exceeded by less than this amount, set a warning instead of throwing an exception.
userHostNet - user or host or network name, for a user / node locked / floating license.
currUsageValue - current usage value for floating / concurrent-user / cpu / mhz usage models.
product - product name. Must match what's in the key if specified. If not specified, app password can't be specified either.
appPassword - application password's public key. One must be supplied if the key contains a password.
appState - stringified generic license related application state to embed in the key cookie for later retrieval.
hfileDirectory - preferred hidden-file directory. If null, and if hidden-file checking is enabled, the Java "user.home" property is used.
alwaysCheckTimestamp - whether to unconditionally check the hidden file's timestamp against the system clock.
strictPwdCheck - Whether the application password provided should be matched strictly against the application password used at the time of key generation.If product was not password protected, then application password can't be provided if strictPwdCheck is true.Else, it is not an error if an application password is specified but the key was not generated with an application password.
Returns:
new key cookie value, if the license key check is successful and a null custom exception handler is provided.
Throws:
EzLicExceptionBase - in the event of a malformed key or invalid license, and also in the event of a successful license key when a non-null custom exception class is provided.
See Also:
EzLicExceptionBase