# Using Your Code Signing Certificate

This how-to will walk you through using your SSL.com OV or EV code signing certificate with Microsoft’s SignTool and SSL.com’s SSL Manager. These instructions assume that your OV code signing certificate has been installed, or your EV certificate has been activated.

Note: remember that for EV code signing certificates the certificate only exists on the USB token that was sent to you and that the token must be attached to the computer that is being used to sign the application.

## Signing an Executable with SignTool

1. Install Windows SDK and SignTool

SignTool is included with Windows 10 SDK. After installation, SignTool will be located under:

C:\Program Files (x86)\Windows Kits\10\bin\<SDK VERSION>\x64\signtool.exe

2. Start Powershell

Start a Powershell command window by searching for “Powershell” in the Start menu and clicking on the desktop application.

Powershell is a command line interface to Windows’ core services. You can use it to execute SignTool and sign your code.

3. For EV code signing, attach your USB token to your computer (if you haven’t done so already).

Remember that the certificate only exists on the USB token that was sent to you and that the token must be attached to computer that is being used to sign the application. This step should be skipped if you are using an OV code signing certificate.

4. Sign Executable

You can sign an executable by issuing the following command in the Powershell window. (You may be requested to enter the certificate’s password.)

signtool.exe sign /a "C:\path\to\MyExecutable.exe"

The /a option instructs SignTool to automatically find an appropriate code signing certificate for your executable.

If you have more than one code signing USB tokens or certificates installed, you can specify the certificate you want to use by including its Subject Name via the /n option.

You can find your EV CS certificate’s Subject Name using Microsoft’s certificate management tool certmgr. Open the tool from the Start menu and look for your EV CS certificate in the “Personal” folder, under “Certificates”, as shown in the image below. The Subject Name is the “Issued To” field in certmgr.

In the above image the certificate’s Subject Name is example. You can specify this value in SignTool with the following command.

signtool sign /n "example" "C:\path\to\MyExecutable.exe"

If you want to add a timestamp in the signed binary file, you can do so using SignTool’s /tr option. The command in the snippet below includes a timestamp from SSL.com‘s timestamp service, while signing an executable.

signtool.exe sign /tr http://ts.ssl.com  /a "C:\path\to\MyExecutable.exe"
Note: Be sure to use SignTool’s /tr option (specify URL of RFC 3161 time stamp server), not /t (URL of time stamp server), which is incompatible with SSL.com’s timestamp server.

Other important SignTool options are:

• /fd:  Specify file digest algorithm (the default is SHA-1). To specify SHA-256, use /fd sha256.
• /td:  Specify time server digest algorithm (the default is SHA-1). To specify SHA-256, use /td sha256.
Note: The /td option must follow the /tr option. If the time stamp digest algorithm is specified before the time stamp server, the default SHA-1 algorithm will be used.
• /d: Add a description of the signed code. For example, /d "test code".
• /du: Add a URL with an expanded description of the signed code. For example, /du https://www.ssl.com.

Using all of the above options (but omitting /a because we are specifying the certificate’s Subject Name with /n, our command line looks like:

signtool.exe sign /n "example" /fd sha256 /tr http://ts.ssl.com /td sha256 /d "test code" /du https://www.ssl.com "C:\path\to\MyExecutable.exe"

SignTool includes other signing options, such as working directly with PFX files rather than installed certificates, and a variety of features besides code signing. If you are interested in the tool, please take a look at Microsoft’s official documentation.

## Signing an Executable with SSL Manager

If you prefer a more graphics-based approach you can use SSL.com‘s in-house software, SSL Manager, to sign your files. Many customers prefer to use SSL Manager because it offers the additional benefit of having easy access to all your certificates in one unified interface. For instructions on downloading and installing SSL Manager, please refer to our installation guide.

To sign an executable, start by selecting Code Signing > Sign & Timestamp Code Package from SSL Manager’s menu.

In the code signing form, you may select the executable and the code signing certificate (either from a file or a certificate store) and one of the available timestamp servers. When you are done, click the Sign button to sign your code.

Besides code signing, SSL Manager offers many powerful features. For more details, please refer to SSL Manager’s documentation, especially the Code Signing menu.