Phone: 905 409-1589
Email: info@penproductions.ca
RSS LinkedIn Twitter Twitter
PEN License System
keyGenUi
What is it for?
The PEN Licensing System is a generic tool that can be used by any Max Script tool that needs to be protected. The system is easy to implement and simple for clients to use. A key generator is included that allows for tracking of generated licenses and license keys.

PEN Licensing system was developed to address the need for a quick, easy and secure way to license Max Script tools. Without a licensing system it is very easy for wares sites to provide free versions of the tools that you have worked hard to create. With this system any vendor can provide encrypted and secure licensing for scripted tools of all kinds.

Setup:
PEN Licensing System has three parts, penLicensingSystem.mse, penLicensingSystemKeyGen.mse and penLicensingSystem.mcr.

The guts of the system is the penLicensingSystem.mse file, this file will be included with your scripted tool and installed in the users plugins folder so that it is always in memory and running. It is this part of the tool that is responsible for handling the checking of licenses and managing the license files.

The Key Generator, penLicensingSystemKeyGen.mse, will not be provided to the client and only used by the vendor for creating license files. This file is stored in the scripts\penproductions folder where it is called from the macro script. Placing it else where will mean the macro script will fail to launch it.

The Key Generator is used for creating license files and tracking product name and key pairs that are being used as well as tracking the licenses that have been generated.

exampleAboutBox.png

The tool that has been developed should provide a set of tools for the end user to manage their license. At left can be seen the About rollout that is used in the MXDriver 2 modifier panel that handles the licensing and displaying of rollouts in a scripted plugin modifier.

The three buttons are all that is needed for the end user to manage their license files. How to implement these features in your tool is covered below in the Usage section of the page.
Usage:
To get started a Product Name and Product Key must be decided on. Both can be any string value but it is best to avoid escape characters and commas. Just about any other combination can be used. In the example code below the Product Name is "productName_13000" (This would be for 3Ds Max version 2011) and the Product Key is "123456789". These two values are then used to create and check the license. The Product Key needs to be protected by the vendor as this is the value that unlocks the license and allows it to work. The Product Key is used with the MAC address of the computer to determine of the license is valid or not.

There are four functions that are called to control the licensing system and all that is needed to begin protecting your work.

Code:
penLicenseSystem.getRequestCodeFile
penLicenseSystem.importLicense
penLicenseSystem.deleteLicense
penLicenseSystem.isLicenseValid                      
                        
clientInformationForm

The way the system works is the user will generate a request file. This is not the typical request code that is used but instead a file that contains information about the users system and contact information. This information can be used to track clients to ensure that future licenses are being generated for the same computer and version of Max.

The first button or option that needs to be provided to the client is a Get Request File option. To call this function use the code below. There are two parameters that need to be passed to the function. First is the Product Key value and second is the email account that you wish the request file to be sent to. The user will see a form pop up that asks for information to be entered that will be stored in the request code and then in the data base of licenses that have been issued. Call the code below from the Get Request Code button.

Get Request Code:
penLicenseSystem.getRequestCodeFile \
	key:"123456789" \
	emailAccount:"info@penproductions.ca" \
	productName:"MyProductName"
						
Once a request code has been sent and a license file generated (Covered in next section) the user will need to import the license file. What this means is the user needs to place the license file in the location that the tool will be looking for it. To make this easy on the client the "importLicense"; function can be called. There is one parameter for this function called "licFilePath", this is the path and file name of the license of where you wish the license to be placed. The best location for the license is the plugCFG folder in Max as it can be easily accessed using the "getDir #plugCfg" command.

The path and file name here are very important and it needs consideration to ensure a smooth working tool. In the example below the "licFilePath" has five parts.
First is the location that the file will be stored and that is being created using "getDir #plugCfg".
Second is the name of the computer where the license was generated from, and is generated using sysInfo.computerName. The computer name isn't necessary and is an option when creating license files how ever it can help when a client has requested licenses for many machines. If the license file for each machine had the same name it could become confusing as to which license is to be used on any given machine. Always append and "_" after the name of the computer to make it more readable as well this is done automatically when a license is generated and the Prefix License with Computer Name is used.
Third is the product name that the vendor has chosen, this name needs to be consistent with the name used when the license is generated.
Forth is the Max version and could just be hard coded into the product name but that would then require a different version of the script to be created for each Max version. Using the code "(maxVersion())[1] as sting" the tool will automatically append the current Max version to the end of the file name.
Fifth is the file extension and must remain as ".lic".

