Best practice to deploy license file in .NET

Hello,

I was wondering if there is any best practice on how to “deploy” the license file to our end customers.
On one hand side we need to have the .lic file (or at least a memory stream) that we can pass to the SetLicense function at runtime, but on the other hand side we don’t want our .lic file to be distributed to all customers when deploying our software.

1 Like

@Clemens_Pestuka,

We are investigating this and we’ll update you with a best possible solution that will meet your scenario. Your investigation ticket ID is CONVERSIONNET-3675. As there is any further update, you’ll be notified.

1 Like

@Clemens_Pestuka

I don’t know if it’s a “best practice”, but I faced the same challenge, and went with storing the License as encoded data in our application’s database, set through an admin web UI.

Then when the application loads, it retrieves the data from the database, decodes it, and sets the license key.

Challenges you’ll want to watch for are implementing a synclock in your application code if your application is multi-threaded, and could call .SetLicense multiple times concurrently. Or if you are deploying in a web-farm or server-cluster, each node will need to call .SetLicense individually, but you would need to use a distribute cache like Redis to alert the nodes when the license file value changes.

This way we can distribute our application without giving access to a plain-text .lic file on the filesystem.

Hope that helps,
-Brian

2 Likes

@Clemens_Pestuka,

This may help you:

  • You should embed encoded/encrypted license file in you product. To read the license file from the embedded resource, you could use something similar to this answer: .net - How to read embedded resource text file - Stack Overflow
  • The way you encrypt/encode the license file should be your own specific implementation which should be secure enough to keep the license private
1 Like

@cirrussecure
@atirtahir3
Thank you both for your suggestions :slight_smile:
I encrypted the file and embedded it to the resources now.

1 Like

@Clemens_Pestuka,

You’re welcome :slight_smile:

1 Like