电子公证问题未签署所有二进制文件

问题描述 投票:0回答:1

我在电子公证方面遇到了奇怪的问题。 我按照本页上的教程进行操作:https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/

看起来非常彻底,所以我不知道我错过了什么。 一切都运行良好,直到 notarize.js:

require('dotenv').config();
const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
  const { electronPlatformName, appOutDir } = context;  
  if (electronPlatformName !== 'darwin') {
    return;
  }

  const appName = context.packager.appInfo.productFilename;

  return await notarize({
    appBundleId: 'com.oriolgomez.beatstar',
    appPath: `${appOutDir}/${appName}.app`,
    appleId: process.env.APPLEID,
    appleIdPassword: process.env.APPLEIDPASS,
  });
};

公证日志是这样的:

{
  "logFormatVersion": 1,
  "jobId": "de0d8e6d-2f5b-4937-b2eb-124b0e831281",
  "status": "Invalid",
  "statusSummary": "Archive contains critical validation errors",
  "statusCode": 4000,
  "archiveFilename": "beatstar.zip",
  "uploadDate": "2020-10-02T08:02:04Z",
  "sha256": "e85e189e57f04af30f21e2040580830167a7f704ea6ab70b8f315e3cc9cb6a80",
  "ticketContents": null,
  "issues": [
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/MacOS/beatstar",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper (GPU).app/Contents/MacOS/beatstar Helper (GPU)",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvk_swiftshader.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/ReactiveCocoa",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper.app/Contents/MacOS/beatstar Helper",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper (Plugin).app/Contents/MacOS/beatstar Helper (Plugin)",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper (Renderer).app/Contents/MacOS/beatstar Helper (Renderer)",
      "message": "The binary is not signed with a valid Developer ID certificate.",
      "docUrl": null,
      "architecture": "x86_64"
    }
  ]
}
electron
1个回答
11
投票

我不知道我遇到这个问题的原因是否与你的相同,但这是我发现的,以防这对其他人有帮助。

在手动公证您的应用程序(使用电子公证)之前,请确保您用于签署应用程序的证书type正确。您特别需要一张

Developer ID Application
证书(最后一张):

Apple Developer certificate type selection

我之前一直用

Apple Distribution
,所以公证失败。您看到的文件列表可能是 Apple 检查的前几个文件,它们使用了错误类型的证书进行签名(不要引用我的话),因此失败了。

无论哪种方式,一旦我生成了

Developer ID Application
证书,就可以这样定义我的权利:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
  </dict>
</plist>

并在我的

build
package.json
部分使用此配置:

    "mac": {
      "category": "public.app-category.developer-tools",
      "icon": "assets/icon.png",
      "hardenedRuntime": true,
      "gatekeeperAssess": false,
      "entitlements": "assets/mac/entitlements.plist",
      "entitlementsInherit": "assets/mac/entitlements.plist"
    },
    "afterSign": "./scripts/notarizeApp.js",

我能够获得工作所需的公证。

这就是我的 notarizeApp 脚本的样子,FWIW:

const path = require('path')
var notarize = require('electron-notarize')

module.exports = async function (params) {
  // Notarization only applies to macOS
  if (process.platform !== 'darwin') {
    return
  }

  let appId = '<your-app-id>'
  let appPath = path.join(
    params.appOutDir,
    `${params.packager.appInfo.productFilename}.app`
  )

  try {
    console.log(`  • Notarizing`)
    await notarize.notarize({
      appBundleId: appId,
      appPath: appPath,
      appleId: process.env.APPLE_ID_EMAIL,
      appleIdPassword: process.env.APPLE_ID_PASSWORD,
    })
  } catch (error) {
    console.error(error)
  }
}

这个应用程序对于检查公证是否成功非常有用(Taccy): https://electiclight.co/taccy-signet-precize-alifix-utiutility-alisma/

© www.soinside.com 2019 - 2024. All rights reserved.