dotNet Protector licenses format
dotNet Protector can protect your application against illegal copy.
dotNet Protector activation system uses XML files as licenses :
<dotNetProtectorLicense>
<License ProductKey="..." LicenseKey="..." />
</dotNetProtectorLicense>
ProductKey is a 5x5 string (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX)
LicenseKey is a 6x6 string
License file can be included in a resource dll (mandatory for SQL Server)
You can build a license dll using the .NET framework's AL (Assembly Linker) tool
If your assembly names MyDll and your assembly file is MyDll.dll, you should embed the licence MyDll.license in a dll named MyDll.license.dll.
Use the following syntax :
AL /t:lib /out:MyDll.license.dll /embed:MyDll.dll.license,MyDll.license
If you want to build a strong name license dll (to be installed in GAC)
AL /t:lib /out:MyDll.license.dll /v:1.2.3.4 /keyfile:MyDll.snk /embed:MyDll.dll.license,MyDll.license
version 1.2.3.4 must be the same for the protected dll and the license dll
both dll must be signed with the same key (same PublicKeyToken).
Licences Location
At run-time dotNet Protector's runtime will look for a license (only if hardware lock has ben enabled)
It will first look for a xml license(except for SQL runtime)
then a dll license.
For XML licenses, it looks for the license by exploring these emplacements, in this order:
1. It looks for a AssemblyCompanyAttribute and a AssemblyProductAttribute in the Assembly. If both exists, it tries to open Environment.SpecialFolder.CommonApplicationData\AssemblyCompany\AssemblyProduct\AssemblyVersion\AssemblyName.license
For Example (vista) \ProgramData\PV Logiciels\dotNet Protector\5.3.0.0\dotNetProtector.license
2. builds a MD5 hash from the assembly full name and gets a Guid from the hash
byte[] data = new byte[asm.FullName.Length];
for (int i = 0; i < asm.FullName.Length; i++) data[i] = (byte)asm.FullName[i];
HashAlgorithm hash = new MD5CryptoServiceProvider();
byte[] hashdata = hash.ComputeHash(data);
Guid id = new Guid(hashdata);
string LicenseDir=id.ToString()
It then tries to open \ProgramData\Licenses\LicenseDir\AssemblyName.license For Example : \ProgramData\Licenses\0abfe123-123e-4321-8584-08edda86040f\dotNetProtector.license
3. It looks for the assembly path and tries to open AssemblyName.license, using two ways:
GetLocalPath(asm.EscapedCodeBase)+".License"
asm.Location+".License"
4. It tries to open Assembly.ManifestModule.Name.License from the current directory
5. It tries to open AssemblyName.License from the current directory
If no text license file is found, it looks for an assembly license file, in this order:
Say the protected assembly is MyDll, Version 1.2.3.4
1. If assembly has a strong name it looks for an assembly named MyDll.license, with the same version, the same publicKeytoken and a neutral culture
2. If assembly has a strong name, builds a new assemblyname like this : MyAssembly.license followed PublicKeyToken (in lower case) and looks for an assembly with this name, culture neutral and publickeytoken=null
3. Finally, it looks for an assembly named MyAssembly.license, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null