Using a *.inf File from the Driver Development Wizard on Windows 8 and 10

Updated Apr 18, 2018

Reported In

Driver

  • NI-VISA

Operating System

  • Windows

Issue Details

How can I sign an INF file generated by the Driver Development Wizard so that I can install it on a Windows 8 (or higher) machine?
 

Solution

INF Files generated by the Driver Development Wizard (DDW) to bind devices to NI-VISA are not signed when they are created. Windows 8 (or higher) computers require INF files to be signed before they can be installed onto a machine. 

Follow these steps to install a INF that is generated by the DDW onto a Windows 8 machine:

1. Generate a catalog (.cat) from the INF.

This can be done by using the Inf2Cat tool that is provided by Microsoft via the Windows Driver Kit (WDK). This tool is typically installed at: C:\Program Files (x86)\Windows Kits\8.0\bin\x86. One of the parameters given to this tool is the list of OS’s the generated catalog will need to support. Since earlier versions of this tool don't accept the Windows 8 specific values, the WDK v 8.0 (that supports Windows 8) is required. Be sure to navigate to the directory containing the Inf2Cat tool from the command prompt. Also, it is recommended to run the command prompt as an Administrator if possible.

Syntax: Inf2Cat /driver:<path> /os:<os1>[,<os2>]...

<path>: Path to the directory that contains the INF. The INF file must be in a directory (e.g. cannot be a stand-alone file in the C drive). The INF already has the name of cat file to generate.

<osn>: The OS to support: e.g. 2000, XP_X86, Vista_X64, 7_X86, 8_X64, 10_X86, 10_X64, etc. 
For more information about the OS support, see External Link: Microsoft Dev Zone: Inf2Cat.

Output: If the <path> contains an *.inf file, this command will create a corresponding *.cat file next to it.

2. Obtain or create a certificate that can be used to sign the *.cat.

Ideally, you should contact a Certificate Authority (CA) to obtain a certificate that you can use to sign all your drivers and INF’s. A certificate typically has a pair of keys, public and private. The public key is distributed to clients who need to use the signed binary/INF. The private key is only available to the owner of the certificate and is used to sign anything that needs to be signed. The private key should be protected and not distributed. The public key has enough information to verify the certificate owner.

This process has a few drawbacks:
  1. There is an annual fee that needs to be paid to the CA to obtain and use the certificate from them.
  2. If you aren’t distributing the INF to your customers and only need to use it on your own machine, this process is not feasible (unless you are buying the certificate for other reasons).
A workaround if you do not want to buy a certificate from a CA is for you to create a 'personal' certificate. This certificate, along with the private key, can be installed on a development machine where you will generate the *.cat file and sign it using that certificate. Next, take the *.inf file, the signed *.cat file, and a copy of your public key (in the form of a certificate) to the deployment systems, where you will first install the public certificate as a 'trusted' certificate and then install any *.inf file that has a *.cat file signed with that certificate. These personal certificates (extension .pfx, in this case) can be generated using a variety of third party applications such as Adobe Reader, the Java SDK, and openssl for Linux distributions.

3. Sign the .cat using the certificate.

Once the *.cat file is generated and the private certificate is installed on a development machine, the *.cat file can be signed using that certificate. Microsoft provides a tool to sign the INF’s, called SignTool. This tool should be available with the WDK. It is located in the same folder as the Inf2Cat tool: C:\Program Files (x86)\Windows Kits\8.0\bin\x86. Please note that the WDK may require a certain version of Visual Studio to use the SignTool. This requirement will be listed on the WDK download page. This tool is also available from the Windows Platform SDK. After installing the Windows 7 SDK, the tool will be located at: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin. To use SignTool, make sure to navigate to the directory containing the SignTool from the command prompt.

Syntax: signtool sign options <filename(s)>

Examples:
  • If the private/public key pair is in a file (in .pfx format):    
       signtool sign /f C:\mycertificate.pfx /p mypfxpassword c:\mycatfile.cat
  •    If the key is installed on the dev machine:
       signtool sign /n mycertificatename C:\mycatfile.cat

4. Install the public certificate onto the target Windows 8 machine before installing the INF.

Once the *.cat file is signed with the private key, the *.inf file, the signed *.cat file and the public certificate can be distributed together. To install thed chain of certificates up to a 'Trusted Root CA'. Otherwise, if it is a personal certificate, it needs to bee *.inf file onto the machine the public certificate first needs to be installed. If the certificate was obtained from a CA, it already has a trust installed as a 'Trusted Root'. To install, right click the public certificate (*.cer created by third party application) and choose Install Certificate. In the dialog that shows up, select Local Machine and press Next. In the following dialog, choose Place all certificates in the following store, press the Browse button and choose Trusted Root Certification Authorities from the list. Press OK to go back to the import wizard and press Next. Press Finish. Press OK when prompted with the confirmation dialog.

To view the certificates installed on the system, use the following steps:
  1. Run mmc command to launch the Microsoft Management Console
  2. From the menu, choose File » Add/Remove Snap-in...
  3. In the dialog, Click on Certificates and press the Add button in the middle of the dialog.
  4. In the dialog that shows up, choose the Computer account radio button and press Next and Finish.
  5. Press OK.
In the MMC, now you can see the certificates installed for the current user. The certificate that was imported needs to be under Trusted Root Certification Authorities. If it is not, you can right click on the Certificates (Current User) and then choose to Find Certificates.... Once it is found, you can copy (or cut) and paste it under the Trusted Root Certification Authorities.
 

WAS THIS ARTICLE HELPFUL?

Not Helpful