contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 101 forks source link

Digitally sign the Contour installation on Windows #1554

Open christianparpart opened 6 days ago

christianparpart commented 6 days ago

This requires signtool.exe (part of Windows SDK).

It seems to be not too hard to implement, at least the documentation to it seems not as complex as it is for macOS.

I hope with this to get rid of the Windows OS wrong banner, saying that "Windows protected your PC", and defaults to abort executing Contour's MSI installer file.

image

set(SIGNTOOL_EXECUTABLE "signtool" CACHE STRING "Path to signtool.exe")
set(SIGNTOOL_CERTFILE_PATH "/path/to/certificate.pfx" CACHE PATH "Path to your certificate.pfx")
set(SIGNTOOL_CERTFILE_PASSWORD "" CACHE STRING "Password for the given certificate")
add_custom_command(
    TARGET contour POST_BUILD
    COMMAND ${SIGNTOOL_EXECUTABLE} sign /f "${SIGNTOOL_CERTIFICATE_PATH}" /p "${SIGNTOOL_CERTFILE_PASSWORD)" /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $<TARGET_FILE:contour>
)