To sign .msixbundle I use this command line:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe" sign /fd SHA256 /sha1 <certificate thumbprint> <path to .msixbundle file>
- <certificate thumbprint>: is a field of the signing certificate
- <path to .msixbundle file>: this should be obvious
in "C:\Program Files (x86)\Windows Kits\10\bin\" there is a dir for each target platform version (..., 10.0.17134.0, 10.0.17763.0, 10.0.18362.0), I choose the one that match with the current TargetPlatformVersion of the UWP project.
To sign .exe, this works for me.
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe" sign /fd SHA256 /sha1 <certificate thumbprint> <path to .exe file>
To sign the .exe files inside .msixbundle you have to unbundle the .msixbundle, and to unpack each .appx file inside the .msixbundle:
unbundle command:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\MakeAppx.exe" unbundle /p <path to .msixbundle file> /d <unbundle dir>
then unpack all your .appx files to reach the .exe
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\MakeAppx.exe" unpack /l /p <path to .appx file> /d <unpack dir>
After you sign the .exe with the command above you have to repack the appx
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\MakeAppx.exe" pack /o /l /d <unpack dir> /p <new .appx file>
and then you have to bundle .appx again
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\MakeAppx.exe" bundle /v /o /d <unbundle dir> /p <new .msixbundle file>
And at the end sign the .msixbundle
To understad these command line tools, I read the documentation. Here some links, you can use also the command line help using /?
- https://learn.microsoft.com/en-us/dotnet/framework/tools/signtool-exe
- https://learn.microsoft.com/en-us/windows/win32/seccrypto/using-signtool-to-sign-a-file
- https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool
- https://learn.microsoft.com/en-us/windows/msix/package/create-app-package-with-makeappx-tool