For anyone having an issue with code signing their app with the --generate-entitlement-der
on macOS Catalina, here is what I did today as a workaround:
(1) Built an Ad-Hoc iOS app that targeted iOS 13 on macOS Catalina. I checked the Page size on the signature and saw the missing -7
value:
$ codesign -dvvvvv MyTestApp.app
...
Page size=4096
-5=7c741a970873bb7f6a05c1ad5b9425f4b5b1ac86645b2cb8c842a57f51818eb5
-4=0000000000000000000000000000000000000000000000000000000000000000
-3=f7ddc8d932def2f393dfc1719252e61b1561afeed76d32044ae0cd793e380bc6
-2=904f563968898c7569794e19bcd9304d46ca5c0b9f09c792081bdb8ec9c04c92
(2) I tried to install this build from macOS Monterey to an iOS 15 device and received the following error message for (The code signature version is no longer supported):
default 11:41:15.649815-0700 installd 0x16be2b000 -[MIInstaller performInstallationWithError:]: Installing <MIInstallableBundle ID=com.dts.MyTestApp.app-mattsignature; Version=1, ShortVersion=1.0>
default 11:41:15.649936-0700 installd com.dts.MyTestApp-mattsignature:7:5:1:1:Start : Install (New)
default 11:41:15.720695-0700 installd 0x16be2b000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 74: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.pEXcje/extracted/Payload/MyTestApp.app : 0xe8008029 (The code signature version is no longer supported.)
(3) From here I resigned the MyTestApp.app on macOS Catalina with the --generate-entitlement-der
flag:
$ codesign -s "DTS Matt Eaton (xxxxxxxxxx)" -f --preserve-metadata --generate-entitlement-der MyTestApp.app
Warning: default usage of --preserve-metadata implies "resource-rules" (deprecated in Mac OS X >= 10.10)!
MyTestApp.app: replacing existing signature
(4) From here I checked the Page size on the resigned app and saw that -7 is now available.
$ codesign -dvvvvv MyTestApp.app
Executable=/path/to/MyTestApp.app/MyTestApp
Identifier=com.dts.MyTestApp-mattsignature
...
Page size=4096
-7=915c86eb5653ea2122901068e9735fd3c98d7622ab9aefe478e3c358a9a8ffeb
-6=0000000000000000000000000000000000000000000000000000000000000000
-5=7c741a970873bb7f6a05c1ad5b9425f4b5b1ac86645b2cb8c842a57f51818eb5
-4=0000000000000000000000000000000000000000000000000000000000000000
-3=6f00b3831b7c1a3ba39fbfe9fc3a4f2267816bbd2c8d77e1aac17fb1726cf9f3
-2=904f563968898c7569794e19bcd9304d46ca5c0b9f09c792081bdb8ec9c04c92
CDHash=2a38a2b310e7a46c8e88a6f82f50fa31138fd894
(5) From here, I needed to zip up my Payload/MyTestApp.app directory again and then rename it with an ipa extension.
(6) After that I was able to install and run MyTestApp.app properly on an iOS 15 device from macOS Monterey.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com