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

Electron 电子公证问题没有签署所有二进制文件,electron,Electron,我在电子公证方面遇到了奇怪的问题。 我遵循了本页上的教程: 这似乎是相当彻底,所以我不知道我错过了什么。 在公证之前一切正常。js: require('dotenv').config(); const { notarize } = require('electron-notarize'); exports.default = async function notarizing(context) { const { electronPlatformName, appOutDir } = co

我在电子公证方面遇到了奇怪的问题。 我遵循了本页上的教程:

这似乎是相当彻底,所以我不知道我错过了什么。 在公证之前一切正常。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,
  });
};
公证日志如下所示: { 日志格式版本:1, 作业ID:de0d8e6d-2f5b-4937-b2eb-124b0e831281, 状态:无效, statusSummary:存档包含关键验证错误, 状态代码:4000, archiveFilename:beatstar.zip, 上传日期:2020-10-02T08:02:04Z, sha256:e85e189e57f04af30f21e2040580830167a7f704ea6ab70b8f315e3cc9cb6a80, 票务内容:空, 问题:[ { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/MacOS/beatstar, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper GPU.app/Contents/MacOS/beatstar Helper GPU, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Electron Framework, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libEGL.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libswiftshader_libEGL.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libvk_swiftshader.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libGLESv2.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Libraries/libffmpeg.dylib, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Electron Framework.Framework/Versions/A/Helpers/chrome\u crashpad\u handler, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Squirrel, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A/reactivecoa, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/Mantle.framework/Versions/A/Mantle, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper.app/Contents/MacOS/beatstar Helper, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper Plugin.app/Contents/MacOS/beatstar Helper Plugin, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 }, { 严重性:错误, 代码:空, 路径:beatstar.zip/beatstar.app/Contents/Frameworks/beatstar Helper Renderer.app/Contents/MacOS/beatstar Helper Renderer, 消息:二进制文件未使用有效的开发人员ID证书签名。, docUrl:null, 架构:x86_64 } ]
}

我不知道是什么原因让我碰到这个 和你的一样,但这是我发现的,以防这对其他人有帮助

在使用electron公证器手动公证您的应用程序之前,请确保您为应用程序签名的证书类型正确。您特别需要开发人员ID应用程序证书最后一个:

我以前使用过苹果发行版,因此公证失败。您看到的文件列表可能是Apple检查的前几个文件,它们使用了不正确类型的证书进行签名。请不要在此引用我的话,因此它失败了

无论哪种方式,一旦我生成了开发人员ID应用程序证书,我就用以下方式定义了我的权利:

<?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>
我能够得到公证

这就是我的公证应用程序脚本的样子,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)
  }
}
此应用程序对于检查公证是否成功非常有用:
我不知道我遇到这件事的原因是否与你的相同,但以下是我的发现,以防这对其他人有所帮助

在使用electron公证器手动公证您的应用程序之前,请确保您为应用程序签名的证书类型正确。您特别需要开发人员ID应用程序证书最后一个:

我以前使用过苹果发行版,因此公证失败。您看到的文件列表可能是Apple检查的前几个文件,它们使用了不正确类型的证书进行签名。请不要在此引用我的话,因此它失败了

无论哪种方式,一旦我生成了开发人员ID应用程序证书,我就用以下方式定义了我的权利:

<?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>
我能够得到公证

这就是我的公证应用程序脚本的样子,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)
  }
}
此应用程序对于检查公证是否成功非常有用:

对于该库,这似乎非常具体。您可能还需要在中打开一个问题。我看到的第一个错误消息是二进制文件没有使用有效的开发人员ID证书签名。您是否使用了正确的开发人员证书?也是为了更好地了解您正在做的事情-您可以将您的electron builder配置添加到您的问题中吗?``appId:com.oriolgomez.beatstar目录:{output:dist,buildResources:build,}afterSign:build/Enjurized.js nodeGypRebuild:false npmRebuild:false win:target:-target:zip arch:-ia32 mac:hardenedRuntime:true gatekeeperAssess:false授权:build/Authentications.mac.plist授权Inherit:build/Authentications.mac.plist目标:-target:dmg arch:-x64电子转换:10.1.3``我不是在macOs上开发的,所以我不能再进一步了。electron builder具有环境变量CSC_NAME和CSC_KEYCHAIN。如果你能使用“编辑”按钮将你最后的评论内容添加到你的问题中,那将是非常好的。评论会定期删除,因此这些信息可能会丢失。这对于该库来说似乎非常具体。您可能还需要在中打开一个问题。我看到的第一个错误消息是二进制文件没有使用有效的开发人员ID证书签名。您是否使用了正确的开发人员证书?也是为了更好地了解您正在做的事情-您可以将您的electron builder配置添加到您的问题中吗?``appId:com.oriolgomez.beatstar目录:{output:dist,buildResources:build,}afterSign:build/Enjurized.js nodeGypRebuild:false npmRebuild:false win:target:-target:zip arch:-ia32 mac:hardenedRuntime:true gatekeeperAssess:false授权:build/Authentications.mac.plist授权Inherit:build/Authentications.mac.plist目标:-target:dmg arch:-x64电子转换:10.1.3``我不是在macOs上开发的,所以我不能再进一步了。electron builder具有环境变量CSC_NAME和CSC_KEYCHAIN。如果你能使用“编辑”按钮将你最后的评论内容添加到你的问题中,那将是非常好的。评论会定期删除,因此这些信息可能会丢失。