From aa27aa2bf961c6113bea74b20857ab47868d0363 Mon Sep 17 00:00:00 2001 From: oleg-shilo Date: Wed, 6 Jun 2018 20:27:23 +1000 Subject: [PATCH] Issue #387: Certificate password can be null --- Source/src/WixSharp/CommonTasks.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/src/WixSharp/CommonTasks.cs b/Source/src/WixSharp/CommonTasks.cs index 578a11a7..ab99b288 100644 --- a/Source/src/WixSharp/CommonTasks.cs +++ b/Source/src/WixSharp/CommonTasks.cs @@ -190,7 +190,7 @@ static public int DigitalySign(string fileToSign, string pfxFile, string timeURL string certPlace = useCertificateStore ? "/n" : "/f"; string args = $"sign /v {certPlace} \"{pfxFile}\""; - if (password != null) + if (password.IsNotEmpty()) args += $" /p \"{password}\""; string sha1 = args; @@ -211,10 +211,12 @@ static public int DigitalySign(string fileToSign, string pfxFile, string timeURL @"C:\Program Files (x86)\Windows Kits\10\bin\x86;" + @"C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86", ExePath = "signtool.exe", - Arguments = sha1, - ConsoleOut = (line) => Compiler.OutputWriteLine(line.Replace(password, "***")) + Arguments = sha1 }; + if (password.IsNotEmpty()) + tool.ConsoleOut = (line) => Compiler.OutputWriteLine(line.Replace(password, "***")); + var retval = tool.ConsoleRun(); var sha1Signed = retval == 0 || retval == 2; if (!dualSign || !sha1Signed)