Page 1 of 1

miabuild double quotes in compiler variable

Posted: Mon Oct 13, 2025 12:27 am
by amolago
Hi,

We currently run IA X16 and have had to renew our code signing certificate and have subsequently run in to issues with how InstallAware handles the EV certificate.

Code: Select all

"C:\Program Files (x86)\InstallAware X16\authenticode\signtoolex\signtool.exe" sign /fd SHA256 /as /f "cert.p7b" /csp "eToken Base Cryptographic Provider" /tr "http://timestamp.digicert.com" /td sha256 /du "https://example.com" /d "My Product" /k "[{{}}]=key_1234567890" "Temp\{E8513BFA-661C-4B86-8F90-9F993A40B713}"
  • The CSP here is incorrect, and there appears no way to change it.
  • There also appears to be no way to provide the /sha1 argument to determine the specific certificate to use
  • There is no documentation I can find on the content used in the /k argument for "[{{}}]"
Therefore I wanted to attempt to replicate what IA does in the post-build step script, and was hoping to do this in a dynamic manner so that I did not have to modify and maintain multiple IA projects.

After some investigation, I saw that the script itself is just the compiler variable "POST-BUILD-EVENT-COMMANDS" and quickly worked out I can pass this on the "miabuild.exe" command line. Perfect as I can build the commands in one place away from the the IA Project and call "miabuild.exe" with the signing script without have to modify any project files.

However, this does not work! Not because there is an issue with the commands, but because there appears to be no way of passing double quote characters in to a compiler variable. I have tried:
  • "" (2x double quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="""#IADIR#\authenticode\signtool.exe"" sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d ""My Product"" /du https://example.com /csp ""DigiCert Signing Manager KSP"" /kc key_1234567890 ""#PROJDIR#\Release\Single\my project.msi"""
  • """" (4x double quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="""""#IADIR#\authenticode\signtool.exe"""" sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d """"My Product"""" /du https://example.com /csp """"DigiCert Signing Manager KSP"""" /kc key_1234567890 """"#PROJDIR#\Release\Single\my project.msi"""""
  • `"`" (2x powershell escaped double quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="`"`"#IADIR#\authenticode\signtool.exe`"`" sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d `"`"My Product`"`" /du https://example.com /csp `"`"DigiCert Signing Manager KSP`"`" /kc key_1234567890 ""#PROJDIR#\Release\Single\my project.msi"""
  • `"`"`"`" (4x powershell escaped double quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="`"`"`"`"#IADIR#\authenticode\signtool.exe`"`" sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d `"`"`"`"My Product`"`"`"`" /du https://example.com /csp `"`"`"`"DigiCert Signing Manager KSP`"`"`"`" /kc key_1234567890 `"`"`"`"#PROJDIR#\Release\Single\my project.msi`"`"`"`""
  • ' (singe quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="'#IADIR#\authenticode\signtool.exe' sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d 'My Product' /du https://example.com /csp 'DigiCert Signing Manager KSP' /kc key_1234567890 '#PROJDIR#\Release\Single\my project.msi'
  • '' (2x singe quote)

    Code: Select all

    miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="''#IADIR#\authenticode\signtool.exe'' sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d ''My Product'' /du https://example.com /csp ''DigiCert Signing Manager KSP'' /kc key_1234567890 ''#PROJDIR#\Release\Single\my project.msi''
All to no avail.

The best solution I have at the moment is to define a quote in the project file, then use:

Code: Select all

miabuild.exe "my project.mpr" POST-BUILD-EVENT-COMMANDS="#Q##IADIR#\authenticode\signtool.exe#Q# sign /f cert.p7b /fd sha256 /tr http://timestamp.digicert.com /td sha256 /d #Q#My Product#Q# /du https://example.com /csp #Q#DigiCert Signing Manager KSP#Q# /kc key_1234567890 #Q##PROJDIR#\Release\Single\my project.msi#Q#

Am I missing something, is there really no way to pass in a double quote to a compiler variable?

Re: miabuild double quotes in compiler variable

Posted: Mon Oct 13, 2025 9:30 am
by JohnGaver
For your scenario, you should really upgrade to version X17, which features Code Signing Hooks:

www.installaware.com/azure-trusted-signing.htm

Using Build Events is just not the same. InstallAware signs many files during the build process, the locations of which invariably change from build to build and output type to output type. Code Signing Hooks let you tap into the process, with extreme ease.

As for your question, escaping double quotes on the command line is not an issue that is specific to miabuild, but to your command line interpreter. As long as miabuild is being sent the proper command line, it would parse it correctly.

I do notice that you're using incorrect quoting for your command line parameters. You must escape not the value of a particular pair, but the entire pair itself. So for example:

Code: Select all

NAME="VALUE"

Is wrong. The correct form is:

Code: Select all

"NAME=VALUE"

I don't know if this is related to the problems you're seeing, but I do hope the above information is helpful to you.

If you check the Code Signing Hooks page, you'll see that you don't need to escape any double quotes there either.