Import License:
penLicenseSystem.importLicense \
  licFilePath:((getDir #plugCfg)+"\\+sysInfo.computerName+"_"+"productName_"+(maxVersion())[1] as string+".lic")

--Result of licFilePath
"C:\Program Files\Autodesk\3ds Max 2011\plugcfg\PEN_productName_13000.lic"
						
Using the deleteLicense function is exactly the same as using the importLicense function. It isn't necessary to supply the client with the ability to delete the license but it might help if there is ever a problem and the client needs to remove it. The function will automatically supply the user with a warning message asking if they are sure they want to delete the license.
Delete License:
penLicenseSystem.deleteLicense \
  licFilePath:((getDir #plugCfg)+"\\+sysInfo.computerName+"_"+"productName_"+(maxVersion())[1] as string+".lic")
						
Once the user has imported a license the tool will need to become active. There are a few ways this can be handled and are out lined in the test script that can be down loaded below. One of the easiest ways is to disable a tool if the license isn't valid by removing the rollouts that the client needs to make the tool function. The isLicenseValid function is called to test the state of the license. In the case of the isLicenseValid function there are two parameters, the Product Key and the path to the license file. The path is the same as what was used when importing the license. The Product Key is then used to test if the license found has a valid counter code or has been timed out in the case of a timed license. isValidLicense returns a boolean value that can then be used to determine if the rollouts should be removed or left visible.
Is License Valid:
penLicenseSystem.isLicenseValid \
  key:"123456789" \
  licFilePath:((getDir #plugCfg)+"\\+sysInfo.computerName+"_"+"productName_"+(maxVersion())[1] as string+".lic")
						
Generating License Files:
Once a client has generated a request file and sent it to the vendor. The License System Key Gen is used to generate and track license files.

First step is to setup a data base path where a .csv file will be stored with a user defined name. It is easiest to store this file at the root of where all the request and license files will be stored for the clients. This path will also become the default path when loading and creating license files. Press the button to the right ("..") and choose a location.

In the Settings section of the Key Gen tool three settings can be setup and stored for each tool you wish to license with it. First is the option for adding the computer name as a prefix to the name of the license file. Review the section on setting up the importLicense function on how the path works. Second is the user defined Product Name. In this field type in the name of the product that is to be used for all licensing. In the example the name has been set to "productName".

Then a Product Key needs to be added that will be used directly to create a counter code in the license file. This value needs to be kept secrete, in the example it has been set to "123456789" but just about any string can be used. Avoid using "\" as it is an escape character as well as "," as it is used in the .csv file.

Once all three options have been entered then the settings can be saved for later use. Use the Options drop down menu and choose "Save Product Code" from the list.

To be able to generate a license file for a client the request file needs to be loaded into the Key Gen. Use the "Get Request File" button to open a file browser and select the request code. For the file to be read correctly the correct Product Name and Product Key must be entered in the settings.

When a license file has been loaded it will display the information about the request file in the "Request Data" area of the dialog.

Two types of licenses can be generated. A full license or a timed license. If a timed license is needed then the date the license is to expire needs to be chosen from the "Expiration Date" menu. This will open a calendar where the date can be picked. Pressing either the "Generate License" or "Generate Timed License" will open a file browser and a location for the file to be saved can be chosen. The file name will already be entered and this must be the same as what is being used for the licFilePath in the three management functions.

Once a license has been generated the information stored in it will be displayed in the "License Data" area of the dialog. There is also the option of loading an existing license file for the purpose of inspecting the license content. Use the "Inspect License" button to open a file browser to load an existing license file. Once again the Product Name and Product Key need to be entered correctly in the "Settings" area of the dialog.

Download Example File: PEN_licenseSystemExample.ms
Menus / Utilities:
Options menu gives you access to setting up and working with the INI and Data Base files.

  • Save Product Code: Once a product code and key are entered they can be saved to the INI file by selecting this option.
  • Import Product Descriptions: When switching to another version of Max the INI settings can be imported from one version to another. First set up the data base location then import the settings from the pervious verrsion of Max. The INI files is stored in the plugCFG folder that can either be in the windows user settings or located in the root of Max depending on how you have 3DS Max setup.
  • Open INI File: Opens the existing INI file in the Max script editor for easy access and manual editing of the settings. Since there is no option provided for removing an unused product and key setting you can manually remove the setting from the INI. The next time the Key Generator is launched the newly edited INI file will be used to populate the product and key fields.
  • Open Data Base: This opens the CSV file that is used as the data base for the licenses that have been generated in the Max script editor.

Licensing menu is used for licensing the Key Generator so that licenses can be generated for your products. If the Key Generator isn't licensed then request files can be loaded but license files can't be generated.

  • Create Request Code: Creates a request file. Send this to PEN Productions re recieve a license for the Key Generator.
  • Import License: Imports the license that has been generated from the request file and sent back to you. Once imported the Key Generator is unlocked and unlimited licenses can be generated.
  • Delete License: This will delete the existing license file from the plugCFG folder where it is stored incase there are any issues and a new license needs to be imported.

Help Menu.

  • Help: Launches the PEN Productions we site to the PEN License System page.
  • Contact: info@penproductions.ca: Will attempt to open your email client for easily sending questions to PEN Productions. If you use a web based client the email is also copied to the clip board for easy pasting as well it is printed to the Max script listener.

Pricing:
PEN Licensing System is setup to save the vendors money that would be lost from having software stolen and down loadable from wares sites. Just like any licensing system it is not 100% secure but should provide a level of security that would other wise not be available. There is no such thing as a licensing system that is full proof, PEN Productions or Paul Neale can not be held rgesponsible for lost revenues due to pirated software.

Costs for licensing are as follows:

Cost:
Description:
Order:
Now Only $99.00 CAN:
Single seat license and can be used to create licenses for an infinite number of products. The license provided here is for enabling the Key Generator to a single seat of 3DS Max how ever the tools that are licensed can be for any version of Max.