where to save activation key

2019-07-13 09:47发布

问题:

I am using C# and have a key the users enters to activate my program. I do not want the user to be able to see the key once it is entered. Do you have any recommendations for how/where to store it?

回答1:

You can save the key as a seperate file. Encrypt the key and save it. So even if the user tries to tamper with it then you can deactivate the application.

You might be interested in this project in codeplex: http://licenser.codeplex.com/

Edit : Some questions for you to check.

  1. Where should I store my activation key

  2. Best way to generate activation codes for software?

  3. Best activation key software for .NET application?



回答2:

Forget about trying to obscure where you save the license key - you won't be able to stop determined users, and you'll only piss off sysadmins if you try to store license information in "strange" places. Forget everything about trying to store in your running executable, it's hard to do in a foolproof way, and will trigger a lot of antivirus software.

If you want something that's tamper-resistant, go for one of the commercial solutions; sorry if this sounds harsh, but you're not going to come up with anything that's even remotely difficult to break, considering you're asking a question like this.



回答3:

You can certainly store a key in the resource of an Excutable, its quite long procedure, there are couple of APIs available like OpenResource, GetResourceData and UpdateResource, resources are not accessible easily unless you have visual studio tools installed.

But you cant modify the resources of the executable that is currently running, but you can create different activation program that can load your main executable, modify resource and save it.



回答4:

Assuming a Windows machine is running your application, you can also use the registry to store your encrypted key (maybe MD5?).

That way it is not in a "file" that can be viewed by the user (although it can be viewed/changed/deleted by the user).
In my opinion users (standard ones...) tend not to look in the registry - you can hide your key there.

Actually, @Shoban's first link where-should-i-store-my-applications-activation-key has more discussion on this issue - you should read it...



回答5:

I know it's more like for cryptographic keys - but what about windows key container?



标签: c# save key