Protecting EFS Scripts in eSignal (Part 2)

A question we frequently get from eSignal users who are building their own EFS indicators is "How can I protect the source code?".

Note: this discussion assumes you are running eSignal 12.x or newer

There are a few options depending upon your ultimate goal:
  • Encryption only (Covered in Part 1);
  • Encryption and basic licensing control;
  • Encryption and enhanced licensing control;

Encryption and Basic Licensing Control

In this scenario you would still encrypt the script as described in Part 1 but, prior to that step, you would set up a mechanism that would allow you to restrict the users to can actually run your indicator. This is possible because, in eSignal, every user has a unique user name and you can query the username from within your EFS script.

With Basic Licensing Control you can only have one user-access location and file, and it does not support subscriptions.

The simplest way to accomplish this is with the eSignal addEntitlement() function, which would be placed in the preMain() section of your EFS script. This function has two parameters:
  • URL: (required) Full path to a access file that will be maintained by you; and
  • Message: (optional) A short message to display if the user is not in the access file. Something like "Sorry, you are not entitled to use this indicator. Please browse to www.mysite.com for more information."
The URL component will require a bit of work on your part. First, you will need to set up a location on the internet where you will be able to store your user-access file. You will need to have FTP access to this location.

If you already have your own web site then you can simply create a new folder off of the root of your site and store the file there (i.e., for example: www.mywebsite\user-access-files). If you don't have your own website then you can create a private group in the eSignal File Share and store your user-access file(s) there.

If you choose the File Share route then be sure to turn off all access to your File Share group (i.e., other than Admin access which would be you) so that you are the only one who can upload/edit/view files in this group. The benefit to using a eSignal File Share group is that it is free and it has an integrated Upload component so you will not need to use FTP in this situation.

Once you have the user-access file location sorted, you will need to create the actual user-access file. This is just a simple text file that will contain the eSignal usernames (which are case-sensitive by the way) for all users who are entitled to use your indicator.

The format would be one username per line and you can input as many usernames as you need. Again, this must be a simple text file so please don't use MS Word (or any other word processor) to create this file. Rather you should use Windows Notepad or the integrated eSignal Script Editor. So just type in the usernames one per line, save the master copy of the file to your hard drive, and then upload a copy to your user-access location. Whenever you need to add or remove a user, just edit the master copy on your hard drive and then upload it again.

Once everything is in place you can insert the addEntitlement() line into your preMain() section. It should look something like this:

function preMain() {
  setPriceStudy(true);
  setStudyTitle("My Cool Indicator");
  setShowTitleParameters(false);
  setProperty("HideEncryptedLock", "yes");
  addEntitlement( "www.mysite.com/access-files/myindicator.txt", "Message");
}
 
Now you can encrypt the script, test it, and then either post it in a public location (remember, only users listed in your user-access file will actually be able to run it) or distribute it via email.

To be Continued in the next Post....

Divergence Software, Inc.
www.sr-analyst.com
support@sr-analyst.com
Contact Us/Subscribe

No comments:

Post a Comment

Latest Post

Harmonic Pattern Collection Lifetime Package

If you are currently a Harmonic Pattern Collection monthly subscriber, consider upgrading to outright purchase of the Harmonic Pat...

Most Popular