diff --git a/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts b/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts index 0aac2761eab..533687bd869 100644 --- a/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts +++ b/packages/electron-updater/src/windowsExecutableCodeSignatureVerifier.ts @@ -10,7 +10,7 @@ export function verifySignature(publisherNames: Array, tempUpdateFile: s return new Promise(resolve => { // https://github.com/electron-userland/electron-builder/issues/2421 // https://github.com/electron-userland/electron-builder/issues/2535 - execFile("powershell.exe", ["-NoProfile", "-NonInteractive", "-InputFormat", "None", "-Command", `Get-AuthenticodeSignature '${tempUpdateFile}' | ConvertTo-Json -Compress`], { + execFile("powershell.exe", ["-NoProfile", "-NonInteractive", "-InputFormat", "None", "-Command", `Get-AuthenticodeSignature '${tempUpdateFile}' | ConvertTo-Json -Compress | ForEach-Object { [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($_)) }`], { timeout: 20 * 1000 }, (error, stdout, stderr) => { try { @@ -20,7 +20,7 @@ export function verifySignature(publisherNames: Array, tempUpdateFile: s return } - const data = parseOut(stdout) + const data = parseOut(Buffer.from(stdout, "base64").toString("utf-8")) if (data.Status === 0) { const name = parseDn(data.SignerCertificate.Subject).get("CN")! if (publisherNames.includes(name)) { @@ -87,4 +87,4 @@ function handleError(logger: Logger, error: Error | null, stderr: string | null) function isOldWin6(): boolean { const winVersion = os.release() return winVersion.startsWith("6.") && !winVersion.startsWith("6.3") -} \ No newline at end of file +}