Getting Started with Plugin Licensing

I have a plugin I’ve been developing and would like to be able to distribute it using a Zoo License. What I’m imagining is that I will send the rhp file to the user and also provide them some kind of activation key that I generate, or something like that. Is LAN Zoo the right thing for this?

I’ve come across two guides for getting started (1, 2). They seem to be explaining how to do the same thing, but have different steps. Which should I be trying to follow? Or is there a more detailed guide?

Thanks,
Sam

Hi @samlochner,

This is what the LAN Zoo does, yes.

Creating LAN Zoo Plugins outlines how to write a plug-in for the LAN Zoo - plug-in that are used by the LAN Zoo.

Creating Plugins that use the LAN Zoo outlines how to write a Rhino plug-in that uses the LAN Zoo.

There are also some samples on GitHub:

rhino-developer-samples/zoo at 7 · mcneel/rhino-developer-samples · GitHub

rhino-developer-samples/rhinocommon/cs/SampleCsWithLicense at 7 · mcneel/rhino-developer-samples · GitHub

– Dale

Hi Dale, thanks for the reply.

I’m not understanding the distinction between used by the LAN Zoo versus uses the LAN Zoo. Could you please elaborate? And which would you suggest for someone looking to distribute a plugin with licensing protection?

Thanks,
Sam

Hey @samlochner,

In order for the LAN Zoo to serve up your licenses, you need to write a plug-in for it, as the LAN Zoo is license agnostic.

When the user adds one of your licenses to the LAN Zoo, it calls into your Zoo plug-in asking it to validate the code that was entered.

– Dale

Okay, I think that means I should be following this guide: Creating LAN Zoo Plugins with C#

Instead of completing the steps in “Writing a LAN Zoo Plugin”, can I just open the SampleVBZoo and use that?

It’s not a template for V7 though, so I’m not sure how I would bring my plugin commands into it…

Thanks,
Sam

Zoo plug-ins run in the Zoo, not Rhino. You don’t add Rhino commands to Zoo plug-ins…

– Dale

Oh, wasn’t understanding that I would be having two separate plugins, one for Rhino and one for Zoo.

In regards to Writing a LAN Zoo Plugin, can I just use SampleVBZoo as is? Or is there some way that mine has to be different than the sample?

Thanks,
Sam

Well, no. The sample is just a sample. Your Zoo plug-in should be able to decode a string, input by the user, and validate it as a valid license of yours. The sample, obviously, cannot to that.

– Dale

Hi Dale, is there any way you could add that into the sample? I imagine there are and will be other first time rhino plugin developers out there that could use the same zoo plugin (different license codes of course), and it would be a huge help in making the leap from having to developed a rhino plugin to being able to distribute it.

Yeah sorry, no. We’re not going to be responsible for licensing and protecting your intellectual property.

With the Zoo, you are responsible for key generation, payment, key delivery and customer management. Once your customer has added the license to the Zoo, it will handle the rest with a licensing mechanism that’s familiar to Rhino users.

– Dale

Sorry, I didn’t mean to suggest I was hoping for any kind of responsibility or accountability for protecting the plugin. I fully understand the risks are mine alone. I’m just not understanding on a technical level how to complete the zoo plugin.

I see that clicking the green plus in Zoo brings up an add license form with a drop down for various product types. If I understand correctly, once my Zoo plugin is signed and its dll is in the zoo plugins folder, my Zoo plugin will show up in the product type list on that same form, correct? If so, once the user enters the license and clicks add, is there a function that gets called I have access to where I can validate the license code?

Thanks,
Sam

Correct

Yes

– Dale

If I understand correctly, the only thing I need to do to the SampleVBZoo project to just get it working is to put in a check in the ValidateProductKey function to see if the key was not valid and if it isn’t then return something other than 0, such as below. Is this correct?

Dim ValidLicenses As New List(Of String)
ValidLicenses.Add(“TEST-1111-1111-1111-1111-1111”)
If Not ValidLicenses.Contains(productKey) Then Return 1

Can the same signed digital certificate be used multiple times or is it a single use kind of a thing?

Yes

You can sign both both your Zoo plugin (DLL) and your Rhino plugin (RHP) with the certificate we provide.

– Dale

For the user, as I understand it they will have both Rhino and the Zoo installed, and I will provide them both the Rhino plugin rhp file and the Zoo plugin dll file, and they will put these in the rhino and zoo plugin folders, correct?

The rhp file will be obfuscated to decrease the risk of piracy. I suppose the zoo plugin dll should be obfuscated too, given someone could just go in and change the acceptable license key list. Is this the generally practiced method or is there another more common approach? (I understand this question is going outside your scope, but perhaps you could just point me in the generally direction…)

Thanks,
Sam

Yes, the Zoo will be installed one some server and Rhino on one or more workstations.

Your Zoo plug-in will need to be installed into the Zoo’s plug-in’s folder:

C:\Program Files (x86)\Zoo 7\Plugins

Your Rhino plug-in should not be installed into Rhino’s plug-in folder. Choose some other appropriate location (e.g. Program Files, the user’s roaming profile, etc.).

You might consider distributing your plug-in via our Package Manager, as it will install the RHP into a worthy location.

How you protect your plug-in assemblies is up to you. I know some chose obfuscation. Some chose to put their licensing code in an unmanaged DLL. Others choose to validate licenses from a remote server. What you are comfortable with.

– Dale

Hi Dale,

Step 4 of Generate Private Key & Certificate Signing Request reads:

Add the OpenSSL installation folder to your Windows path: set path=C:\OpenSSL-Win32\bin;%path%

My OpenSSL got installed in a different spot so I instead did: set path=C:\Program Files\OpenSSL-Win64\bin;%path%

But set path doesn’t seem to work for me in Windows 10 command prompt (run as administrator). So I instead get to the bin directory via CD. And then when I get there I type: CreateRequest.bat

and get the error “The syntax of the command is incorrect”. And if I do the same command without <> then I get the error "‘CreateRequest.bat’ is not recognized as an internal or external command…

I see there is a CreateRequest.bat file in mcneelcodesigning, so I try to run it from there, but I get the error 'OpenSSL is not recognized…

Any idea what I’m missing in order to complete steps 4 and 5?

Thank you,
Sam

Just douible-click on start.bat that is found on the OpenSSL “bin” folder. Then just navigate to where you’ve extracted mcneelcodesigning.zip.

– Dale

That worked,

The next section says to email the .csr file along with the certificate request. I have the .csr file now, but where do I find the certificate request?

Thanks,
Sam

Hey Brian, my name is so-and-so, and I work for so-and-so, and my plug-in is so-and-so, and we’d like to suppor the Zoo. So we’d like to request a signed digital certificate for both our Zoo and Rhino plug-ins?

Sincerely,

so-and-so

:wink:

– Dale