PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Documentation

Introduction to dotNet Protector

PV Logiciels dotNet Protector is a powerful .NET code protection system that prevents your assemblies from being decompiled.

dotNet Protector 5 protects applications and components with a new body obfuscation technology. Assemblies are no more merged in a win32 exceutable, but keep their .net nature. dotNet Protector 5 protects your code with a names obfuscator combined with a body obfuscator.
dotNet Protector 5 native runtime is available on X32, X64 and IA64 platforms
dotNet Protector 5 Engine is available for x86 and x64 architectures.

Protection can be done interactively with an intuitive graphical interface, or automated, using the command-line functionalities of dotNet Protector.

dotNet Protector includes a powerful hardware sensitive anti-piracy system and extensions to help you develop your own software activation system. dotNet Protector is self-protected and uses its internal software activation system.

32 and 64 bits builds

dotNet Protector is available in 32 bits (x86) and 64 bits (AMD64) builds. Both builds have strictly the same features.

No distinction is done regarding licensing between each build:

You can activate dotNet Protector in 32 bits build and install dotNet Protector 64 bits on the same computer with the same license (no interest).

You can choose Usb activation and use the 32-bit build on win32 computers and the 64-bit build on win64(x64) computers.

dotNet Protector Runtime

Assemblies protected by dotNet Protector (using advanced protection) need dotNet Protector runtime to run.

Exes can be protected embedding the runtime; in this case the generated exe is a mixed exe (C++ like, with native and IL code) embedding the runtime.

dotNet Protector is a 5 files set :

. PvLogiciels.dotNetProtector.Runtime.dll : is the common runtime, always needed

. PvLogiciels.dotNetProtector.RuntimeV1.dll : is the v1.1 framework compatible runtime. You don't need it if your assembly is v2+.

. PvLogiciels.dotNetProtector.RuntimeX86.dll : is the v2.0 x86 runtime. You need it if your assembly is loaded by the .NET framework v2+, unless your code is explicitely a 64-bit assembly.

. PvLogiciels.dotNetProtector.RuntimeAMD64.dll : is the v2.0 ADM64 runtime. You need it if your assembly is loaded by the .NET framework v2+ on a 64-bit x64 platform, unless your code is explicitely a 32-bit assembly(x86 instead of AnyCPU).

. PvLogiciels.dotNetProtector.RuntimeItanium.dll : is the v2.0 Itanium runtime. You need it if your assembly is loaded by the .NET framework v2+ on a 64-bit ia64 platform, unless your code is explicitely a 32-bit assembly(x86 instead of AnyCPU)

Vista Compatibility

dotNet Protector runs with standard user priviledges. It compies with multiple sessions and 'Restart Manager'. If restart manager restarts dotNet Protector, you'll keep your project settings in a temporary project 'recovered'.

dotNet Protector earned the 'Certified For Windows Vista' logo in both builds, 32-bit and 64-bit

dotNet Protector Editions

dotNet Protector Features

Licensing Mode

Send comments about this topic to PV Logiciels

Copyright © 2007 PV Logiciels. PvLog, the PvLog logo and dotNet Protector are trademarks or registered trademarks of PV Logiciels in France, the European Union and/or other countries


PvLogiciels.dotNetProtectorHierarchy

Introduction to dotNet Protector

dotNet Protector Editions

dotNet Protector is declined in 3 editions, differentiated by their features: Classic, Professional and Advanced.

dotNet Protector Classic is the successor of dotNet Protector 4, protecting the applications (exe) only.
dotNet Protector Professional includes components and ASP.NET applications protection
dotNet Protector Advanced includes in more SQL Server assemblies protection

dotNet Protector Evaluation version has all Advanced Edition's features whith following limitations :
- It doesn't allow conventional obfuscator only protection
- Protected assemblies expire after 5 days (after, each method will throw ApplicationException)

dotNet Protector Editions Feature Comparison

 | Classic | Professional | Advanced
Exe Protection | X | X | X
Dll Protection |  | X | X
ASP.Net |  | X | X
SQL 2005 |  |  | X
Framework | 1.1 / 2.0 / 3.0 / 3.5 | 1.1 / 2.0 / 3.0 / 3.5 | 1.1 / 2.0 / 3.0 / 3.5
GUI | X | X | X
Batch | X | X | X
MSBuild | X | X | X
Assembly Embedding | X | X | X
64-bit Architectures | X | X | X
Anti-ILDASM | Code IL Corrompu | Code IL Corrompu | Code IL Corrompu
Eval Generator | X | X | X
Hardware Lock | X | X | X


PvLogiciels.dotNetProtectorHierarchy

Introduction to dotNet Protector

dotNet Protector Features

.NET code Protection
Assemblies are obfuscated, then method bodies are replaced by corruped code; decompilation and disassembly tools like ILDASM can no more unassemble methods.

Components Protection
dotNet Protector 5 builds a new .Net assembly. This new feature enables not only exe protection, but dll as well. ASP.Net is supported by dotNet Protector 5.

Evaluation Generator
dotNet Protector can generate a limited executable. You can choose executable lifetime (in days): your program wont launch beyond this limit. You also choose to limit execution time in minutes.
No modification to your code is necessary to produce an evaluation version.

Activate your software
A hardware lock system is integrated with dotNet Protector. Running your program can depend on a valid unlock key. Configuration collection and activation code generation are embedded features of dotNet Protector. Configuration comparison and unlock key generation functions are built in dotNet Protector.
Keys used for activation are UNIQUE: a new Key set is generated during install. This set, composed of public and private keys will allow you to unlock only your applications, and THIS SET ONLY will be able to unlock them. Your application embed the public part of your set; the protected part is use to generate your application and unlock it you keep it secret. This way you keep control of the whole activation process.

Script usage
dotNet Protector is a command-line application; without parameters, it works in interactive mode. You can protect your code immediately after compilation by adding an after generation event in your visual studio project; then protection is automatically performed after compilation.


PvLogiciels.dotNetProtectorHierarchy

Introduction to dotNet Protector

Licensing Mode

dotNet Protector user license is granted on the 'by device' model.

'device' means a computer or a usb storage key.

Three activation methods are available

1. Computer activation

In this mode, the license is attached to the computer where it has been activated. dotNet Protector can run on this computer only.

2. Usb storage activation

In this mode, the license is attached to the usb storage device, not the computer. dotNet Protector can run on any computer, as long as the device is attached to this computer.

3. Instant Activation

In this mode, the license is attached only temporarily to the computer where it has been activated Each time dotNet Protector runs, a 'license token' is queried to an activation server for the computer running dotNet Protector. Attachement will persist 1 day. During this period no other computer will be able to get a license token for the same license. This license mode requires a permanent internet access.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector documentation

Reverse Engineering Prevention

The names of all the variables and methods, as well as the values of all constants, are visible to anyone with a disassembler. Anyone who has the .NET Framework has access to a disassembler (ILDASM.EXE). There is something that you can do to defend your code from prying eyes: obfuscation.

Obfuscation refers to performing a series of operations that disguises the true meaning, purpose, and logic of your application's code. This is done by changing your variable and method names to a series of unintelligible alphanumeric characters. After obfuscation, reverse-engineering MSIL code that might ordinarily be easily reversible quickly becomes a colossal task that would take so long that most people would be discouraged from attempting it.

Don't let this fool you: Anyone who wants to reverse-engineer your code badly enough will either do it or find the resources to get it done. As a result, you need to write your code defensively. If you really do have a trade secret embedded in your code, don't put it in the same place, scatter it around, and make sure that the obfuscated MSIL doesn't make it obvious what your code is doing.

Everyone with the determination and resources will be able to reverse-engineer any code that they have on their hard drive. There are products that can generate C# from MSIL code even if it has been obfuscated. In such a format, it would take only minutes for an intruder to search for what he needs to find out all the information he wants.

Protection Methods

Obfuscators

Obfuscators work by transforming a .NET assembly into an equivalent .NET assembly that is more difficult to understand when disassembled or decompiled. Some obfuscators use ILDASM to disassmble the assembly and operate on the disassembled MSIL, and then use ILASM to reassemble the result. Others operate directly on the assembly without any ILDASM/ILASM round trip. Obfuscators apply a variety of different techniques to make the disassembled source code more difficult to understand.

Compilers

Compilers work by removing the bulk of the MSIL code from a .NET assembly, replacing it with compiled native code targeted at a particular platform and a MSIL stub to call the native code. This prevents decompilation by removing the MSIL and the metadata on which a decompiler operates. Using a compiler ties your assembly to a particular CPU architecture, removing the potential cross-platform nature of .NET. This may become an important consideration as Microsoft releases. Using a compiler also means that you lose some of the benefits of managed code, such as the Common Language Runtime's safe code execution environment.

Linkers

