macOS and Windows code signing is supported. Windows is dual code-signed (SHA1 & SHA256 hashing algorithms).
On a macOS development machine valid and appropriate identity from your keychain will be automatically used.
||The HTTPS link (or base64-encoded data, or
||The password to decrypt the certificate given in
||macOS-only Name of certificate (to retrieve from login.keychain). Useful on a development machine (not on CI) if you have several identities (otherwise don't specify it).|
||The keychain name. Used if
If you are building Windows on macOS and need to set a different certificate and password (than the ones set in
CSC_* env vars) you can use
To sign an app on Windows, there are two types of certificates:
- EV Code Signing Certificate
- Code Signing Certificate
Both certificates work with auto-update. The regular (and often cheaper) Code Signing Certificate shows a warning during installation that goes away once enough users installed your application and you've built up trust. The EV Certificate has more trust and thus works immediately without any warnings. However, it is not possible to export the EV Certificate as it is bound to a physical USB dongle. Thus, you can't export the certificate for signing code on a CI, such as appveyor. If you are using an EV Certificate, you need to provide win.certificateSubjectName in your electron-builder configuration.
Travis, AppVeyor and other CI Servers
To sign app on build server you need to set
- Export certificate. Consider to not use special characters (for bash) in the password because “values are not escaped when your builds are executed”.
Encode file to base64 (macOS:
base64 -i yourFile.p12 -o envValue.txt, Linux:
base64 yourFile.p12 > envValue.txt).
*.p12file (e.g. on Google Drive, use direct link generator to get correct download link).
CSC_KEY_PASSWORDenvironment variables. See Travis or AppVeyor documentation. Recommended to set it in the CI Project Settings, not in the
appveyor.yml. If you use link to file (not base64 encoded data), make sure to escape special characters (for bash) accordingly.
In case of AppVeyor, don't forget to click on lock icon to “Toggle variable encryption”.
Keep in mind that Windows is not able to handle enviroment variable values longer than 8192 characters, thus if the base64 representation of your certificate exceeds that limit, try re-exporting the certificate without including all the certificates in the certification path (they are not necessary, but the Certificate Manager export wizard ticks the option by default), otherwise the encoded value will be truncated.
Where to Buy Code Signing Certificate
How to Export Certificate on macOS
- Open Keychain.
Select all required certificates (hint: use cmd-click to select several):
Developer ID Application:to sign app for macOS.
3rd Party Mac Developer Application:and
3rd Party Mac Developer Installer:to sign app for MAS (Mac App Store).
Developer ID Application:and
Developer ID Installerto sign app and installer for distribution outside of the Mac App Store.
Mac Developer:to sign development builds for testing Mac App Store submissions (
mas-devtarget). You also need a provisioning profile in the working directory that matches this certificated and the device being used for testing.
Please note – you can select as many certificates, as need. No restrictions on electron-builder side. All selected certificates will be imported into temporary keychain on CI server.
- Open context menu and
How to Disable Code Signing During the Build Process on macOS
To disable Code Signing when building for macOS leave all the above vars unset except for
CSC_IDENTITY_AUTO_DISCOVERY which needs to be set to
false. This can be done by running
Another way — set
null. You can pass adiitional configuration using CLI as well: