Check if a license file is made for the current copy-protected assembly

826 Views Asked by At

Hi I implemented a copy-protection mechanism with Microsoft's LicenseProvider model and a public/private key pair to prevent copying a program from one PC to another. Very simple. On startup, a license file has to be prent wit hencrypted information about the computer, the expiration date, and the assembly name that this license file is for. But what if someone renames the license file from MyProgramA.exe.lic to MyProgramB.exe.lic? If both Programs are copy protected using the same method, simply renaming the .lic file is enough to have a valid ProgramB license. This is why I stored the assembly name inside the .lic file. The assembly names must match.

Now, what happens if someone instead renames ProgramB to ProgramA? The assembly names would match and again the license would be valid. Any ideas to make this more bullet-proof?

Again, this is a simple proprietary solution, so no obfuscation, and no 3rd party tools which I know exist.

Thanks!

2

There are 2 best solutions below

0
On

Store the assembly name (NOT the file name) in the lic file. The assembly name will be the same even if the file name is changed.

Even better is to simply use different encryption keys for different apps. This way, it does not matter if exe or lic files are renamed.

0
On

If you sign your assembly then I don't believe people can rename it successfully.