Ordinarily, a .NET assembly depends on code from a variety of assemblies that are shipped by Microsoft. These assemblies, known collectively as the .NET Framework, make up the basic functionality of .NET. These assemblies include things like Windows Forms, file processing functions, networking code, and so on. A linker can pull just the parts of the .NET Framework that your application uses into your application's own assembly, and in so doing, lets you obfuscate those parts of the Framework as well as your own code. This can make it more difficult for others to determine what your code is doing. However, it is possible that the use of a linker in this way violates the Microsoft license terms for the .NET Framework.

Encrypting launchers

Encrypting launchers employ a two-step strategy for protecting source code. First, they encrypt your assembly and its resources. Second, they wrap the encrypted assembly in an executable application. At runtime, this application decrypts your assembly directly to memory, where it is then executed normally by the .NET Common Language Runtime. With this strategy, the code on your hard drive is no longer native .NET code and thus cannot be deciphered with the usual tools for exploring .NET assemblies.

dotNet Protector 5

dotNet Protector 5 protège Applications et composants grâce à une technologie inovante de maquillage de bodies. Les assemblies ne sont plus transformés en application native, mais restent des assemblies .Net. dotNet Protector 5 protège votre code code grâce à un obfuscateur associé à un maquilleur de méthodes.

Les assemblies sont obfusqués, et le corps des méthodes est remplacé par du code corrompu; Les outils de décompilation ou désassemblage comme ILDASM ne pourront pas désassembler ou décompiler les méthodes. dotNet Protector 5 prend en charge la protection des composants et ASP.Net.

La runtime dotNet Protector 5 (5 dlls) doit être déployée avec les assemblies protégés. Il suffit de copier ces dlls dans le répertoire d'exécution. L'inscription de PvLogiciels.dotNetProtector.Runtime.dll dans le GAC est aussi possible.

dotNet Protector 5

This section intriduces protection methods dotNet Protector implements and helps choosing a project type regarding assembly to protect.

Protection methods dotNet Protector implements

dotNet Protector project types


PvLogiciels.dotNetProtectorHierarchy

Reverse Engineering Prevention

Protection methods dotNet Protector implements

Conventional Obfuscator

This method consists in obfuscating the code by changing the name of the methods, properties, classes, namespaces...

This action can prevent the code from running correctly:

It makes impossible to use the reflection api on obfuscated names, even for internal reflection (inside the same assembly).

Obfuscation is enabled in dotNet Protector by checking 'obfuscate name' in the protection tab. dotNet Protector changes names for all symbols that are inaccessible outside assembly (internal, private).

Integral Obfuscation

In the case of a program (.exe) which does not have has to be referred by others assemblies the obfuscation can also apply to public symbols.

This integral obfuscation is enabled by checking 'obfuscate public names'.

Advanced Protection

The goal here is to obfuscate method bodies. This advanced protection complements obfuscation, it can even be compatible with third party obfuscators.

When advanced protection is enabled, all methods have the same body : throw new ApplicationException

All methods are then encrypted an decrypted at run time. Once compiled, a méthod encrypted again. Thus your assembly is never completely decrypted (unless your assembly has only one method).

Advanced protection requires dotNet Protector runtime to run your assembly. Without the runtime, encrypted version of methods will run (ApplicationException).

Embedded Runtime

Programs (.exe) protection can be achieved at an additional level by embedding dotNet Protector's runtime. The generated exe is then a mixed assembly (contains at the same time native code and managed code). The assembly protected according to the method of advanced protection, with or without obfuscation is transformed into a netmodule and is also emedded in the generated exe. During execution, the protected module is loaded in memory and run. This option exempts to you to deploy dotNet Protector's runtime, since it is included in the protected exe.


PvLogiciels.dotNetProtectorHierarchy

Reverse Engineering Prevention

dotNet Protector project types

Windows EXE

This project type is suitable to protect a Windows executable(console, gui, service).

This is the more featured project type:

- Conventional Obfuscation

- Integral Obfuscation

- Advanced Protection

- Embedded Runtime

- You can also embed referenced dlls

This project type is available in all dotNet Protector editions.

Windows DLL

This project is suitable for a dll (.Net clesses or componets library), or ASP.NET application

Conventional obfuscation and advanced protection are available in this project type.

This project type is not available in dotNet Protector 'classic' edition.

SQL Assembly

This type protects a SQL Server assembly.

Conventional obfuscation and advanced protection are available in this project type.

Only the 'advanced' eddition can protect SQL assemblies.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector documentation

Copy Protection

The purpose of reverse engineering prevention is to make more difficult the piracy of technologies by code analysis. It does not prevent the copy of your programs and components.

If conventional obfuscation can appear effective against reverse enigeering, they are practically inoperative regarding licensing.

dotNet Protector, thanks to its advanced protection technology, offers to you much more than the reverse engineering prevention. dotNet Protector's runtime includes hardware recognition mechanisms, hash codes generation, pki encoding, all implemented in native code.

Activation system functioning

Activation Applications

Licenses format and location


PvLogiciels.dotNetProtectorHierarchy

Copy Protection

Functioning

dotNet Protector activation system is implemented around an infrastructure with public/private keys.

Operations which must be carried out at your customer (during program execution, licence request) use your public key, which is embedded in your assembly.

Operations which must be carried out on your premise (product key and licence generation) imply your private key contained in the dotNet Protector's key set.

IMPORTANT : Your key set must remain private. You should never include it in a program you distribute to your customers. Customer side, you must always use the static methods of ActivationManager (do not require keyset); dotNet Protector is given the responsability to record the public key in the assembly and the runtime is given the responsability to find it.

If you lose your key set , nobody (not even PV Logiciels) will be able to distribute licences to your customers. You will have to protect all your applications again with a new keyset, recompile your tools for licences and product keys generation, redeploy your applications and regenerate the licences.

When you enable hardware lock, every method body is encrypted, but the decryption key isn’t stored into the protected assembly. dotNet Protector’s runtime needs a license key to decrypt method bodies.

Hardware locking-unlocking is a 3 steps process:

1. You protect your assembly with hardware lock enabled. Bodies are encrypted, only your public key is stored in the protected assembly – no decryption key.

2. Your activation assistant, protected with dotNet Protector builds a ‘hardware configuration’ from the hardware where it runs. This ‘hardware configuration’ is encrypted with your public key (stored by dotNet Protector into your assistant).

3. Your license generator (activation server) decrypts the ‘hardware config’ and builds a license key. The license generator runs on your side, and embeds your private key, allowing ‘hardware config’ decryption and license key encryption.

When your assembly runs, dotNet Protector Runtime looks for the license key, decrypts it with your public key and tries to decrypt bodies .

dotNet Protector stores symmetric and public/private key pairs (there are more than one) in a key set. The keyset is built the first time you run dotNet Protector, with help from a cryptographic random generator (there is minimal likelihood the same keyset is produced twice).

Since pki is strongly involved in activation process, this is mandatory that your assembly and your activation assistant are protected with the same keyset. Your license generator will use the private part of this keyset to build licenses .

See also

Activation system, samples and guide


PvLogiciels.dotNetProtectorHierarchy

Copy Protection

Applications

Application (EXE) activation

dotNet Protector can protect your programs against illegal copy.

If no valid license can be granted, your program can

- throw exception (ApplicationException)

- launch an activation wizard

- run in limited mode

ASP.NET applications Activation

Your ASP.NET web services and applications can also benefit from dotNet Protector copy protection system.

You can grant a license for the server hardware running your application.

If no valid license is present, your application will throw an exception (ApplicationException)

Component Activation(clesses / control libraries)

dotNet Protector proposes two license management modes for components. You can decide to request a royalty each time your component is deployed or not.

Activate to reference : a valid license is required to compile an application consuming your component.

Activate to run : a valid license is required on each computer where your component will run.

SQL Assemblies Activation

Your SQL Server assemblies can benefit from dotNet Protector copy protection system, in the same way as for ASP.NET applications.

You can grant a license for the server hardware running your application.

If no valid license is present, your application will throw an exception (ApplicationException).


PvLogiciels.dotNetProtectorHierarchy

Copy Protection

Licenses

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


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector documentation

User Guide

This guide describes usual functions of dotNet Protector.

Le Program, environment and command-line

Les Menus

Les Tabs

Activate dotNet Protector

Import / export license and keyset files


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide

Program

dotNetProtectorEnv.exe

This program starts dotNet Protector in environment mode. Permits projects edition and building.

This program runs without argument, or with a project file path as argument.

dotNetProtectorConsole.exe

This program starts dotNet Protector in generator mode. Permits command-line project building.

To build a project from command-line, run dotNetProtectorConsole -p projet

dotNetProtectorEngine.dll

This is dotNet Protector engine. It contains a project editor and a project builder. Previous programs just instanciate engine classes and invoke its methods.

Side-by-side Exécution

You can run several minor versions of dotNet Protector on the same computer. You just need to copy dotNet Protector's application directory. License and keyset are in a centralized location(\programdata\pvlogiciels\dotNet Protector 5 or \programdata\pvlogiciels\dotNet Protector 5 x64)


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide

Menus

File Menu

New

Create a new project file

Open

