Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Tutorial: License a LabVIEW Library Using Advanced Mode

Chapter 1: Introduction and Prerequisites

 

Overview

This tutorial walks you through the entire process of adding licensing and activation to a LabVIEW Add-on. From creating the license file to adding the licensing information to actually activating the Add-on as an end user.

 

You do not need to buy any software to go through this tutorial – all the steps assume that you are using trial licenses of Concept Software’s SoftwareKey solution – Protection PLUS 4 SDK and SOLO Server.

 

If you decide to use this licensing solution in your product, you will have to buy a license for Protection PLUS 4 SDK. National Instruments has negotiated a special pricing for NI LabVIEW Partners. See the pricing section for details.

 

For more getting-started resources using SoftwareKey with LabVIEW visit:

Prerequisites:

 

Chapter 2: Creating a License File with LFEdit

 

Overview

 

In order to add licensing to a product, we first need a license file. LFEdit is a utility that ships with Concept Software’s Protection PLUS 4 SDK that allows us to create a custom license file.

 

Creating a license file is a two-step process: first we create a “Product Definition” which is basically information about how we want to license the product (software/hardware binding, evaluation periods, etc). Once we have a product definition, we can create a license file from it.

 

Step by Step Instructions

 

  1. Download and install Protection PLUS 4 SDK trial: This trial is no longer available through the trial request page. Please contact SoftwareKey directly and include "Protection PLUS 4 SDK trial to license a LabVIEW Library" in your message.
  2. Launch LFEdit
    Start » Programs » SoftwareKey Licensing System » PLUS » LFEdit
  3. If you get an activation dialog, select “Evaluate Protection PLUS”
    image002.png
  4. Once LFEdit loads, select Product Definition » Setup… from the menu bar
    image003.png
  5. From the Product Definition Setup dialog, select EZTrial1 and click Properties…
    (With the full version of Protection PLUS, you can add new product definitions as well, the trial is restricted to editing predefined product definitions).
    image004.png
    This will open up the EZTrial1 Product Definition properties dialog.
  6. The general tab contains the basic product information. This information is not used by LabVIEW so you don’t have to change it.
    However, giving it a descriptive name will help keep the product definitions easy to maintain in LFEdit.
    image005.png
  7. Switch to the License File Tab.
    The License File tab contains the license file location as well as the license file password.
    The password in the trial version of Protection PLUS is hardcoded as “password”. With the full version, you can set your own password.
  8. Click Browse and change the File Name to:
    C:\Temp\SimpleMathAPI.lf
    (Make sure that you create the folder C:\Temp if it doesn’t already exist)
    image006.png
  9. Switch to the Trigger Codes tab.
    The Trigger Codes tab contains the codes used for the product activation.
  10. Note down the Trigger Code Seed (400) and the Reg Key Seed (123). We will need this for both licensing our product as well as for setting up the automated online activation.
    IMPORTANT NOTE: These are the default seed values that should only be used during the evaluation. With the full version, you can set your own random seed values, which can be a positive integer for the Trigger Code Seed, and 0-255 for the Reg Key Seed. This helps to ensure the activation requests are routed to the correct product definitions on SOLO server.image007.png
  11. Switch to the EZTrial tab.
    The EZTrial tab contains information on how the product will be licensed.

  12. (Optional) Uncheck Software Binding Aliases.
    IMPORTANT NOTE: For demo purposes only, it is easier to disable software binding because software binding adds several aliases to the windows registry and OS.  For a real licensed add-on, it is important to enable software binding as it provides more security to the licensing. 
    Also, we recommend using a Days to Run expiration of 30 days, and unlimited Times to Run, however this can be changed depending on the product needs
    image008.png
  13. Click OK to close out of the Product Definition Properties and return to LFEdit.
  14. Click on File » New License File on the menu bar
    image009.png
  15. Select SimpleMath API in the dropdown (or EZTrial1 if you didn’t change the Product Name), and click OK
    image010.png
  16. This will open up the license file editor where you can add additional information to the license file. LabVIEW does not use any of these fields so you do not have to modify anything here.
    image011.png
  17. Click File » Save License File to save the license file to C:\Temp\SimpleMathAPI.lf
    image012.png

Note: If you get an error message “Cannot Create License File”, make sure that the directory C:\Temp exists on your computer.

 

Conclusion

 

You just created a license file using LFEdit that contains the information about how you want to license your product. You can now use this license file to add licensing to your LabVIEW Add-on. But first, set up the license server (SOLO server) to enable online activation.

 

Chapter 3: Setting up the License Server

 

Overview

 

In order to allow users to automatically activate the Add-on automatically over the web, you first need to set up SOLO Server with the information about the product and how you want users to activate it.

 

In addition, from here, you can set up the E-Commerce for your Add-on.

 

