Encrypting the License Codes

For enhanced security, you can add an additional layer of encryption while generating licenses.

Make sure that post-modification, your encrypted short-numeric licenses consist of numbers only. Else, the license generation will fail.

Executables to Rebuild

>In the case of standalone licensing (application linked to the standalone library or the integrated library), the client application needs to be rebuild.

>In the case of network licensing, the License Manager executable needs to be rebuild.

>The command-line license code generator (lscgen)

>The command-line license code decoder (lsdecode)

>For Windows, a plug-in for wlscgen.exe (wlscgen.dll)

Description

Provides the vendor-specified an extra layer of encryption and decryption for the license codes.

Encryption Function Prototype

int VLSencryptLicense 
(
   char *decrypted_mesg,         
   char *encrypted_mesg,         
   int   size
                  );

Returns

>Returns 0 (zero) on success.

>Returns non-zero on failure.

Parameter

Description

decrypted_mesg

An IN parameter.

The original license code.

encrypted_mesg

An OUT parameter.

The encrypted license code.

size

An IN parameter.

The size of the decrypted_mesg buffer.

Note that the encrypted licenses code must not contain following characters:

Character

Hex Value

Description

\t

0x09

The tab character

\n

0x0A

The new-line character

#

0x23

The pound sign or number sign or hash mark

(

0x28

The opening round parentheses

)

0x29

The closing round parentheses

,

0x2C

The comma mark

-

0x2D

The hyphen or dash or minus sign

Decryption Function Prototype

int VLSdecryptLicense
(
	char *encrypted_mesg,
	char *decrypted_mesg,
	int   size 
	);

Returns

>Returns 0 (zero) on success.

>Returns non-zero on failure.

Parameter

Description

 encrypted_mesg

An IN parameter.

The encrypted license code.

decrypted_mesg

An OUT parameter.

The original license code.

size

An IN parameter.

The size of the encrypted_mesg buffer.

Steps to Perform

1.Create the VLSencryptLicense function.

2.Create the VLSdecryptLicense function.

3.Update the ENCRYPT_LIC_OBJS variable in the custom32.mak file.

4.Update the DECRYPT_LIC_OBJS variable in the custom32.mak file.

5.Follow the build procedure specified in How to Use the custom32.mak File?.

Code Snippets

The VLSencryptLicense Function

int VLSencryptLicense
(
  char *decrypted_mesg, /* IN */
  char *encrypted_mesg, /* OUT */
  int size /* IN */
)
{
  if (decrypted_mesg == NULL)
{
  return 1; /* non-zero to mark failure */
}
  if (encrypted_mesg == NULL)
{
  return 1; /* non-zero to mark failure */
}
  if (size == 0)
{
  return 1; /* non-zero to mark failure */
}
  /* TODO: add the encryption code here */
  return 0; /* 
  successful encryption */
}

The VLSdecryptLicense Function

int VLSdecryptLicense
(
  char *encrypted_mesg, /* IN */
  char *decrypted_mesg, /* OUT */
  int size /* IN */
)
{
  if (encrypted_mesg == NULL)
{
  return 1; /* non-zero to mark failure */
}
  if (decrypted_mesg == NULL)
{
  return 1; /* non-zero to mark failure */
}
  if (size == 0)
{
  return 1; /* non-zero to mark failure */
  /* TODO: add the decryption code here */
  return 0; /* successful decryption */
}
}