【问题标题】:MacOS codesign for java applications, which files should I codesign用于 Java 应用程序的 MacOS 协同设计,我应该对哪些文件进行协同设计
【发布时间】:2021-09-08 23:04:14
【问题描述】:

我们有一个相当大的 Java 桌面应用程序(~1.5gb),还有很多库。 到目前为止,我将它转换为适用于 macOS 的 .app 包(没有问题) 我想公证这个应用程序。 使用 --deep 运行 codesign 不起作用,我了解到我应该手动将 codesign 命令应用于单个文件,而不是 --deep。

但我的问题是,我不知道应该将哪些文件应用于 codesign,我阅读的一些博客应该应用所有内容(如 .xml、.png、.properties、.xsd ...)

我写了一个小python脚本,遍历每个文件并应用到codesign,(如果文件是.jar或.zip,它会提取它们适用于codesign所有文件,然后再次将它们打包到.jar,.zip) 但这花了很多时间,我真的很困惑,我应该为每个文件(包括像 slf4j、spring、hibernate 等的库 jars)运行 codesign 命令,还是应该为一些特定的文件类型运行,比如 .jnilib,. dylib 和可执行二进制文件?

编辑:好的,我尝试了 --deep 并发送公证,然后公证过程当然会向我发回错误列表。我手动将代码设计应用于这些可执行文件

例如错误是这样的:

  "issues": [
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/org/xerial/sqlite-jdbc/3.30.1/sqlite-jdbc-3.30.1.jar/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib",
      "message": "The binary is not signed.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/org/xerial/sqlite-jdbc/3.30.1/sqlite-jdbc-3.30.1.jar/org/sqlite/native/Mac/x86_64/libsqlitejdbc.jnilib",
      "message": "The signature does not include a secure timestamp.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/lib/libPDFParser.dylib",
      "message": "The binary is not signed.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/lib/libPDFParser.dylib",
      "message": "The signature does not include a secure timestamp.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/lib/libPdfViewerAPI.dylib",
      "message": "The binary is not signed.",
      "docUrl": null,
      "architecture": "x86_64"
    },
    {
      "severity": "error",
      "code": null,
      "path": "myApp.zip/myApp.app/Contents/Java/lib/libPdfViewerAPI.dylib",
      "message": "The signature does not include a secure timestamp.",
      "docUrl": null,
      "architecture": "x86_64"
    },
...
...

然后对于每个错误,运行代码设计(再次使用 -f 和 --deep 标志),但是当我尝试使用验证时

codesign --verify --verbose=4 "myApp.app"

得到这两个错误:

judocu.app: a sealed resource is missing or invalid
file modified: /myApp.app/Contents/Java/lib/libPDFParser.dylib
file modified: /myApp.app/Contents/Java/lib/libPdfViewerAPI.dylib

我再次尝试使用 codesign 对这两个 dylib 进行签名,但在替换签名后,再次出现相同的错误

codesign -f -s "Developer ID Application: myDevIdAcc (MF9Q4L4SBE)" --entitlements entitlements.plist myApp.app/Contents/Java/lib/libPdfViewerAPI.dylib

有人知道可能是什么问题吗?

【问题讨论】:

  • 您的应用中如何拥有 1.5 个演出?
  • 图片等资源,大量的库。

标签: java macos codesign


【解决方案1】:

我这样解决:我为公证返回给我的每个错误运行 codesign,而不关心 codesign --verify 的错误, 我的过程是这样的:

  • codesign公证错误日志中的所有文件,如果是jar文件,解压codesign相关文件,重新make jar,codesign jar文件。
  • 再次使用 --deep 对整个 .app 包进行代码设计
  • 送去公证

并且成功了 我仍然不知道我应该对哪些特定文件进行代码设计以及 --deep 的实际作用,但我认为有时代码设计 --verify 可能会产生误导。

【讨论】:

    猜你喜欢
    • 2014-11-01
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多