Integration into a real app

Mar 15, 2011 at 8:38 PM


I've been looking at the code and trying to understand how to integrate Activatar into a real application.  The SampleApp provided seems to include both the client and server capabilities. Obviously, this is not what should be done.  Can you provide some instructions for integrating this into an existing application that I want to protect?  One that has its own main form that is not the form to activate the application. 

An example of a sample App that stands on its own and needs to send out the required information would be very helpful at this point. 

What exactly is the client user supposed to send me so I can generate a  license specific for his or her machine?  How do I generated it within Activatar? Ok, they start it up. It says this product needs activation.  Then what do they do if they don't have the ability to generate it as in the SampleApp?  The SampleApp uses ProductKeyCheater.  I don't think this is supposed to be included in the application. 

It looks as though the ActivationService has to get installed on the clients machine along with my app in the setup program.  It also looks as if the Activatar.DLL must be referenced and included in the install.  Is this correct? What else needs to be included?

Then it looks as though I need to build a separate app to handle the generation of the product licenses when I get the information back from the client regarding their machine info.

Any help would be appreciated.

Dick T.

Mar 29, 2011 at 3:32 PM

Hi DickT,

The SampleApp only has a reference to the client dll (Activatar.dll). The reason you can generate a ProductKey o activate the product key from the SampleApp is because it uses a Web Service.

As you can see, the SampleApp only has the PublicKey.xml and not the PrivateKey.xml.

You only need to distribute the client dll (Activatar.dll) with your application. You also need to configure the app.config file to point to your own Web Service.

The sample Web Service in the source code has two services. One is the Activation service and the other the ProductKey Generation service. In a real world you only need the Activation service. The ProductKey Generation service should be private so only you can generate Product Keys.

Let me summarize a real world example of activation.

1. An user gets a copy of your product
2. The user request you a product key (maybe in your web page)
3. You generate and send the product key to the user (i.e. by e-mail)
4. At some points in the application, the Product Key Activation Window shows up to the user, asking them to enter the product key
5. The user enters the product key
6. The application connects to your Web Service to activate the product. At that point, the machine hash is sent to the Activation Service to generate a license
7. The license is saved in the user’s machine. Next time the user opens the application, the license is read, so no more connections to the server are required

Note that you need to generate your own Public and Private key. Please, refer to another discussion in this project talking about that.

Hope this helps,



Sep 1, 2011 at 10:41 AM
Edited Sep 1, 2011 at 12:18 PM


I think I have the answer. Using SaveLicense method from ProductLicenseManager class will generate a file named with the product name and CMIIW it will be loaded to see if the product is licensed or else.


Hi Alvaro,


7. The license is saved in the user’s machine. Next time the user opens the application, the license is read, so no more connections to the server are required

After the product already activated, how do I store the license in the user's machine?



Sep 8, 2011 at 11:11 PM

Hi budi84,

In the sample application project the license is stored as a simple file in the application's path. You can do the same or write it in the registry or any other place, but in my opinion, a file is just ok.

Hidding the file is not woth it since the Product License is already self secured, meaning that it cannot be tampered. This doesn't mean that the system is "invulnerable", but unless your product cost 1M$, people will prefer to buy the product than try to hack it :)

Just save the Product License in a convenient place that you can easily read to check if is valid and get the license information. Please, check the sample project source code to see the details and let me know if you have any questions.