cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RangaPro
Flexera beginner

Validate license file without installing it

Hi,

We are using File Based Licensing, and currently I'm looking for any API which allows me to check if the license file is valid without actually installing it via the Flexera API.

 

Context:

We have a need to know the individual license file details (expiry, count etc) in the cases where uses has access to multiple licenses for the same feature but since since flexera doesn't expose this information, we planned to read it manually from the license file.

https://community.flexera.com/t5/FlexNet-Publisher-Forum/Multiple-overlapping-licenses-for-the-same-...

 

Thanks!

0 Kudos
5 Replies
Highlighted
raffie
Active participant

Re: Validate license file without installing it

If you just want to read the count, expiry, etc, then you can use lc_get_config/lc_next_conf to read the lines and get that data out of the CONIFG structure.    These are just text parsers so they don't ensure that everything is valid.  You can use lc_test_conf, which I think validates the data since it requires a test checkout first (but I've never used this).

 

0 Kudos
Highlighted
Flexera aparashar1
Flexera

Re: Validate license file without installing it

@RangaPro , i am afraid that as of nw, there isn't any way through which we can query the details of a license file - unless and until it is being served (/installed).

However, as of now our engineering team is working on a "license validator utility", which does exactly what you are looking for. The work is in progress and it may not be ready till end of the quarter.

Kindly do let me know your Account details(as i can only see a gmail ID with your user account), so that i can ensure that once the utility is GA ready, it gets communicated to you.

(Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".)
0 Kudos
Highlighted
RangaPro
Flexera beginner

Re: Validate license file without installing it

@raffie Thank you Raffie. I will try it out!

 

@aparashar1 I unfortunately don't have the account details as I am just using the company wide floating license. I will check out later for sure for that tool.

0 Kudos
Highlighted
RangaPro
Flexera beginner

Re: Validate license file without installing it

@aparashar1 @raffie 

 

I tried with the lc_check_key example from Flexera sample, and i am able to fetch the license information. Only problem seems to be that the api is not giving correct response for valid/invalid license files (e.g with tampered dates or signatures). For e,g in case of valid files too , I am getting a bad param (-42) error.

I am using the below code :

 

static void get_lic_details(lm_job) LM_HANDLE *lm_job;
{
  char **featlist;
  CONFIG *conf;
  char *err;
  
	lc_log(lm_job, "get_lic_details(lm_job)\n");

	for (featlist = lc_feat_list(lm_job, 0, 0); featlist && *featlist;	featlist++)
	{
	   CONFIG *pos;

		for (pos = 0, conf = lc_next_conf(lm_job, *featlist, &pos);
				conf;
				conf = lc_next_conf(lm_job, *featlist, &pos))
		{
			char respCodeStr[10], licCount[10], licString[1024];
			int respCode = 1;

			strcpy(licString,"");
			strcat(licString,"Feature - ");
			strcat(licString,conf->feature);
			strcat(licString," - Expiry Date - ");
			strcat(licString,conf->date);
			strcat(licString," - Lic Count - ");
			itoa(conf->users,licCount,10);
			strcat(licString,licCount);
						
			strcat(licString," - IsValidLicense - ");
			
			respCode = lc_check_key(lm_job, conf, &code);
			if (respCode != 0)
			{
				strcat(licString," No - ");
				strcat(licString, lc_errstring(lm_job));
			}
			else
			{
				strcat(licString," Yes - ");				
			}		
			
			strcat(licString,itoa(respCode,respCodeStr,10));
			
			strcat(licString,"\n");
			lc_log(lm_job, licString);			
		}
	}
	
	lc_log(lm_job, "\n End check_file(lm_job)\n");
}

 

Any help would be great :)

 

Thanks!

0 Kudos
Highlighted
raffie
Active participant

Re: Validate license file without installing it

I've never used lc_check_key, but maybe it doesn't work in an application.  The doc has this line:

"This function is optional and only for use during license installation; it is not used in an application that also calls lc_checkout."

Since you are using lc_log, I assume you are in your application and connected to the license server.  If so, then you can just do a test checkout (also mentioned in the doc for lc_check_key).

0 Kudos