Step by Step Instructions

 

  1. Create a trial account with SoftwareKey’s SOLO Server at
    https://secure.softwarekey.com/solo/authors/signup.aspx
  2. Browse to the SoftwareKey SOLO Server
    https://secure.softwarekey.com/solo/authors/login.asp
  3. Log into SOLO Server using your account information that you receive via email after you sign up.
    solo_login.png
  4. Now we’ll add our product to SOLO Server.
    On the SOLO Server Author homepage, use the menu Configure / Products, then use the dropdown Actions / Add (Advanced)solo-add-product.png
  5. The Add Product page allows us to customize our product information. For the purposes of this demo we only need to set the Product Name.
    Product Name: SimpleMathAPI
    solo-product-name.png
  6. Click the Submit button at the very bottom to add the product to the SOLO Server.
  7. This will bring you to the Product List page.
    solo-product-list.png
  8. Next, we will add a Product Option to the product. When a user buys or activates a product, they are really buying or activating a specific Option of the product.
    Click on the SimpleMathAPI link of the Product List, and then scroll down to the bottom of the page and click the Add New Product Option button.
    solo-add-new-product-option.png
  9. The Product Option defines the cost of the product and how you want to license it.
  10. Fill out the form with the following information, and leave the other fields with their default values.
    • Option Name: Singe Seat License
    • Trigger Code #: 31
      (This refers to “Activation Hardware Binding: Authorize this Computer ID Only, set Exp Type to ‘N’. For different types of activation mechanisms, use the appropriate trigger code from LFEdit.)
    • Trigger Code Seed: 400
      (or the Trigger Code Seed you used in LFEdit while creating the Product Definition)
    • RegKey 2 Seed: 123
      (or the RegKey 2 Seed you used in LFEdit while creating the Product Definition)
  11. Click Submit at the bottom to add the Product Option.
  12. This takes you back to the SimpleMathAPI Product Page
  13. To verify that the option was added correctly, use the menu Configure / Products to return to the Product List and click on Show Options... on the SimpleMathAPI line.
    You should see the option we just added.
    solo-option-added.png

 

Conclusion

 

You have just successfully added the product information to the SOLO Server. This will enable your users to automatically activate the Add-on over the web once they buy the add-on.

Using the SOLO Server, we can also generate test licenses to verify that our licensing works correctly in-product.

Next, we will add the licensing information to our Add-on in LabVIEW.

 

Chapter 4: Adding Licensing to LabVIEW Code Library

 

Overview

 

In order to add licensing to a LabVIEW Code library, we have to package our library as a .lvlib file and then embed  the licensing information directly to the .lvlib file using a wizard that installs with the Third Party Licensing & Activation Toolkit.

 

The licensing information here includes information about how to activate the product as well as activation modes (online, manual, etc).

 

Note: Once we add the licensing information, we would typically create an installer or package to distribute the library. We will skip this step in this tutorial.

 

Step by Step Instructions

 

  1. Install the Third Party Licensing & Activation Toolkit from
    https://www.ni.com/en/support/downloads/tools-network/download.third-party-licensing-and-activation-...
  2. Download the sample toolkit and extract it to:
    C:\Temp
  3. Create a license file in LFEdit (See Creating a License File with LFEdit) or download the pre-built license file and extract it to:
    C:\Temp
    image021.png
  4. Open LabVIEW 2010
  5. Click Tools » Add-on Licensing Tool…
    image022.png
  6. This will open up the Add-on Licensing Wizard which will walk you through the steps of adding licensing to a LabVIEW Code Library.
  7. On Step 1 of the wizard, browse to the library located at:
    C:\Temp\SimpleMath.lvlib
    image023.png
    Click Next.
  8. Fill out Step 2 as follows:
    • Company Name: JervinSoft
      (or replace with your company name. This is used later for the location of the license file)
    • Product Name: SimpleMath API
      (This will be the product name that shows up on the activation dialogs)
    • Product Version: 1.0
    • Purchase URL: 
      (Enter the url where users can purchase the product. You can use the SOLO server to set up your e-commerce)
      image024.png
  9. Fill out Step 3 with the license file info as follows:
    • License File Path: C:\Temp\SimpleMathAPI.lf
    • License File Password: password
      (or the password you used in LFEdit)
      image025.png
  10. Fill out step 4 with the Activation information as follows:

Note: If the Automated Online Activation is checked, the Enable Deactivation checkbox appears.Enable Deactivation.png

 

For deactivating a toolkit the required Key ID, Secure Key, Client Key can be found on the SOLO account.

Refer to Configure > Products Configure Products.png

 

 

 

For the next step, please, go to Actions > View Encryption Key DataView Encrytion Key Data.png

 

 

  

 

