The sample programs included with the ProtectKit3.5 are intended to illustrate how you can use Password Protection in your own .NET applications. The ProtectKit.NET samples call various ProtectKit.NET functions to retrieve information and set protection. Using these sample programs is an excellent way to understand how password protection works and how to add it to your .NET applications

The following is a brief explanation of how to set password protection and also how to unlock that protection.

Step 1. Setting protection with the Set Password Protection Tool (PrNETSetProtect.exe).

Choose a sample program and open the sample project. Build an EXE.

Step 2. Copy necessary ProtectKit.NET files

Copy the necessary ProtectKit.NET files into the same folder as the EXE. (These ProtectKit.NET files are: ProInfo32(64).dll, ProFuncNET32(64).dll, and Newtone.ProtectKit.Win.Password.dll)

Step 3. Set Protection

     a. Run the "Set Password Protection" tool (PrNETSetProtect.exe).
     b. Click the "Open" button.
     c. Choose the ProInfo file. This is the ProtectKit3.5 ProInfo32(64).dll that you copied to the same folder as your EXE.
         (This file can be renamed for increased security.)
     d. Select the PC Identifiers that you want to use to uniquely identify the PC running your application.
     e. Set a lockword and protection type. For example:
          Lockword: AbcdefgH
          Protection Type: Standard Protection
     f. Click the "Save" button at the top of the "Set Password Protection" tool.

Two files will be created:
     1. The ProInfo file, (default name is ProInfo32.dll) has been overwritten to include the protection information you set using the Set Password-Type Protection tool.
     2. The protection resource file. (default name is ProInfo32.dll.dat). This file is to be embedded into your application and the application EXE rebuilt. See next step

Step 4. Embedding the protection information into your application.

There are two ways to embed the protection resource file into your application.
     1. Embed protection resource using the PasswordProtect.Stream property.
          a. Open the application's project in Visual Studio.
          b. Locate the PasswordProtect class
          c. In the Property Window, click the Stream property and set the protection resource file (default name is ProInfo32.dll.dat) into the stream property.
             (The ProInfo32.dll.dat file can be renamed for greater security)
          d. Rebuild the project.
          e. The protection information has now been embedded into your application.
     2. Embed protection resource as a resource file
          a. Open the application's project in Visual Studio.
          b. Add the ProInfo32.dll.dat file to your project: in the Solution Explorer, right click on the project and select ("Add an existing item")
          c. In the Solution Explorer, click on the newly added ProInfo32.dll.dat file and in the Properties Window, set the Build Action to "Embedded Resource".
          d. Rebuild the project.
          e. The protection information has now been embedded into your application.

Run the sample EXE and check the protection status by clicking the button named "Protection Status". The status is "Locked".

II. Unlock the application

To unlock an application, you need to enter a valid password. Passwords are generated by the Password Generators. Here we will use the Password Generator EXE (Pr3PassGen.exe). To use the password generator, you must first retrieve the PcID from the PC. The sample programs retrieve the PcID within a button click event. Run the sample EXE that you protected in the above steps and click the button named "Get PcID (default)". The PcID will appear in the textbox.

Run the Password Generator (Pr3PassGen.exe).
Enter the lockword: AbcdefgH
Enter the PcID that you retrieved from the sample Exe.
Click the button named "Retrieve Password". The password will appear in the textbox.
Copy it from the Password Generator and paste it into the appropriate textbox in the sample EXE and click the button named "Set Password".

The sample Exe should be now be unlocked. Confirm this by clicking the button named "Protection Status".

III. Runtime environment:

The sample EXE file and the following files MUST be in the same folder:
     ProInfo32(64).dll
     ProFuncNET32(64).dll
     Newtone.ProtectKit.Win.Password.dll

If you are trying to run the sample on a target machine where the ProtectKit3.5 installation program was not used, you will need to be sure that the ProtectKit System Driver is installed and working on that machine. To install it, run the Ddscm.exe. For details see Options for Ddscm.exe.