How to change digital certificate of Endpoint Application (Windows)

There are 3 methods by which you can change the digital certificate.
Method 1: Using your private key file
Method 2: Using a private key from cert store
Method 3: Using a batch script

Note: AntiVirus scanner can block access to files during signing. So, sign the file from a whitelisted path to avoid failures.

Method 1: changing digital certificate using your private key file:
1. Open a command prompt from the folder containing the Endpoint Application files and execute the following command: setup.exe /changesign /kf <path> [/ts <timestampurl>] [/ac <path>] [/pc <path>]
The parameters are explained below:
  setup.exe     - Example name for Endpoint Application.exe file
  /ts           - Time stamp server URL
  /ac           - Additionnal Certificate file
  /kf           - Private key file
  /pc           - Publisher Cerfiricate file

  Example: setup.exe /changesign /kf "mykey.pfx" /ts "http://timestamp.verisign.com/scripts/timstamp.dll" /ac "corsscert.cer"

2. Enter the password of the private key file.
The newly signed file is generated at the same location. The file name is appened with _signed.
**********************************************************************************************************************************************************************

Method 2: Using a private key from cert store
You need elevated privileges on the computer to employ method 2.
1. Open a command prompt from the folder containing the Endpoint Application files and execute the following command: setup.exe /changesign  /sub <subject> [/ts <timestampurl>] [/ac <path>] [/pc <path>]
The parameters are explained below:
  setup.exe     - Example name for Endpoint Application.exe file
  /ts           - Time stamp server URL
  /ac           - Additionnal Certificate file
  /sub          - Subject name reference of code signing certificate in certificate store
  /pc           - Publisher Cerfiricate file

Example: setup.exe /changesign /sub "My Company Inc."  /ts "http://timestamp.verisign.com/scripts/timstamp.dll" /ac "corsscert.cer"
  
The newly signed file is generated at the same location. The file name is appened with _signed.
**********************************************************************************************************************************************************************

Method 3: Using a batch script
This options allows you to sign the file using your own method or tool. 

1. Edit the signbin.bat file with the necessary commands such that this batch file can sign the files passed to it and return the corresponding error. 
2. Open a command prompt from the folder containing the Endpoint Application files and execute the following command: setup.exe /changesign /batch [/ac <path>] [/pc <path>]
Where setup.exe is an Example name for Endpoint Application.exe file
The parameters are explained below:
  /ac           - Additionnal Certificate file
  /pc           - Publisher Cerfiricate file

This launches the signbin.bat file with the parameter of the file to be signed. 

***************************************************************************************************************************************************************************

Possible error codes for signing          
-2 : Unable to access file
-3 : Unable to access pfx file
-4 : Unable to access cer files
-5 : pfx invalid
-6 : Cross Certificate invalid
-7 : Access to Certificate Store failed
-8 : Unable to initialze signer
-9 : Failed to Sign

***************************************************************************************************************************************************************************