Open an existing project file

Save Project

Save the current project

Save Project As

Saves a copy of the current project

Tools Menu

Build project

Launch protection with the current project parameters.

Activate dotNet Protector

Launch dotNet Protector activation wizard. After installation, dotNet Protector works in demonstration mode (all generated assemblies will have a 5 days execution limit).

If you acquired a licence for dotNet Protector, you will have to activate it (see the Activation section).

The product key you will enter during activation will determine available features (dotNet Protector Edition : Classic, Professional or Advanced).

Re-check License

If your copy of dotNet Protector is activated, but the title bar indicates (locked), this means that dotNet Protector does not recognize any more the hardware associated with your license. This option makes it possible to start again the verification.

Import /Export License File

Allows to save / restore your licence file If you must reinstall your computer, save your licence file before un-installation; you will then be able to re-import and avoid activating once again. This option will work only if the material on which the license is imported is the same one as that on which it was exported.

This option is also useful if you chose the USB Key activation. You can then export to import your license file after activation, and import it on all the computers where you wish to run dotNet Protector (dotNet Protector will run only if the activated key USB is present).

This option is valid also for the ‘instant activation’ mode. In this mode, a license token is requested from each run of dotNet Protector. This token is associated with the computer that requested it. Computer-token association is deleted every 24h, which enables you to change computer each day. You must have access to Internet to run dotNet Protector in this mode.

De-Activate dotNet Protector

Remove the license file and erases the hardware hash on our activation servers. This option will enable you to activate another computer (hardware change). A de-activation key will be required; this key is not your product key. If you did not receive the de-activation key during activation or if you lost it, your license file will be removed, but hardware association will remain on our activation servers; you will not be able to activate another computer. If this case were to arrive, send an email to dotnetprotector@pvlog.com by specifying your license number; we will then do the de-activation manually.

Import Keyset

dotNet Protector activation process uses public/private key pairs and a symmetrical key. The key set contains all these keys. If you do not use the activation features (hardware lock) the key set is not fundamental. If on the contrary you activate this functionality, you must make sure that your program is protected with the same key set as your tool that delivers the licenses. The key set determines the encoding of product keys, configuration strings and license keys. It guarantees to you that one will not be able to generate product keys licenses, unless one has your private keys. Of course, the protected program only embeds the public keys. A key set is generated during the first dotNet Protector run. The generation of this key set relies on a cryptographic random generator to have the best uniqueness garantee.

Export Keyset

Allows you to save your key set.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide

Tabs

This section describes dotNet Protector Environment Tabs.

Project Tab

Protection Tab

Hardware Lock Tab

Embedding Tab

Generate Tab


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide - Tabs

Project Tab

Project Type

Allows choosing the type of assembly to protect (Windows EXE, Windows DLL - or ASP.Net, SQL 2005)

Assembly to protected

Chose your assembly using the Browse button

Strong name

If your assembly is signed, you must select the snk file to resign it after protection

Output window

Protection progress will show up in this window


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide - Tabs

Protection Tab

Use advanced protection (IL obfuscation)

Activate protection by methods encryption

Obfuscate names

Activate the ‘traditional’ obfuscation

Obfuscate public names

For Exe only, allows to obfuscate all the names.

Demo Limit

Sets the execution limit of your program (demonstration). The limit starts the date you generate the protected assembly and not it’s installation date. Note: when dotNet Protector runs in demo mode, your assembly will be limited to 5 days anyway.

Run-time Limit

Sets the run-time limit of your program (Exe only). The process will be killed when this period expires.

Limited execution Mode

Sets what will happen when the demo period expires (if no license can be granted)

Throw ApplicationException (default) : an ApplicationException will be thrown, killing the process.

Load Assembly by name : this allows you to tell an alternate assembly to load. You’ll be invited to browse an assembly to run, then its full name will be recorded in the protected assembly. It is highly recommended to select a strong name assembly.

Load embedded Assembly : you’ll have to browse for the alternate assembly to run; this assembly will be embedded in the final executable.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide - Tabs

Hardware Lock Tab

Enable Hardware Lock

If this box is checked, you’ll have to generate a license to run your program (Activation)

Allow USB Activation

Allows activation by using a USB storage key instead of a computer hardware.

Component activation mode (Dll only)

Activate to run always : a license is required to run your component.

Activate to reference : a license is required to reference your component in another program. No license is required at runtime.

Activate to reference and run ASP.Net : a license is required to reference your component in a Windows application. A runtime license is required to run in ASP.Net


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide - Tabs

Embedding Tab (EXE only)

Add : allows to add an assembly (a referenced Dll) into the final executable.

Add Dep : adds all referenced assemblies that are present on the same location as the main assembly.

Remove : removes an embedded Dll from the list.

Auto add dependencies at build time : when dotNet Protector builds the project, it looks for referenced assemblies and adds all of them that are present in the same location as the main assembly. This option gives you no control on which assemblies are embedded or not. It is better to add referenced assembly in the project than to check this box.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide - Tabs

Generate Tab

Destination directory

Let you select the output location. If you decide to embed dotNet Protector’s runtime (EXE project) additional directory will be created to separate different processor architectures (x86, amd64, Itanium).

Merge runtime with executable

Lets you build an EXE without dotNet Protector’s runtime dependency. The generated exe is then a mixed (native + managed) exe embedding the runtime. If your program is a v1.1 assembly, it will be converted to v2 to embed the runtime, which can cause som compatibility issues if your assembly can’t run on the v2.

When you select this option, your assembly is converted to an embedded netmodule. The final exe is then a multi-modules mixed assembly. Don’t forget that Assembly.GetExecutingAssembly.ManifestModule will give you dotNet Protector’s runtime module. Your assembly’s properties (name, version, assembly custom attributes) will be transferred to the generated assembly, as well as manifest resources. Then, GetManifestResourceStream should have the desired result.

Build Trace decoding informations

dotNet Protector strips all debug informations before protecting assembly. Original pdb files would be incompatible with the protected assembly anyway. If pdb are available in the same location of an assembly to protect, dotNet Protector can build a file allowing obfuscated StackTrace decoding.

Build Project button

Runs protection with current project parameters.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide

Activating dotNet Protector

Launch activation wizard from the tools menu

Click Start

Enter your product key and click Next

Your dotNet Protector edition and license number are displayed

Choose your activation method

- Computer Activation : you'll be able to run dotNet Protector on this computer only.

- Instant Activation : you activate your computer for 24 h.

dotNet Protector will refresh its key each time it runs.

You can run on a different computer every day (0h00 AM GMT to 11h59 PM GMT)

- USB stick activation. You'll be able to export your license file and import it on another computer

License file is attached to your USB stick, not your computer

Usb stick must be attached to run dotNet Protector

USB Activation case

USB dectector finds device by difference.

Start detection without the device; current configuration is recorded.

attach the device, be sure windows finished its job (looking for images, autoexec...) and click 'Find device'

Current configuration is compared with the recorded one to select to device to activate

If a device is found, manufacturer and peripheral name are displayed

(names are somtimes generic ones - USB, USB Mass Storage...)

In all cases: Server connection to get a license key

Server Response

An e-mail will be sent to the mail address entered when buying dotNet Protector.

This mail contains a key needed to de-activate dotNet Protector, in case you wish to change your activation mode or your hardware.

Once de-activated, you'll have to wait 64 days before your can activate the same hardware again.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector User Guide

Import / Export

Import/export a license file

If you activated dotNet Protector for USB stick instant activation, several computers will share the same license file.

You should then export the license file from the computer you activated dotNet Protector, and import it on other computers where you want to use dotNet Protector.

NOTE: in the USB activation case, you can use dotNet Protector on every computer evrey time, as long as the activated usb device remains attached.

In the instant activation case a computer running dotNet Protector acquires a 'license token' for one day. No other computer could get a token for the same license on the same day.

Import/export a keyset

Key set is implied in hardware lock mechanism, when you implement programs and components activation.

Your protected assemblies will embed the public part of your keyset. Private part will be used by you to build product keys and licenses.

If you loose your keyset, you'll be unable to produce licenses for your products.

It is of primary importance to export your key set make a backup of it.

If you must reinstall dotNet Protector, or use dotNet Protector on several computers, you will be able to import the exported keyset.


PvLogiciels.dotNetProtector

dotNet Protector API

PvLogiciels.dotNetProtector Namespace

Namespace hierarchy

Classes

Class | Description
ActivationManager | This class handles Activation.
ActivationManager.ActivationRequest | This class stores hardware abd software configuration details.
Runtime | This class is the main Runtime class. Most of its members are directly used by the runtime itself. Only methods you can call in your code are documented.
UsbDetector | This is a helper class for USB activation


ActivationManager Class

This class handles Activation.

For a list of all members of this type, see ActivationManager Members.

System.Object
ActivationManager

