- Get code signing certificate. Certificate must meet some criteria. Some options are listed below.
- Buy Extended Validation (EV) Code Signing Certificate
- Create a self-signed certificate (For testing purpose only).
- Install the certificate that you want to sign the file with.
- Import-Certificate can be used for this purpose
// Import certificate as Trusted Publisher
Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\TrustedPublisher
// Import certificate as a Root certificate authority.
Import-Certificate -FilePath .\code_signing.crt -Cert Cert:\CurrentUser\Root
- Sign the .msi file.
- Sign installer using SignTool
signtool sign /sha1 <CertificateHash> '.\Open Distro for Elasticsearch SQL ODBC Driver-<version>-Windows.msi'
- Alternatively, Set-AuthenticodeSignature can be used for adding digital signature.
Set-AuthenticodeSignature '.\Open Distro for Elasticsearch SQL ODBC Driver-<version>-Windows.msi' -Certificate (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert) -TimestampServer "http://timestamp.verisign.com/scripts/timstamp.dll"
Note: If you have a standard code signing certificate, some time will be needed for your application to build trust. Microsoft affirms that an Extended Validation (EV) Code Signing Certificate allows to skip this period of trust building. According to Microsoft, extended validation certificates allow the developer to immediately establish reputation with SmartScreen. Otherwise, the users will see a warning like "Windows Defender Smartscreen prevented an unrecognized app from starting. Running this app might put your PC at risk.", with the two buttons: "Run anyway" and "Don't run".
- Get a Developer ID Installer signing certificate
- Sign the installer package using
productsign. Do not useDeveloper ID Application certificate.
productsign -sign "Developer ID Installer: Your Apple Account Name (**********)" "~/Desktop/Open Distro for Elasticsearch SQL ODBC Driver-<version>-Darwin.pkg" "~/Desktop/signed-Open Distro for Elasticsearch SQL ODBC Driver-<version>-Darwin.pkg"
- Test installer package using spctl
spctl -a -v --type install "Desktop/Open Distro for Elasticsearch SQL ODBC Driver-<version>-Darwin.pkg"
Reference: https://help.apple.com/xcode/mac/current/#/deve51ce7c3d