The three values are highlighted below, as the Encryption Key ID, Server Key (XML), and Client Key (XML)All Keys blur.png

 

 

 

 

  

 

  1. On Step 11, fill in a password to lock the LabVIEW Library.
    • New Password: test
    • Confirm Password: test
      image027.png
    • Click License
  2. You should get a confirmation page. Click Finish.
    image028.png
  3. LabVIEW looks for license files in a specific location:
    <App Data>\ National Instruments\Partners\<Company Name>\Licenses
    The license file should be deployed there by the installer of the product. For this demo, simply
    Copy the license file to:
    • Windows XP: C:\Documents and Settings\All Users\Application Data\National Instruments\Partners\JervinSoft\Licenses\
    • Windows Vista/7: C:\ProgramData\National Instruments\Partners\JervinSoft\Licenses\
      (Replace ‘JervinSoft’ with the Company Name from Step 2 of the Licensing Wizard)
  4. Exit LabVIEW
  5. Re-launch LabVIEW
    On start-up, you should see an activation dialog for 3rd party Add-ons, including our product – SimpleMath API
    image029.png
  6. Click Continue to LabVIEW
  7. Open C:\Temp\SimpleMath.lvlib
    Notice that the library is now locked (the lock glyph)
    image030.png
  8. Open Add.vi
    Notice that you can run the VI (because the license is currently in evaluation mode), but cannot look at the block diagram.
  9. To see what happens when the license expires, we will replace the license file with an expired license.
    1. Close out of LabVIEW
    2. Download the expired license file and extract it to the license file location:
      The license file should be deployed there by the installer of the product.  For this demo, simply copy the license file to:
      • Windows XP: C:\Documents and Settings\All Users\Application Data\National Instruments\Partners\JervinSoft\Licenses\
      • Windows Vista/7: C:\ProgramData\National Instruments\Partners\JervinSoft\Licenses\
        (Replace ‘JervinSoft’ with the Company Name from Step 2 of the Licensing Wizard)
    3. Re-launch LabVIEW
  10. Notice on the activation dialog, SimpleMath API now appears as expired
    image031.png
  11. Click Continue to LabVIEW and open C:\Temp\SimpleMath.lvlib
  12. Once again, open Add.vi
    This time notice that the run arrow is broken. This is because expired libraries will not execute.
    Click the broken Run Arrow to see the error:
    image032.png

 

 

Conclusion

 

You have successfully added licensing to a LabVIEW Code Library with an evaluation period.

 

Licensing provides a way to protect your IP while giving you the ability to provide evaluation software. This means that users of this library will only be able to use it for a certain amount of time before they have to activate it. It also prevents users from building installers for applications that uses your library without first activating it.

In case of need, the users can deactivate the product(s).

 

Now we will look at how an end user would activate the software once they purchase it (manually or automatically over the web).

 

Chapter 5: Activating a LabVIEW Code Library – Automated Online Activation

 

Overview

 

LabVIEW gives user the ability to activate their Add-ons either manually or automatically over the web.

 

When a user purchases the Add-on, they will receive a License ID and password. The user can activate their add-on directly from LabVIEW using just the License ID and password.

 

Note: If you do not use the E-Commerce functionality of the SOLO Server, you can still manually generate License IDs and passwords for users.

 

Step by Step Instructions

 

  1. Before you begin, make sure that the Add-on is set up on the license server.
  2. If you have already activated the product once, copy over a fresh license file to:
    <App Data>\ National Instruments\Partners\<Company Name>\Licenses
    Copy the license file to:
    • Windows XP: C:\Documents and Settings\All Users\Application Data\National Instruments\Partners\JervinSoft\Licenses\
    • Windows Vista/7: C:\ProgramData\National Instruments\Partners\JervinSoft\Licenses\
      (Replace ‘JervinSoft’ with the Company Name from Step 2 of the Licensing Wizard)
  3. Launch LabVIEW. On start-up, you should see an activation dialog for 3rd party Add-ons, including our product – SimpleMath API
    image029.png
  4. Click Activate Add-ons
  5. On the Activate Add-ons Dialog, select SimpleMath API and click Next.
    image033.png
  6. Select Automatically activate through an Internet connection and click Next.
    image034.png
  7. The Activation Dialog then gives the end user the ability to enter the License ID and password that they received when they bought the software. This is similar to the Serial Number that users get when they buy LabVIEW.
    image035.png
  8. We will now generate a test license for demo purposes using SOLO Server.
    1. Browse to SoftwareKey's SOLO Server
      https://secure.softwarekey.com/solo/authors/login.asp
    2. Log into the SOLO Server using your account information
    3. Use the menu Customers / Add a Test License
      solo_test_license.png
    4. On the Add License dialog, select SimpleMathAPI Single Seat License (or the Product Name and Option you created on the SOLO Server from the Setting up the License Server step). Click the Add New Test License button, and click OK for the dialog describing the use of test licenses.
      solo-add-test-license-simple.png
    5. This should create a test license as shown below. The License ID and Activation Password are the values needed to activate the software.
      solo-licenseid-password.png

       

  9. On the activation dialog, enter in the License ID and Password we just generated.
    image039.png
    Click Activate.
  10. You should get an Activation Successful dialog
    image040.png
  11. Click Finish to go back to LabVIEW
  12. Now we’ll verify that the library was activated correctly. Click on Help » Activate Add-ons.
    Notice that SimpleMath API now shows a status of Activated.

