You’ve spent weeks, maybe months, crafting your dream Electron app. The UI looks clean, the features work flawlessly, and you finally hit that Build button.
Excited, you send the installer to your friend for testing. You’re expecting a “Wow, this is awesome!” Instead, you get: Windows protected your PC. Unknown Publisher.”
That bright blue SmartScreen warning slaps your beautiful app right across the face, making it appear like malware. Your friend hesitates, clicks “Don’t run,” and suddenly all your hard work looks sketchy.
This isn’t a bug. It’s not even a coding issue. It’s because your app isn’t code-signed.
Windows doesn’t trust unsigned software. Period. And that’s a problem for developers who want to look professional, gain user trust, and ensure smooth installations.
But don’t worry, fixing this is easier than you think.
I’ll walk you through the process of code signing your Electron app on Windows using Electron Builder, step by step.
The construction of your app is just half the battle. The actual headache begins as soon as you attempt to package it for users.
You want a professional look and a clean installer, and not a folder with a messy set of files that yell at you that it is a developer build.
That is precisely the place of Electron Builder.
Recommended: What is Electron Software Framework? How Electron Works? Pros, Cons and Use Cases
Imagine it as your own personal packaging assistant, someone who does all the boring, technical work, and you can create the amazing features.
Electron Builder will automatically convert your raw Electron project to an installable, cross-platform, and immediately usable .exe or .msi file on Windows (and even a cross-platform .dmg file on macOS should you ever find the need to cross-platform it).
It automatically supports code signing, which means you don’t have to fight with complex Windows tools, PowerShell commands, or confusing certificate settings.
Just configure it once… hit build… and Electron Builder does the magic packaging, signing, and preparing your app for the world to download.
Electron Builder helps you ship your app like a pro with confidence, trust, and zero hassle.
You spend hours building your Electron app, you package it beautifully, upload it for download, and within minutes… your inbox is flooded with messages like: “Hey, Windows says your app might harm my PC. Is this safe?”
And that is the nightmare any developer has the first time he or she skips the code signature.
Code signing is not merely another feature that is nice to have. Your passport to your app. And it is what Windows (and your users) tells.
“This app is legit. It consists of a trusted developer, and it has not been altered or changed.”
In its absence, a window issue that tacky ‘Unknown Publisher warning‘ right in the face of your user. Your application immediately becomes suspicious. And, speaking the truth, users do not install suspicious applications.
None of the code signing = immediate trust problems. But when you do sign your code, everything changes.
And suddenly… You look credible. You look professional. You look like a developer who means business.
We need the following requirements before commencing:
Token-based certificates are not recommended to implement code signing on macOS or Linux builds of Windows. Use Windows.
Recommended: How to Code Signing an Electron.js App for macOS?
You know that little blue tick you see next to verified accounts on social media? It instantly tells you:
“Yep, this person is real.” A code signing certificate does the same thing, but for your app. It’s your app’s verified badge, your way of telling Windows (and your users). “Hey, this software actually came from me, not some shady imposter on the internet.”
When your app is signed with one, Windows trusts it. Users trust it. And that dreaded “Unknown Publisher” message disappears.
Now, where do you get one? You can’t just generate it out of thin air (well, not a trusted one). You’ll need to buy it from a Certificate Authority (CA). These are trusted organisations that verify developers and issue legitimate certificates.
Note: The secret key is non-exportable. There will be no .pfx or .p12 file. Operation signing is carried out within secure hardware or operated HSM services.
The middleware provided by the CA will have to be installed in order to enable Windows to access the code signing certificate.
Beforehand, make sure that the middleware service is running.
Recommended: Guide to Install SafeNet Client Software, Initiate and Reset eToken
Ensure that Windows identifies with the certificate and the key.
certutil -store My
In case the certificate is not displayed, revisit the middleware installation.
npm install electron-builder -g
npx electron-builder -version
Confirm Electron Builder is executed successfully and then moves on.
Make sure your Electron project is compiling and does not sign before switching on code signing.
This is instead of simultaneous debugging and signing problems.
Defining the build configuration is done by opening the package.json file of your project.
{
"build": {
"appId": "com.yourcompany.yourapp",
"productName": "Your App Name",
"directories": {
"output": "dist"
},
"win": {
"target": "nsis",
"signingHashAlgorithms": ["sha256"]
}
}
}
npx electron-builder --win
Check the digital signature before distribution.
signtool verify /pa /v dist/YourApp Setup.exe
Installers should not be distributed without signatures or signed partially.
After correcting the problem, rebuild it again.
Recommended: Key Management Best Practices to Avoid Cryptographic Failures
This tutorial represents a fully working, modern workflow for signing Windows Electron applications with Electron Builder.
Prevent Code Tampering and Authenticate Code Integrity by Digitally Sign your Code with Trusted Code Signing Certificates.
Janki Mehta is a Cyber-Security Enthusiast who constantly updates herself with new advancements in the Web/Cyber Security niche. Along with theoretical knowledge, she also implements her practical expertise in day-to-day tasks and helps others to protect themselves from threats.