[Visual Basic]
Public Class ActivationManager
[C#]
public class ActivationManager

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: PvLogiciels.dotNetProtector

Assembly: PvLogiciels.dotNetProtector.Runtime (in PvLogiciels.dotNetProtector.Runtime.dll)

See Also

ActivationManager Members | PvLogiciels.dotNetProtector Namespace


ActivationManager Members

ActivationManager overview

Public Static (Shared) Methods

ConfigStringChecksumIsOk | Checks if a config string is well formed. Prevents typing errors, but doesn't check full validity.
DaysLeft | Gets the days left in the demo period
EncodeActivationRequest | Builds an ActivationString from an ActivationRequest.
GetConfig | Overloaded. Builds an ActivationString from Current Hardware Config and software given by AssemblyFile.
GetLicenseId | Retrieves the License Id from a product key.
GetProductID | Gets the product id (the 32 bit number used to build the product key)
GetUsbConfig | Overloaded. Builds an ActivationString from Current Usb Config and software given by AssemblyFile.
IsDemo | Checks if running in trial mode.
LicenseKeyChecksumIsOk | Checks if a license key string is well formed. Prevents typing errors, but doesn't check full validity.
MinutesLeft | Gets the number of minutes left to run.
ProductKeyChecksumIsOk | Checks if a product key string is well formed. Prevents typing errors, but doesn't check full validity.
SameSoftware | Overloaded. Checks if software designated by soft and config are the same

Public Instance Constructors

ActivationManager Constructor Instance Constructor. Creates a new manager, given a key set

Public Instance Methods

DecodeActivationString | Decodes an ActivationString, giving an ActivationRequest.
GenerateLicense | Overloaded. Builds a license key from ActivationRequest
GenerateUsbLicense | Overloaded. Builds a license key from ActivationRequest
GenProductKey | Builds an encoded product key (5x5 chars) from a 32 bits License ID
HardwareScore | Compares 2 configs for hardware difference configs are given by PvLogiciels.Extentions.GetConfig() or by an ActivationRequest's config member
SameSoftware | Overloaded. Checks if software designated by asmname and config are the same

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager Constructor

Instance Constructor. Creates a new manager, given a key set

[Visual Basic]
Public Sub New( _
ByVal keys As Byte() _
)
[C#]
public ActivationManager(
byte[] keys
);

Parameters

keys
Key Set (dotNetProtector.keyset) in byte array form

Remarks

The key set must be wich one was used when protectin the assembly

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager Methods

The methods of the ActivationManager class are listed below. For a complete list of ActivationManager class members, see the ActivationManager Members topic.

Public Static (Shared) Methods

ConfigStringChecksumIsOk | Checks if a config string is well formed. Prevents typing errors, but doesn't check full validity.
DaysLeft | Gets the days left in the demo period
EncodeActivationRequest | Builds an ActivationString from an ActivationRequest.
GetConfig | Overloaded. Builds an ActivationString from Current Hardware Config and software given by AssemblyFile.
GetLicenseId | Retrieves the License Id from a product key.
GetProductID | Gets the product id (the 32 bit number used to build the product key)
GetUsbConfig | Overloaded. Builds an ActivationString from Current Usb Config and software given by AssemblyFile.
IsDemo | Checks if running in trial mode.
LicenseKeyChecksumIsOk | Checks if a license key string is well formed. Prevents typing errors, but doesn't check full validity.
MinutesLeft | Gets the number of minutes left to run.
ProductKeyChecksumIsOk | Checks if a product key string is well formed. Prevents typing errors, but doesn't check full validity.
SameSoftware | Overloaded. Checks if software designated by soft and config are the same

Public Instance Methods

DecodeActivationString | Decodes an ActivationString, giving an ActivationRequest.
GenerateLicense | Overloaded. Builds a license key from ActivationRequest
GenerateUsbLicense | Overloaded. Builds a license key from ActivationRequest
GenProductKey | Builds an encoded product key (5x5 chars) from a 32 bits License ID
HardwareScore | Compares 2 configs for hardware difference configs are given by PvLogiciels.Extentions.GetConfig() or by an ActivationRequest's config member
SameSoftware | Overloaded. Checks if software designated by asmname and config are the same

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ConfigStringChecksumIsOk Method

Checks if a config string is well formed. Prevents typing errors, but doesn't check full validity.

[Visual Basic]
Public Shared Function ConfigStringChecksumIsOk( _
ByVal ActivationString As String _
) As Boolean
[C#]
public static bool ConfigStringChecksumIsOk(
string ActivationString
);

Parameters

ActivationString

Return Value

true if checksum is correct.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.DaysLeft Method

Gets the days left in the demo period

[Visual Basic]
Public Shared Function DaysLeft() As Integer
[C#]
public static int DaysLeft();

Return Value

The number of days left, -1 if trial period disabled.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.DecodeActivationString Method

Decodes an ActivationString, giving an ActivationRequest.

[Visual Basic]
Public Function DecodeActivationString( _
ByVal ActivationString As String _
) As ActivationRequest
[C#]
public ActivationRequest DecodeActivationString(
string ActivationString
);

Parameters

ActivationString
string given by dotNetProtector.Extensions.ActivationString Methods

Return Value

Decoded ActivationRequest

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.EncodeActivationRequest Method

Builds an ActivationString from an ActivationRequest.

[Visual Basic]
Public Shared Function EncodeActivationRequest( _
ByVal req As ActivationRequest _
) As String
[C#]
public static string EncodeActivationRequest(
ActivationRequest req
);

Parameters

req
ActivationRequest

Return Value

Encoded ActivationString

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


GenerateLicense Method

dotNet Protector API

ActivationManager.GenerateLicense Method

Builds a license key from ActivationRequest

Overload List

Builds a license key from ActivationRequest

public string GenerateLicense(ActivationRequest);

Builds a license key from ActivationRequest

public string GenerateLicense(ActivationRequest,int,bool,long);

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.GenerateLicense Method (ActivationRequest)

Builds a license key from ActivationRequest

[Visual Basic]
Overloads Public Function GenerateLicense( _
ByVal req As ActivationRequest _
) As String
[C#]
public string GenerateLicense(
ActivationRequest req
);

Parameters

req
ActivationRequest

Return Value

9x6 encoded license string

Remarks

The default tolerance(3) is used, IgnoreMinor is true, RuntimeLicenseLimit=0(no limit)

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GenerateLicense Overload List


ActivationManager.GenerateLicense Method (ActivationRequest, Int32, Boolean, Int64)

Builds a license key from ActivationRequest

[Visual Basic]
Overloads Public Function GenerateLicense( _
ByVal req As ActivationRequest, _
ByVal tolerance As Integer, _
ByVal ignoreMinor As Boolean, _
ByVal RuntimeLicensesLimit As Long _
) As String
[C#]
public string GenerateLicense(
ActivationRequest req,
int tolerance,
bool ignoreMinor,
long RuntimeLicensesLimit
);

Parameters

req
ActivationRequest
tolerance
number (0-7) of accepted hardware differences
ignoreMinor
true Minor sofware version should be ignored
RuntimeLicensesLimit
Limits Runtime generated licenses (FileTime format) Usefull only when a licenced component should build a runtime licence 0 : a runtime license with no limit will be generated other value : limit date converted to FileTime format

Return Value

9x6 encoded license string

Remarks

A special value of 8 can be set for tolerance. This means don't take care of hardware. This special value can be used to built trial licenses limited by time only.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GenerateLicense Overload List


GenerateUsbLicense Method

dotNet Protector API

ActivationManager.GenerateUsbLicense Method

Builds a license key from ActivationRequest

Overload List

Builds a license key from ActivationRequest

public string GenerateUsbLicense(ActivationRequest);

Builds a license key from ActivationRequest

public string GenerateUsbLicense(ActivationRequest,int,bool,long);

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.GenerateUsbLicense Method (ActivationRequest)

Builds a license key from ActivationRequest

[Visual Basic]
Overloads Public Function GenerateUsbLicense( _
ByVal req As ActivationRequest _
) As String
[C#]
public string GenerateUsbLicense(
ActivationRequest req
);

Parameters

req
ActivationRequest

Return Value

9x6 encoded license string

Remarks

The default tolerance(0) is used, IgnoreMinor is true, RuntimeLicenseLimit=0(no limit)

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GenerateUsbLicense Overload List


ActivationManager.GenerateUsbLicense Method (ActivationRequest, Int32, Boolean, Int64)

Builds a license key from ActivationRequest

[Visual Basic]
Overloads Public Function GenerateUsbLicense( _
ByVal req As ActivationRequest, _
ByVal tolerance As Integer, _
ByVal ignoreMinor As Boolean, _
ByVal RuntimeLicensesLimit As Long _
) As String
[C#]
public string GenerateUsbLicense(
ActivationRequest req,
int tolerance,
bool ignoreMinor,
long RuntimeLicensesLimit
);

Parameters

req
ActivationRequest
tolerance
number (0-7) of accepted hardware differences
ignoreMinor
true Minor sofware version should be ignored
RuntimeLicensesLimit
Limits Runtime generated licenses (FileTime format) Usefull only when a licenced component should build a runtime licence 0 : a runtime license with no limit will be generated other value : limit date converted to FileTime format

Return Value

9x6 encoded license string

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GenerateUsbLicense Overload List


ActivationManager.GenProductKey Method

Builds an encoded product key (5x5 chars) from a 32 bits License ID

[Visual Basic]
Public Function GenProductKey( _
ByVal LicenceID As UInt32 _
) As String
[C#]
public string GenProductKey(
uint LicenceID
);

Parameters

LicenceID
License ID.Upper 16 bits are ignored

Return Value

the 5x5 Product Key

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


GetConfig Method

dotNet Protector API

ActivationManager.GetConfig Method

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

Overload List

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

public static string GetConfig(uint,ushort);

Builds an ActivationString from Current Hardware Config and software given by AssemblyFile.

public static string GetConfig(uint,ushort,string);

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.GetConfig Method (UInt32, UInt16)

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

[Visual Basic]
Overloads Public Shared Function GetConfig( _
ByVal LicenseID As UInt32, _
ByVal ActivationDuration As UInt16 _
) As String
[C#]
public static string GetConfig(
uint LicenseID,
ushort ActivationDuration
);

Parameters

LicenseID
32 bit number to identify license.
ActivationDuration
Validity of activation (in days). 0 means infinite, maximum value is 2000

Return Value

A secure config string.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GetConfig Overload List


ActivationManager.GetConfig Method (UInt32, UInt16, String)

Builds an ActivationString from Current Hardware Config and software given by AssemblyFile.

[Visual Basic]
Overloads Public Shared Function GetConfig( _
ByVal LicenseID As UInt32, _
ByVal ActivationDuration As UInt16, _
ByVal AssemblyFile As String _
) As String
[C#]
public static string GetConfig(
uint LicenseID,
ushort ActivationDuration,
string AssemblyFile
);

Parameters

LicenseID
32 bit number to identify license.
ActivationDuration
Validity of activation (in days). 0 means infinite, maximum value is 2000
AssemblyFile
Assembly to build the config for

Return Value

A secure config string.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GetConfig Overload List


ActivationManager.GetLicenseId Method

Retrieves the License Id from a product key.

[Visual Basic]
Public Shared Function GetLicenseId( _
ByVal ProductKey As String _
) As UInt32
[C#]
public static uint GetLicenseId(
string ProductKey
);

Parameters

ProductKey
5x5 Product Key

Return Value

License ID

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.GetProductID Method

Gets the product id (the 32 bit number used to build the product key)

[Visual Basic]
Public Shared Function GetProductID() As UInt32
[C#]
public static uint GetProductID();

Return Value

the product id, or 0 if none.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


GetUsbConfig Method

dotNet Protector API

ActivationManager.GetUsbConfig Method

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

Overload List

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

public static string GetUsbConfig(uint,ushort,ulong,ulong);

Builds an ActivationString from Current Usb Config and software given by AssemblyFile.

public static string GetUsbConfig(uint,ushort,ulong,ulong,string);

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.GetUsbConfig Method (UInt32, UInt16, UInt64, UInt64)

Builds an ActivationString from Current Hardware Config and software given by calling assembly.

[Visual Basic]
Overloads Public Shared Function GetUsbConfig( _
ByVal LicenseID As UInt32, _
ByVal ActivationDuration As UInt16, _
ByVal UsbHash As UInt64, _
ByVal UsbIdentity As UInt64 _
) As String
[C#]
public static string GetUsbConfig(
uint LicenseID,
ushort ActivationDuration,
ulong UsbHash,
ulong UsbIdentity
);

Parameters

LicenseID
32 bit number to identify license.
ActivationDuration
Validity of activation (in days). 0 means infinite, maximum value is 2000
UsbHash
UsbHash given by UsbDetector
UsbIdentity
UsbIdentity given by UsbDetector

Return Value

A secure config string for USB activation.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GetUsbConfig Overload List


ActivationManager.GetUsbConfig Method (UInt32, UInt16, UInt64, UInt64, String)

Builds an ActivationString from Current Usb Config and software given by AssemblyFile.

[Visual Basic]
Overloads Public Shared Function GetUsbConfig( _
ByVal LicenseID As UInt32, _
ByVal ActivationDuration As UInt16, _
ByVal UsbHash As UInt64, _
ByVal UsbIdentity As UInt64, _
ByVal AssemblyFile As String _
) As String
[C#]
public static string GetUsbConfig(
uint LicenseID,
ushort ActivationDuration,
ulong UsbHash,
ulong UsbIdentity,
string AssemblyFile
);

Parameters

LicenseID
32 bit number to identify license.
ActivationDuration
Validity of activation (in days). 0 means infinite, maximum value is 2000
UsbHash
UsbHash given by UsbDetector
UsbIdentity
UsbIdentity given by UsbDetector
AssemblyFile
Assembly to build the config for

Return Value

A secure config string for USB activation.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.GetUsbConfig Overload List


ActivationManager.HardwareScore Method

Compares 2 configs for hardware difference configs are given by PvLogiciels.Extentions.GetConfig() or by an ActivationRequest's config member

[Visual Basic]
Public Function HardwareScore( _
ByVal HwConfig1 As UInt64, _
ByVal HwConfig2 As UInt64 _
) As Integer
[C#]
public int HardwareScore(
ulong HwConfig1,
ulong HwConfig2
);

Parameters

HwConfig1
HwConfig2

Return Value

Hardware score. Allow activation if under tolerance

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.IsDemo Method

Checks if running in trial mode.

[Visual Basic]
Public Shared Function IsDemo() As Boolean
[C#]
public static bool IsDemo();

Return Value

true if trial.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.LicenseKeyChecksumIsOk Method

Checks if a license key string is well formed. Prevents typing errors, but doesn't check full validity.

[Visual Basic]
Public Shared Function LicenseKeyChecksumIsOk( _
ByVal LicenceString As String _
) As Boolean
[C#]
public static bool LicenseKeyChecksumIsOk(
string LicenceString
);

Parameters

LicenceString

Return Value

true if checksum is correct.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.MinutesLeft Method

Gets the number of minutes left to run.

[Visual Basic]
Public Shared Function MinutesLeft() As Integer
[C#]
public static int MinutesLeft();

Return Value

The number of minutes left, -1 if runtime-limit disabled.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ProductKeyChecksumIsOk Method

Checks if a product key string is well formed. Prevents typing errors, but doesn't check full validity.

[Visual Basic]
Public Shared Function ProductKeyChecksumIsOk( _
ByVal ProductKey As String _
) As Boolean
[C#]
public static bool ProductKeyChecksumIsOk(
string ProductKey
);

Parameters

ProductKey
The productkey string to check

Return Value

true if checksum is correct.

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


SameSoftware Method

dotNet Protector API

ActivationManager.SameSoftware Method

Checks if software designated by asmname and config are the same

Overload List

Checks if software designated by asmname and config are the same

public bool SameSoftware(AssemblyName,ulong);

Checks if software designated by soft and config are the same

public static bool SameSoftware(string,ulong);

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.SameSoftware Method (AssemblyName, UInt64)

Checks if software designated by asmname and config are the same

[Visual Basic]
Overloads Public Function SameSoftware( _
ByVal asmname As AssemblyName, _
ByVal SwMajor As UInt64 _
) As Boolean
[C#]
public bool SameSoftware(
AssemblyName asmname,
ulong SwMajor
);

Parameters

asmname
System.Reflection.AssemblyName from assembly to check
SwMajor

Return Value

true if same

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.SameSoftware Overload List


ActivationManager.SameSoftware Method (String, UInt64)

Checks if software designated by soft and config are the same

[Visual Basic]
Overloads Public Shared Function SameSoftware( _
ByVal soft As String, _
ByVal SwMajor As UInt64 _
) As Boolean
[C#]
public static bool SameSoftware(
string soft,
ulong SwMajor
);

Parameters

soft
software under the form Assembly,Major
SwMajor

Return Value

true if same

See Also

ActivationManager Class | PvLogiciels.dotNetProtector Namespace | ActivationManager.SameSoftware Overload List


ActivationManager.ActivationRequest Class

This class stores hardware abd software configuration details.

For a list of all members of this type, see ActivationManager.ActivationRequest Members.

System.Object
ActivationManager.ActivationRequest

[Visual Basic]
Public Class ActivationManager.ActivationRequest
[C#]
public class ActivationManager.ActivationRequest

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: PvLogiciels.dotNetProtector

Assembly: PvLogiciels.dotNetProtector.Runtime (in PvLogiciels.dotNetProtector.Runtime.dll)

See Also

ActivationManager.ActivationRequest Members | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest Members

ActivationManager.ActivationRequest overview

Public Instance Constructors

ActivationManager.ActivationRequest Constructor

Public Instance Fields

ActivationDuration | Duration requested for Activation
HwConfig | Machine config extracted from ActivationString
Identity | 64 bits generated Identity.
LicenceID | License ID. Meaningfull only with a dotNetProtector or activation component Generated product key
SwMajor | Software config generated from Assembly and Major version
SwMinor | Software Minor version

Public Instance Properties

Instant | Gets/Sets the InstantActivation flag.
Usb | Gets/Sets the Usb activation flag.

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest Constructor

[Visual Basic]
Public Sub New()
[C#]
public ActivationManager.ActivationRequest();

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest Fields

The fields of the ActivationManager.ActivationRequest class are listed below. For a complete list of ActivationManager.ActivationRequest class members, see the ActivationManager.ActivationRequest Members topic.

Public Instance Fields

ActivationDuration | Duration requested for Activation
HwConfig | Machine config extracted from ActivationString
Identity | 64 bits generated Identity.
LicenceID | License ID. Meaningfull only with a dotNetProtector or activation component Generated product key
SwMajor | Software config generated from Assembly and Major version
SwMinor | Software Minor version

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.ActivationDuration Field

Duration requested for Activation

[Visual Basic]
Public ActivationDuration As UInt16
[C#]
public ushort ActivationDuration;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.HwConfig Field

Machine config extracted from ActivationString

[Visual Basic]
Public HwConfig As UInt64
[C#]
public ulong HwConfig;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.Identity Field

64 bits generated Identity.

[Visual Basic]
Public Identity As UInt64
[C#]
public ulong Identity;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.LicenceID Field

License ID. Meaningfull only with a dotNetProtector or activation component Generated product key

[Visual Basic]
Public LicenceID As UInt32
[C#]
public uint LicenceID;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.SwMajor Field

Software config generated from Assembly and Major version

[Visual Basic]
Public SwMajor As UInt64
[C#]
public ulong SwMajor;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.SwMinor Field

Software Minor version

[Visual Basic]
Public SwMinor As UInt16
[C#]
public ushort SwMinor;

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest Properties

The properties of the ActivationManager.ActivationRequest class are listed below. For a complete list of ActivationManager.ActivationRequest class members, see the ActivationManager.ActivationRequest Members topic.

Public Instance Properties

Instant | Reserved for future use. Gets/Sets the InstantActivation flag.
Usb | Gets/Sets the Usb activation flag.

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.Instant Property

Reserved for future use.
Gets/Sets the InstantActivation flag.

[Visual Basic]
Public Property Instant As Boolean
[C#]
public bool Instant {get; set;}

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


ActivationManager.ActivationRequest.Usb Property

Gets/Sets the Usb activation flag.

[Visual Basic]
Public Property Usb As Boolean
[C#]
public bool Usb {get; set;}

See Also

ActivationManager.ActivationRequest Class | PvLogiciels.dotNetProtector Namespace


Runtime Class

This class is the main Runtime class. Most of its members are directly used by the runtime itself. Only methods you can call in your code are documented.

For a list of all members of this type, see Runtime Members.

System.Object
Runtime

[Visual Basic]
Public Class Runtime
[C#]
public class Runtime

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: PvLogiciels.dotNetProtector

Assembly: PvLogiciels.dotNetProtector.Runtime (in PvLogiciels.dotNetProtector.Runtime.dll)

See Also

Runtime Members | PvLogiciels.dotNetProtector Namespace


Runtime Members

Runtime overview

Public Static (Shared) Methods

EncodeTrace Overloaded. Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

See Also

Runtime Class | PvLogiciels.dotNetProtector Namespace


Runtime Methods

The methods of the Runtime class are listed below. For a complete list of Runtime class members, see the Runtime Members topic.

Public Static (Shared) Methods

EncodeTrace Overloaded. Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

See Also

Runtime Class | PvLogiciels.dotNetProtector Namespace


EncodeTrace Method

dotNet Protector API

Runtime.EncodeTrace Method

Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

Overload List

Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

public static string EncodeTrace(StackTrace);

Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

public static string EncodeTrace(Exception);

See Also

Runtime Class | PvLogiciels.dotNetProtector Namespace


Runtime.EncodeTrace Method (StackTrace)

Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

[Visual Basic]
Overloads Public Shared Function EncodeTrace( _
ByVal trace As StackTrace _
) As String
[C#]
public static string EncodeTrace(
StackTrace trace
);

Parameters

trace
Stack Trace to be encoded

Return Value

The encoded stack trace.

See Also

Runtime Class | PvLogiciels.dotNetProtector Namespace | Runtime.EncodeTrace Overload List


Runtime.EncodeTrace Method (Exception)

Trace Encoder. Encodes a StrackTrace in a way it can be decoded with the matching traceinfo.

[Visual Basic]
Overloads Public Shared Function EncodeTrace( _
ByVal Ex As Exception _
) As String
[C#]
public static string EncodeTrace(
Exception Ex
);

Parameters

Ex
Exception from which the Stack Trace should be encoded

Return Value

The encoded stack trace.

See Also

Runtime Class | PvLogiciels.dotNetProtector Namespace | Runtime.EncodeTrace Overload List


UsbDetector Class

This is a helper class for USB activation

For a list of all members of this type, see UsbDetector Members.

System.Object
UsbDetector

[Visual Basic]
Public Class UsbDetector
[C#]
public class UsbDetector

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Requirements

Namespace: PvLogiciels.dotNetProtector

Assembly: PvLogiciels.dotNetProtector.Runtime (in PvLogiciels.dotNetProtector.Runtime.dll)

See Also

UsbDetector Members | PvLogiciels.dotNetProtector Namespace


UsbDetector Members

UsbDetector overview

Public Instance Constructors

UsbDetector Constructor Starts a new detection. All present devices are recorded, detection will be done by difference. The device to detect should be unplugged before calling the constructor.

Public Instance Properties

FoundDevice | Gets the found device friendly name. returns an empty string if no device found.
UsbHash | Gets the UsbHash value for the found device.
UsbIdentity | Gets the UsbIdentity value for the found device.

Public Instance Methods

Detect Finds suitable usb devices by difference. Devices not present when contructor was called are examined to check if they can be used for activation. The fist one that complies activation is selected as 'Found device'.

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector Constructor

Starts a new detection. All present devices are recorded, detection will be done by difference. The device to detect should be unplugged before calling the constructor.

[Visual Basic]
Public Sub New()
[C#]
public UsbDetector();

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector Properties

The properties of the UsbDetector class are listed below. For a complete list of UsbDetector class members, see the UsbDetector Members topic.

Public Instance Properties

FoundDevice | Gets the found device friendly name. returns an empty string if no device found.
UsbHash | Gets the UsbHash value for the found device.
UsbIdentity | Gets the UsbIdentity value for the found device.

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector.FoundDevice Property

Gets the found device friendly name. returns an empty string if no device found.

[Visual Basic]
Public ReadOnly Property FoundDevice As String
[C#]
public string FoundDevice {get;}

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector.UsbHash Property

Gets the UsbHash value for the found device.

[Visual Basic]
Public ReadOnly Property UsbHash As UInt64
[C#]
public ulong UsbHash {get;}

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector.UsbIdentity Property

Gets the UsbIdentity value for the found device.

[Visual Basic]
Public ReadOnly Property UsbIdentity As UInt64
[C#]
public ulong UsbIdentity {get;}

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector Methods

The methods of the UsbDetector class are listed below. For a complete list of UsbDetector class members, see the UsbDetector Members topic.

Public Instance Methods

Detect Finds suitable usb devices by difference. Devices not present when contructor was called are examined to check if they can be used for activation. The fist one that complies activation is selected as 'Found device'.

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


UsbDetector.Detect Method

Finds suitable usb devices by difference. Devices not present when contructor was called are examined to check if they can be used for activation. The fist one that complies activation is selected as 'Found device'.

[Visual Basic]
Public Sub Detect()
[C#]
public void Detect();

See Also

UsbDetector Class | PvLogiciels.dotNetProtector Namespace


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector documentation

Samples

This section contains guides and examples of dotNet Protector's features implementation or necessary workarounds for the proper operation and deployment of your applications and components.

Deployment projects, guide and workarounds

Trace decodere, guide and sample

Activation system, guide and samples


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples

Deployment projects

This guide explains how to build a deployment project dotNet Protector protected assemblies

An archive containing a module and a tool for embedded runtime exe deployment is available here

Deploying exe with embedded runtime

Deploying assemblies with separated runtime


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples - Deployment projects

Protected Exe with embedded runtime

If dotNet Protector's runtime is embedded in the exe, VS 2005 can't successfully build a setup project with it (it complains about the missing embedded.netmodule).

Ignore the missing PvLogiciels.dotNetProtector.Runtime dependency warning (this assembly is also embedded in your exe).

Solution :

Build the vdproj with a dummy netmodule and the remove this netmodule from the built msi.

Content of EmbeddedSetupPatch.zip

       embedded.netmodule : the dummy netmodule used by PV Logiciels to compile the dotNet Protector® embedded runtime.

       MsiRemoveEmbeddedModule.exe : a command-line utility to remove the dummy netmodule from the generated msi.

Executables built by dotNet Protector when using the ‘runtime embedding feature’

Starting with the v2 of .NET, assemblies can run in 64 bit mode on 64 bit platforms.

If your assembly is compiled as ‘x86 cpu’, it will run in a x86(emulated on 64 bits windows) box on each platform. In this case, dotNet Protector will build a single x86 protected exe.

If your assembly is compiled as ‘any cpu’, the default for pure-IL projects (C#, VB.NET.), it will be converted to a 64 bits executable at run time on 64 bits windows. In this case, dotNet Protector will build 3 executable, one for each platform : x86, ADM64 and Itanium.

If you don’t have the 64 bits platforms available to test the 64 bits exe, forget them and distribute only the x86 one. If you can test the 64 bits, you can build up to 3 setup projects, one for x86, one for AMD64 and one for Itanium. ( change the deployment project’s ‘TargetPlatform’ property accordingly)

Building the vdproj project

This step is the same for each platform.

To successfully build the deployment project, you need to provide a compatible embedded.netmodule. Copy the file from EmbeddedSetupPatch into the same location as your exe embedding dotNet Protector’s runtime.

Build your project. In the following, we suppose the vdproj builds mysetup.msi.

WARNING! If you run your exe with an embedded.netmodule on disk, the framework will load this one instead of the embedded one, and your program will fail. This dummy module should be absent in the distribution folder.

The second step removes embedded.netmodule from the distribution folder by patching the msi database.

Run the command

MsiRemoveEmbeddedModule mysetup.msi

After this step, mysetup.msi won’t install embedded.netmodule

Automatic build of the vdproj project

You can automate the build and patch process using a batch file

Suppose

the solution path is ‘C:\My Projects\mysetup.sln’

the dotNet Protector output path is ‘C:\My Projects\MyExe\Protected

EmbeddedSetupPatch has been uncompressed in C:\ EmbeddedSetupPatch

X86 Only

Say the project name is mysetup, its output directory is ‘C:\My Projects\mysetup\Release’

The batch file could be

@ECHO OFF

COPY /Y “C:\dotNetProtector\EmbeddedSetupPatch\embedded.netmodule” “C:\My Projects\MyExe\Protected”

SETLOCAL

CALL "%VS80COMNTOOLS%\VSVARS32"

"%VSINSTALLDIR%\Common7\IDE\DEVENV" "C:\My Projects\mysetup.sln" /build "Release" /project mysetup

“C: \EmbeddedSetupPatch\ MsiRemoveEmbeddedModule” “C:\My Projects\mysetup\Release\mysetup.msi”

ENDLOCAL

DEL C:\My Projects\MyExe\Protected\embedded.netmodule

Multiple Platform

Say the dotNet Protector output path are ‘C:\My Projects\MyExe\x86’,  ‘C:\My Projects\MyExe\AMD64’ and ‘C:\My Projects\MyExe\Itanium’ respectively

the x86 project name is mysetupx86, its output directory is ‘C:\My Projects\mysetupx86\Release’,

the AMD64 project name is mysetupx64, its output directory is ‘C:\My Projects\mysetupx64\Release’, and

the Itanium project name is mysetupia64, its output directory is ‘C:\My Projects\mysetupia64\Release’

The batch file could be

@ECHO OFF

COPY /Y “C:\dotNetProtector\EmbeddedSetupPatch\embedded.netmodule” “C:\My Projects\MyExe\x86”

COPY /Y “C:\dotNetProtector\EmbeddedSetupPatch\embedded.netmodule” “C:\My Projects\MyExe\AMD64”

COPY /Y “C:\dotNetProtector\EmbeddedSetupPatch\embedded.netmodule” “C:\My Projects\MyExe\Itanium”

SETLOCAL

CALL "%VS80COMNTOOLS%\VSVARS32"

"%VSINSTALLDIR%\Common7\IDE\DEVENV" "C:\My Projects\mysetup.sln" /build "Release" /project mysetupx86

“C: \EmbeddedSetupPatch\ MsiRemoveEmbeddedModule” “C:\My Projects\mysetupx86\Release\mysetupx86.msi”

"%VSINSTALLDIR%\Common7\IDE\DEVENV" "C:\My Projects\mysetup.sln" /build "Release" /project mysetupx64

“C: \EmbeddedSetupPatch\ MsiRemoveEmbeddedModule” “C:\My Projects\mysetupx64\Release\mysetupx64.msi”

"%VSINSTALLDIR%\Common7\IDE\DEVENV" "C:\My Projects\mysetup.sln" /build "Release" /project mysetupia64

“C: \EmbeddedSetupPatch\ MsiRemoveEmbeddedModule” “C:\My Projects\mysetupia64\Release\mysetupia64.msi”

ENDLOCAL

DEL C:\My Projects\MyExe\x86\embedded.netmodule

DEL C:\My Projects\MyExe\AMD64\embedded.netmodule

DEL C:\My Projects\MyExe\Itanium\embedded.netmodule


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples - Deployment Projects

Assemblies without embedded runtime

In projects not embedding the runtime, the vdproj should build correctly, but in these projects, dotNet Protector’s runtime is needed to run.

dotNet Protector’s runtime is composed of 5 files :

. PvLogiciels.dotNetProtector.Runtime.dll : this is the common runtime, needed in all cases

. PvLogiciels.dotNetProtector.RuntimeV1.dll : this is the v1.1 framework compatible runtime. You don’t need it if your assembly is a v2.0 or later assembly

. PvLogiciels.dotNetProtector.RuntimeX86.dll : this is the v2.0 x86 runtime . You need it if your assembly is loaded by the v2.0(or later) .NET Framemork, except if your assembly only runs on a 64 bit platform.

. PvLogiciels.dotNetProtector.RuntimeAMD64.dll : this is the v2.0 ADM64 runtime. You need it if your assembly is loaded by the v2.0(or later) .NET Framemork on windows x64, except if your assembly only runs on x86 (x86 insteed of AnyCPU)

. PvLogiciels.dotNetProtector.RuntimeItanium.dll : this is the v2.0 Itanium runtime. You need it if your assembly is loaded by the v2.0(or later) .NET Framemork on windows IA64, except if your assembly only runs on x86 (x86 insteed of AnyCPU)

If your assembly is a v2+ assembly and not built to run only on a 32 box (x86), you NEED 3 setup projects (for each platform)

Adding the runtime to your project. If the common runtime is present on your assembly’s directory, Visual Studio will add PvLogiciels.dotNetProtector.Runtime.dll by itself. In the other case, add it manually in your application folder.

Depending on the version/platform of your setup project, you’ll have to add additional files:

V1.1 assembly/x86 project : add RuntimeV1 and RuntimeX86

V1.1 assembly/x64 project : add RuntimeV1, RuntimeX86 and RuntimeAMD64

V1.1 assembly/IA64 project : add RuntimeV1, RuntimeX86 and RuntimeItanium

V2+assembly/x86 project : add RuntimeX86

V2+assembly/x64 project : add RuntimeX86 and RuntimeAMD64

V2+assembly/IA64 project : add RuntimeX86 and RuntimeItanium


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples

Trace Decoder

An archive containing this sample and PvLogiciels.dotNetProtector.TraceDecoder class library is available here

How it works

TraceDecoder helps you in handling runtime errors in your application.

The goal is to get the source line where an error occurs. This is usually done by loading the program database (pdb debug information) in addition to an assembly. Once protected, pdb are not valid anymore, and could give sensitive information.

Instead of deploying pdbs with an application, dotNet Protector® can build decodable stacktraces at run-time. These encoded stacktraces can be decoded only with a matching traceinfo file (data contained in the encoded stacktace is what available at runtime – obfuscated names).

If you collect encoded stacktraces in an error report module, you can then decode them with dotNet Protector’s tracedecoder library and your stored traceinfos.

To enable traceinfo production, you just need to check ‘Build trace decoding informations’.

Encoded trace format

An encoded trace is a multiline string (one line per encoded frame).

And encoded frame has 2 sections separated by a NUL character (‘\0’). The first section is the traceinfo ID (actually the module MVID) followed by frame location informations. The second section is the method name recovered from reflection in the following format:

[module_Name]Full_Type_Name::Methode_Name(Parameter_types)

If you wish to collect encoded traces, it is important that you keep the string formatting intact (a BinaryWriter can do the job).

The TraceDecoder Library (PvLogiciels.dotNetProtector.TraceDecoder.dll)

As you may expect, TraceDecoder is protected by dotNet Protector, thus it needs dotNet Protector’s runtime.

The main class is the TraceDecoder class (PvLogiciels.dotNetProtector.TraceDecoder). The constructor instanciates a new TraceDecoder which by default looks for traceinfo files in dotNet Protector’s programdata directory. In fact, it registers a DirectoryTraceInfoStore to load traceinfos from their default location. You can implement your own TraceInfoStore derivated classes by implementing the only method : GetModuleDebugInfoReader(Guid); this methods take the traceinfo ID as argument and returns a BinaryReader to the traceinfo data (or null if traceinfo not found). The underlying stream is closed by the TraceDecoder when the data have been read.

To register you custom TraceInfoStore, call the RegisterStore Method.

To decode a trace, simply call the DecodeTrace Method, which takes an encoded trace as argument and returns a decoded trace.

The TraceDecoderSample sample solution

This solution is straightforward:

FaultyApplication : a dummy winforms application that throws exception each time a button is clicked, with a ThreadException handler that catches exceptions, displays the stacktrace (obfuscated one, given by the framework), and records the encoded trace in a ‘Errors.log’ file.

TraceReader : a winform application that loads the log files and decodes the encoded traces.

Protect FaultyApplication using FaultyApplication.dpp and run FaultyApplication. Launch TraceReader to decode the log.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples

Activation System

These samples show dotNet Protector activation mechanisms.

An archive containing solutions is available here

How it works

When you enable hardware lock, every method body is encrypted, but the decryption key isn’t stored into the protected assembly. dotNet Protector’s runtime needs a license key to decrypt method bodies.

Hardware locking-unlocking is a 3 steps process:

1. You protect your assembly with hardware loc enabled. Bodies are encrypted, only your public key is stored in the protected assembly – no decryption key.

2. Your activation assistant, protected with dotNet Protector builds a ‘hardware configuration’ from the hardware where it runs. This ‘hardware configuration’ is encrypted with your public key (stored by dotNet Protector into your assistant).

3. Your license generator (activation server) decrypts the ‘hardware config’ and builds a license key. The license generator runs on your side, and embeds your private key, allowing ‘hardware config’ decryption and license key encryption.

When your assembly runs, dotNet Protector Runtime looks for the license key, decrypts it with your public key and tries to decrypt bodies.

The public/private key pairs.

dotNet Protector stores symmetric and public/private key pairs (there are more than one) in a key set. The keyset is built the first time you run dotNet Protector, with help from a cryptographic random generator (there is minimal likelihood the same keyset is produced twice).

Since pki is strongly involved in activation process, this is mandatory that your assembly and your activation assistant are protected with the same keyset. Your license generator will use the private part of this keyset to build licenses.

Component (Dll) licensing

dotNet Protector® offers 2 modes for component licensing

Activate to Run : In this mode, a license is mandatory each time the dll runs. You sell your Dll in a royalty model: every final user needs a license to use it.

Activate to Reference : In this mode, a license is needed only when compiling the client application (this is the design-time license). A run-time license is generated from the design-time license when your dll runs. You sell your dll in a ‘royalty free’ model. A license is needed to consume your dll, but can be deployed with a client application.

The 3rd choice in dotNet Protector is in fact only a hybrid mode: If your dll is consumed by a windows application, it works in ‘activate to reference’ mode, when consumed by a ASPNET application, it runs in ‘activate to run’ mode.

Program Activation, activation wizard, key generation

Using a pre-activated usb stick as a dungle

Activating dlls, component licensing


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples - Activation system

ActivationSample solution sample

Lockonly : this project isn’t implied in activation. This is just a dummy sample of some program to activate.

Productkey : this project builds a product key (25 numbers and digits) from a 32 bits ID (can be an integer counter in your license database). The product key is built from your private keyset; this makes difficult, knowing a license ID to know the next one, preventing hacker from finding un-activated licenses by trying each 32 bit number.

Wizard : this is an activation wizard. It builds a configuration string from

1. A product key

2. The software to activate

3. A piece of hardware (computer or USB storage)

Webservice : This a license generator, designed as an ASPNET web service. From a config string, it returns a matching license key. To build a commercial activation service, you’ll need to connect it to a database and check license validity and handle previous activations.

Keygen : this is an ‘all in one’ license generator. It can be used as a tool to build ‘internal use’ licenses, and to verify your activation system. It builds a product key from a number, tries to retrieve the number from the product key, builds a ‘config string’ from this key, the software to activate and hardware, and finally builds a license key.

ActivationEngine : This project wraps dotNet Protector Activation Methods for the web service.

Building the solution

1. Export your keyset (from dotNet Protector’s menu Tools/Export Keyset) to the ActivationEngine and the Keygen directories.

2. Rebuild all the solution

3. Protect wizard, keygen and lockonly (wizard.dpp, keygen.dpp and lockonly.dpp projects respectively)

4. Try to run lockonly without a license key. (It should crash)

5. Run keygen against lockonly ( keygen 1000 lockonly.exe ). It should build lockonly.exe.license containing the product key and the license key.

6. Run lockonly.exe. It should run on the same computer and fail on another.

Building the wizard:

Build the webservice and deploy it on a IIS web server.

The wizard references the webservice at ‘http://localhost/activationsample/service.asmx’ change the url to refect the working one. Build the wizard and protect it using wizard.dpp.

Protect lockonly using lockwiz.dpp (the wizard will be embedded into your exe).

Run lockonly without a license file. It should run the wizard, activate the software, and finaly launch lockonly’s entry point if successfully activated.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples - Activation system

Preactivator solution sample

This solution shows how to implement a ‘usb key licensing’ without a webservice. The gloal is to send usb keys as license (like a hardware dongle with a standard storage pen).

This solution shows also how to embed a ‘full featured licensed’ and a ‘limited demo’ versions in a single executable.

ProgramToActivate : this is the dummy project to activate. It can be compiled as demo or full featured (the DEMO compilation switch turns the program into a demo version).

Preactivator : builds license keys from usb keys.

Building the solution

1. Export your keyset (from dotNet Protector’s menu Tools/Export Keyset) to the solution directory.

2. Rebuild preactivator

3. Protect preactivator, demo and lockedprogram (preactivator.dpp, lockedprogram.dpp projects respectively)

4. Run programtoactivate. It should run in demo mode.

5. Activate a storage pen with preactivator and copy the license file in the same directory as lockedprogram.

6. Run lockedprogram with the dongle attached. It should run in full mode. Remove the dongle. It should exit (savage process killing)

7. Run lockedprogram without the dongle attached. It should run in demo mode.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector Samples - Activation System

DllActivation solution sample

DllActivation shows how to activate a Dll, and helps understand the 2 dll activation mode available in dotNet Protector: activate to run and activate to reference.

NOTE: Protected dlls need the runtime to work.

1. PvLogiciels.dotNetProtector.Runtime.dll is the common runtime

2. PvLogiciels.dotNetProtector.RuntimeV1 is the v1.1 (x86 only) runtime

3. PvLogiciels.dotNetProtector.RuntimeX86 is the v2/x86 runtime

4. PvLogiciels.dotNetProtector.RuntimeAMD64 is the v2/x64 runtime

5. PvLogiciels.dotNetProtector.RuntimeItanium is the v2/IA64 runtime

This is a v2 project. 1 and 3 are needed if you run in a 32bit process, 1 and 4 on x64, 1 and 5 on ia64

DllToActivate : This is the dummy dll we are supposed to protect.

ActivateToRun : a simple exe that consumes the dll. This exe references the ‘activate to run’ protected version of the dll.

ActivateToReference : the same as above, but references the ‘activate to reference’ version.

Notice the ActivateToReference.licx file in project: it tells VS to launch LicenseCompiler (LC.EXE) to build a runtime license resource.

The licx syntax for dotNet Protector is straightforward:

The licensed type is always <dotNetProtector>, followed by your component assembly name.

In this case : <dotNetProtector>, DllToProtect

Keygen : the same as in ActivationSample.

ActivateToRun.dpp : dotNet Protector Project that protects the dll with ‘activate to run’ option

ActivateToReference.dpp : dotNet Protector Project that protects the dll with ‘activate to Reference’ option

Building the solution

1. Export your keyset (from dotNet Protector’s menu Tools/Export Keyset) to the keygen directory.

2. Rebuild keygen and protect it (keygen.dpp)

3. Protect the dll using ActivateToRun.dpp and ActivateToReference.dpp

4. Run Keygen for each protected dll

. keygen 1000 ActivateToRun\DllToActivate.dll

. keygen 1001 ActivateToReference\DllToActivate.dll

5. Rebuild ActivateToRefence.exe

6. Run ActivateToRun.exe : An exception should occur when you click ‘Dll Invoke’

7. Copy ActivateToRun\DllToActivate.dll.license to ActivateToRun\bin\debug. ActivateToRun should run without exception. (‘Dll Invoke’ should display a dialog saying ‘Hello, world’)

8. Run ActivateToReference.exe. No license needed at run time. It should work without a license file.


PvLogiciels.dotNetProtectorHierarchy

dotNet Protector API

PvLogiciels.dotNetProtector Hierarchy

System.Object
PvLogiciels.dotNetProtector.ActivationManager
PvLogiciels.dotNetProtector.ActivationManager.ActivationRequest
PvLogiciels.dotNetProtector.Runtime
PvLogiciels.dotNetProtector.UsbDetector

See Also

PvLogiciels.dotNetProtector Namespace