Create a Code Signing Certificate for electron.js and add it to nsis installer for window 10

Create a Code Signing Certificate for electron.js and add it to nsis installer for window 10

How to Create a Self Signed Code Signing Certificate

You can create a self signed code signing certificate using OpenSSL. Or, for Windows 10 users, you can use PowerShell’s New-SelfSignedCertificate, an automated script that makes the job of creating such certificates easier for you. Just type in the command below to add your certificate to the certificate store:

$cert = New-SelfSignedCertificate -DNSName "www.domain.com" -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject “Example Code Signing Certificate”

or

$cert = New-SelfSignedCertificate -DNSName "www.domain.com" -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject “Example Code Signing Certificate”

$CertPassword = ConvertTo-SecureString -String "my_password" -Force -AsPlainText

Export-PfxCertificate -Cert "cert:\CurrentUser\My$($cert.Thumbprint)" -FilePath "C:\Cert$certificate.pfx" -Password $CertPassword

in package.json

"win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ],
      "icon": "assets/icon.png",
      "certificateFile": "C:\\Cert\\certificate.pfx",
      "certificatePassword": "my_password"
    }