I have a nodejs app, made into a single executable using pkg which signs the app with an ad-hoc signature. This single executable (xkeys-server-arm64)works fine on the machine which made it but fails on another machine of the same type - presumably because the ad-hoc signature is insufficient in this case.
I've tried to replace the ad-hoc signature with my own, using:
codesign --force --verify --verbose --sign "Developer ID Application: Christoph Willing (..........)" xkeys-server-arm64
but that fails with
xkeys-server-arm64: replacing existing signature
xkeys-server-arm64: errSecInternalComponent
Checking my own signature with:
find-identity -v -p appleID
shows a bunch of stuff which doesn't look good.
My Christoph_Willing_dev_CA
entry says
(CSSMERR_TP_NOT_TRUSTED)
All other entries, including the Developer ID Application
entry I'm trying to codesign with have the comment:
(Missing required extension)
My questions are:
- what causes the
errSecInternalComponent
error (and how can I fix it)? - why isn't my dev_CA trusted (and how to fix)?
- what are the missing extensions for the other certificates (and how to provide them)?
Thanks for any tips,
chris
presumably because the ad-hoc signature is insufficient in this case.
Right.
There’s two ways you can approach this:
-
Fix your code signing issue.
-
Avoid the whole problem by continuing with your ad hoc signature.
I have some notes about the first but, before going down that path, I’d like to tackle the second. And apropos that, you wrote:
This single executable … works fine on the machine which made it but fails on another machine of the same type
You can, in general, copy ad hoc signed code from one machine to another and it will run. The sticking point here is quarantine. If you copy the code in a way that sets quarantine, it’ll be blocked by Gatekeeper.
This leaves you with a choice:
-
If you’re copying the code around internally — say from a development machine to a test machine — the easiest solution is to bypass Gatekeeper by either copying the code in a way that doesn’t apply quarantine (
scp
, for example) or removing the quarantine extended attribute from the file (usingxattr
). -
If you plan to distribute the code more wildly, I recommend that you sort out code signing and notarisation.
As to your code signing issue, my experience is that this has two common causes, explained in this post.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"