.issig Signatures: Introduction

Inno Setup includes an integrated signature-verification capability that can be used to detect corruption or tampering in your files at compile time, before files are included in an installer being built, or during installation, before Setup copies external files onto a user's system.

Signatures are created using the included Inno Setup Signature Tool utility (ISSigTool.exe) and are stored in separate files with an .issig extension. Because the signatures are stored in separate files — the original files are not touched — any type of file may be signed and verified.

Creation of .issig signatures does not require a certificate from a certificate authority. There is no cost involved.

Note, however, that an .issig signature cannot be used to eliminate an "Unknown publisher" warning message shown by Windows when an installer or other EXE file is started. That requires a completely different kind of signature (Authenticode) embedded inside the EXE file by a different tool (Microsoft's signtool.exe), and it does require a (usually expensive) code-signing certificate from a certificate authority. You can however use both signtool.exe and ISSigTool.exe on a single file, in that order. If you are looking for more information about signtool.exe see SignTool instead.

Quick start: Verifying files at compile time

On the issigtool commands below, prepend the path of your Inno Setup installation, and include quotes. For example: "%ProgramFiles(x86)%\Inno Setup 6\issigtool"

  1. At the command line, generate a new private key file that will be used for signing:

    issigtool --key-file="MyKey.isprivatekey" generate-private-key
    

    A file named MyKey.isprivatekey will be created in the current directory. You may include a pathname if you wish.

    The file should not be shared with others, and should never be committed into a public repository. To reduce the risk of accidental disclosure, it is best to keep the file outside of your source tree.

  2. Create the file we want to sign, then create the signature:

    echo Hello > MyFile.txt
    issigtool --key-file="MyKey.isprivatekey" sign "MyFile.txt"
    

    A signature file named MyFile.txt.issig is created.

  3. Inside your Inno Setup script, add an [ISSigKeys] section entry linking to your key file, and a [Files] section entry for MyFile.txt that includes the issigverify flag:

    [ISSigKeys]
    Name: MyKey; KeyFile: "MyKey.isprivatekey"
    
    [Files]
    Source: "MyFile.txt"; DestDir: "{app}"; Flags: issigverify
    

    Note: Specifying a public key file instead is preferred; see the Tips & Recommendations section below.

  4. Compile the script. In the compiler output, you should see a line indicating the file was successfully verified:

       Compressing: MyFile.txt
          Verification successful.
    
  5. Now let's confirm that the compiler actually does catch corruption or tampering within the file.

    Make a modification to MyFile.txt — for example, add or change a character.

  6. Compile the script again. This time, you should get an error like the following:

    Signature is not valid for source file "MyFile.txt": file hash incorrect.
    

Verifying external files during installation

The procedure for setting up verification of external files is essentially the same as the procedure shown above for compile-time verification, except:

Tips & Recommendations