image041.png

 

Conclusion

 

You’ve now seen how a user can activate a LabVIEW Code Library online using LabVIEW’s activation dialog.

 

You can also enable manual activation for situations where your users cannot access the internet from their computer.

 

SoftwareKey provides a special pricing package for NI Partners that want to use this licensing solution.

 

Chapter 6: Activating a LabVIEW Code Library – Manual Activation

 

Overview

 

LabVIEW gives user the ability to activate their Add-ons either manually or automatically over the web.

 

The manual activation is meant for situations where your uses do not have an internet connection, or for situations where you do not want to use Concept Software’s SOLO Server backend for activation.

 

Manual activation can be done over the phone, or through a web page that you set up. Basically, the user will give you two unique identifiers and you will use those in LFEdit to generate an activation code for them. The user will then use this activation code to activate the Add-on from LabVIEW.

 

Step by Step Instructions

 

  1. If you have already activated the product once, copy over a fresh license file to:
    <App Data>\ National Instruments\Partners\<Company Name>\Licenses
    Copy the license file to:
    • Windows XP: C:\Documents and Settings\All Users\Application Data\National Instruments\Partners\JervinSoft\Licenses\
    • Windows Vista/7: C:\ProgramData\National Instruments\Partners\JervinSoft\Licenses\
      (Replace ‘JervinSoft’ with the Company Name from Step 2 of the Licensing Wizard)
  2. Launch LabVIEW. On start-up, you should see an activation dialog for 3rd party Add-ons, including our product – SimpleMath API
    image029.png
  3. Click Activate Add-ons
  4. On the Activate Add-ons Dialog, select SimpleMath API and click Next.
    image033.png
  5. Select Use a telephone to acquire an activation code and click Next.
    image042.png
  6. The Activation Dialog then gives the end user the ability to enter their activation codes that they receive when call / email you. This is similar to the Activation Code that users get when they call NI with their serial number.
    image043.png
  7. We will now pretend that the customer has called you (the developer) with their user codes and we will generate an Activation Code for them.
    1. Open up LFEdit
    2. Click Tools » Trigger Codes
      image044.png
    3. On the Trigger Code dialog, select Trigger Code 31 (which activates the a hardware bound license on a single machine. If you used a different licensing method, select the appropriate Trigger Code). Click Select
      image045.png
    4. Fill out User Code 1 and User Code 2 from the LabVIEW Activation Dialog (this is what the end user would give you).
      image046.png
      Click Generate
    5. This should generate a RegKey or Activation Code. Make note of this. This is what you would give back to your user.
      image047.png
  8. On the activation dialog, enter in the License ID and Password we just generated
    image048.pngClick Activate.
  9. You should get an Activation Successful dialog
    image040.png
  10. Click Finish to go back to LabVIEW
  11. Now we’ll verify that the library was activated correctly. Click on Help » Activate Add-ons.
    Notice that SimpleMath API now shows a status of Activated.
    image041.png

 

Conclusion

 

You’ve now seen how a user can activate a LabVIEW Code Library offline manually using LabVIEW’s activation dialog.

 

You can also enable automated activation via the web if you use the SOLO Server for activations.

 

SoftwareKey provides a special pricing package for NI Partners that want to use this licensing solution.

 

 

Chapter 7: Pricing Details

 

The two basic components of the SoftwareKey solution are:

  • Protection PLUS 4 SDK: Software application used to generate a license file as well as to perform manual activations (for customers that cannot activate online or if you want to use your own e-commerce solution)
  • SOLO Server: Server back-end of the licensing solution used for automated activation over the web. Also allows building a shop page with e-Commerce capabilities built into it.

 

NI Partner Pricing

 

NI partners can purchase the SoftwareKey Protection + Automation solution starting at only $49/month!
https://www.softwarekey.com/buy-now/

  • A site license of Protection PLUS 4 SDK Enterprise Edition (includes LFEdit as described in this tutorial) (normally $699)
  • SOLO Server Shared URL account

This gives you the ability to:

  • Generate as many licenses for as many products as you want at no extra cost
  • Process automated activations for users
  • Sell your product online at a 2% commission (through optional integrated eCommerce)

For more information on fees collected for activations and sales, refer to:

https://www.softwarekey.com/buy-now/

 

Additional Resources

Jervin Justin
NI TestStand Product Manager