Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Code Sign on Windows #1596

Closed
daveywc opened this issue May 30, 2017 · 16 comments · May be fixed by qcif/data-curator#563
Closed

Unable to Code Sign on Windows #1596

daveywc opened this issue May 30, 2017 · 16 comments · May be fixed by qcif/data-curator#563

Comments

@daveywc
Copy link

daveywc commented May 30, 2017

"electron-builder": "^18.1.0"

"electron-updater": "^1.16.0"

  • Target: Windows (NSIS)

I have donated $50 USD as per above.

I have purchased a code signing certificate and converted it to pfx.

My build script is:

"ionic-app-scripts build && set CSC_LINK=C:\Data\Development\Projects\DocsOnTapV2\build\dotv2codesign.pfx && set CSC_KEY_PASSWORD=NotTelling && build"

However I get the following error indicating that it cannot find my pfx file. But the path is valid.

Rebuilding native production dependencies for win32:x64
Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked
Error: C:\Data\Development\Projects\DocsOnTapV2\build\dotv2codesign.pfx doesn't exist
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\codeSign.ts:45:11
at next (native)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
at downloadCertificate (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\codeSign.js:49:21)
at Lazy.WinPackager.cscInfo.Lazy (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:42:9)
at Lazy.get value [as value] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:248:24)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:168:32
at next (native)

I have spent hours trying to find a solution without any success. I did try using keytool to convert the pfx to p12. Made no difference.

My development environment is Windows 10.

Kind regards,

David

@develar
Copy link
Member

develar commented May 30, 2017

Are you sure that your file is accessible (read permission for current user)?

@daveywc
Copy link
Author

daveywc commented May 30, 2017

Yes I am - to be sure I just gave full permission to "everyone" and tried again. Still same problem.

@develar
Copy link
Member

develar commented May 30, 2017

Please try 18.2.0 (it is next version, not visible on npm) — is your pfx file inside project directory — please try to set CSC_LINK=build/dotv2codesign.pfx.

@daveywc
Copy link
Author

daveywc commented May 30, 2017

I have not tried 18.2.0 yet. But when I change the CSC_LINK as suggested I now get a different error:
`Rebuilding native production dependencies for win32:x64
Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked
Signing Docs On Tap V2.exe (certificate file: "C:\Users\DAVIDC1\AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12")
Error: Exit code: 1. Command failed: C:\Users\DavidCompton\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.7.0\windows-10\x64\signtool.exe sign /t http://timestamp.verisign.com/scripts/timstamp.dll /f C:\Users\DAVIDC
1\AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12 /d Docs On Tap V2 /du http://harboursoftware.com.au/ /p d5661d81d0948092ae1fb308e457d17d446591c320c302347880b6e7edf50f68 (sha256 hash) C:\Data\Development\Projects\DocsOnTapV2\dist\win-unpacked\Docs On Tap V2.exe
SignTool Error: An error occurred while attempting to load the signing
certificate from: C:\Users\DAVIDC~1\AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12

SignTool Error: An error occurred while attempting to load the signing
certificate from: C:\Users\DAVIDC~1\AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12

at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:75:16
at ChildProcess.exithandler (child_process.js:213:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)

From previous event:
at exec (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:53:3)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\windowsCodeSign.ts:140:16
at next (native)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
at spawnSign (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\windowsCodeSign.js:111:22)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\windowsCodeSign.ts:60:11
at next (native)`

@develar
Copy link
Member

develar commented May 30, 2017

But when I change the CSC_LINK as suggested I now get a different error:

18.2.0 and relative path support was fixed for you. Please try this version.

@daveywc
Copy link
Author

daveywc commented May 30, 2017

@develar
Copy link
Member

develar commented May 30, 2017

Release will be announced when published as latest, for now I published 18.2.0 earlier to investigate your issue. Just set version to 18.2.0.

@daveywc
Copy link
Author

daveywc commented May 30, 2017

After updating to 18.2.0 - now I get the following error:

Rebuilding native production dependencies for win32:x64 Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked TypeError: Path must be a string. Received null at assertPath (path.js:7:11) at Object.resolve (path.js:186:7) at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\codeSign.ts:46:15 at next (native) From previous event: at downloadCertificate (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\codeSign.js:53:21) at Lazy.WinPackager.cscInfo.Lazy [as creator] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:42:9) at Lazy.get value [as value] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:248:24) at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:168:32 at next (native) From previous event: at WinPackager.sign (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\winPackager.js:278:11) at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:253:16

@black-snow
Copy link
Contributor

@daveywc Although this ain't seem to be the same issue that you have try to delete the spaces around the && - that was somehow necessary to make it work for me. Part of my package.json:

"release": "set CSC_KEY_PASSWORD=&&set CSC_LINK=%cd%/build/cert/xyz.pfx&&build --ia32",

@develar
Copy link
Member

develar commented May 30, 2017

@black-snow Ouch, it seems your are right, bloody, blooody windows.
@daveywc Please try 18.2.1.

@daveywc
Copy link
Author

daveywc commented May 30, 2017

Woot!! We have a winner. No more errors. Thanks @develar and @black-snow. Appreciate all the help!

@develar
Copy link
Member

develar commented May 30, 2017

@black-snow I have added trim to get rid of spaces. Thanks for spotting.

@daveywc Thanks for donation :)

@black-snow
Copy link
Contributor

You're welcome ;) Always glad to help develar with this great piece

@black-snow
Copy link
Contributor

black-snow commented May 30, 2017

@develar How's that trim implemented?
// edit: nvm, I'll look at the commit

@develar
Copy link
Member

develar commented May 30, 2017

381e8c0#diff-adb7b90f249c915a5bdae8ff5be096f4R49

file = path.resolve(currentDir, file.trim())

update: e63e8fa

@daveywc
Copy link
Author

daveywc commented May 30, 2017

@develar I think the $50 donation is a small price to pay for all the work that you've put into this. Always happy to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants