Skip to content

Commit b279eab

Browse files
committed
build: make code signing method configurable
Existing code signing was hard-coded to use a locally installed certificate (hardware security dongles included). However, signtool.exe is extensible to allow any kind of digest signing plugin with /dlib and /dmdf switches. This is used for cloud-based code signing (e.g. Microsoft Trusted Signing). Signed-off-by: Simon Rozman <[email protected]>
1 parent e70799b commit b279eab

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ if exist .deps\prepared goto :render
4747

4848
:sign
4949
if exist .\sign.bat call .\sign.bat
50-
if "%SigningCertificate%"=="" goto :success
50+
if "%SigningProvider%"=="" goto :success
5151
if "%TimestampServer%"=="" goto :success
5252
echo [+] Signing
53-
signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\wireguard.exe x86\wg.exe amd64\wireguard.exe amd64\wg.exe arm64\wireguard.exe arm64\wg.exe || goto :error
53+
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\wireguard.exe x86\wg.exe amd64\wireguard.exe amd64\wg.exe arm64\wireguard.exe arm64\wg.exe || goto :error
5454

5555
:success
5656
echo [+] Success. Launch wireguard.exe.

docs/buildrun.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ C:\Projects\wireguard-windows\installer> build
6060
Add a file called `sign.bat` in the root of this repository with these contents, or similar:
6161

6262
```text
63-
set SigningCertificate=8BC932FDFF15B892E8364C49B383210810E4709D
63+
set SigningProvider=/sha1 8BC932FDFF15B892E8364C49B383210810E4709D
6464
set TimestampServer=http://timestamp.entrust.net/rfc3161ts2
6565
```
6666

embeddable-dll-service/build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ if exist ..\.deps\prepared goto :build
2525

2626
:sign
2727
if exist ..\sign.bat call ..\sign.bat
28-
if "%SigningCertificate%"=="" goto :success
28+
if "%SigningProvider%"=="" goto :success
2929
if "%TimestampServer%"=="" goto :success
3030
echo [+] Signing
31-
signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Tunnel" x86\tunnel.dll amd64\tunnel.dll arm64\tunnel.dll || goto :error
31+
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Tunnel" x86\tunnel.dll amd64\tunnel.dll arm64\tunnel.dll || goto :error
3232

3333
:success
3434
echo [+] Success

installer/build.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ if exist .deps\prepared goto :build
4040
call :msi x86 i686 x86 || goto :error
4141
call :msi amd64 x86_64 x64 || goto :error
4242
call :msi arm64 aarch64 arm64 || goto :error
43-
if "%SigningCertificate%"=="" goto :success
43+
if "%SigningProvider%"=="" goto :success
4444
if "%TimestampServer%"=="" goto :success
4545
echo [+] Signing
46-
signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Setup" "dist\wireguard-*-%WIREGUARD_VERSION%.msi" || goto :error
46+
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Setup" "dist\wireguard-*-%WIREGUARD_VERSION%.msi" || goto :error
4747

4848
:success
4949
echo [+] Success.
@@ -61,10 +61,10 @@ if exist .deps\prepared goto :build
6161
if not exist "%~1" mkdir "%~1"
6262
echo [+] Compiling %1
6363
%CC% %CFLAGS% %LDFLAGS% -o "%~1\customactions.dll" customactions.c %LDLIBS% || exit /b 1
64-
if "%SigningCertificate%"=="" goto :skipsign
64+
if "%SigningProvider%"=="" goto :skipsign
6565
if "%TimestampServer%"=="" goto :skipsign
6666
echo [+] Signing %1
67-
signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Setup Custom Actions" "%~1\customactions.dll" || exit /b 1
67+
signtool sign %SigningProvider% /fd sha256 /tr "%TimestampServer%" /td sha256 /d "WireGuard Setup Custom Actions" "%~1\customactions.dll" || exit /b 1
6868
:skipsign
6969
"%WIX%bin\candle" %WIX_CANDLE_FLAGS% -dWIREGUARD_PLATFORM="%~1" -out "%~1\wireguard.wixobj" -arch %3 wireguard.wxs || exit /b %errorlevel%
7070
echo [+] Linking %1

0 commit comments

Comments
 (0)