I have a macOS System Extension for a USB device driver. It works when I disable SIP and manually sign using my codesign identity (generated from my Apple ID using "security find-identity" from Terminal) - as described here: https://github.com/knightsc/USBApp/issues/1
I can activate and deactivate the dext and use it with a device when activated - examples of what I did and ended up with are here:
Migrating a codeless KEXT to a codeless DEXT
and here:
Getting OSSystemExtensionErrorCodeSignatureInvalid After Codeless DEXT is Activated
I was granted an entitlement by Apple and followed the steps they outlined to create a provisioning profile, then downloaded and installed it. I then followed the steps referenced in the entitlement email from Apple for manually signing an app: https://help.apple.com/xcode/mac/current/#/dev1bf96f17e
I rebuilt my app and deactivated all existing instances of my driver. When I try to activate the new driver, the activation request fails with the entitlements error: "Error Domain=OSSystemExtensionErrorDomain Code=8", which I know is an indication of an entitlements/signing problem.
What is the proper way to use the provisioning profile from Apple to sign my app and driver?
Do I need to update my entitlements file? Here are my existing files:
App
<?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.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.developer.system-extension.install</key>
<true/>
<key>com.apple.developer.system-extension.uninstall</key>
<true/>
</dict>
</plist>
Dext
<?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.developer.driverkit</key>
<true/>
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<integer>LEGACY VID</integer>
<key>idProductArray</key>
<array>
<integer>PID1</integer>
<integer>PID2</integer>
<integer>PID3</integer>
<integer>PID4</integer>
<integer>PID5</integer>
</array>
</dict>
<dict>
<key>idVendor</key>
<integer>NEW VID</integer>
<key>idProductArray</key>
<array>
<integer>PID6</integer>
</array>
</dict>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
Any help would be appreciated.
Update:
The App ID for the application has the System Extension capability, but not the additional DriverKit capability.
The App ID for the dext has the additional DriverKit capability.
The provisioning profile for the App has
- com.apple.developer.driverkit set true
- com.apple.application-identifier set to <Team ID>.<App Bundle Identifier>
- keychain-access-groups set to <Team ID>.*
- com.apple.developer.system-extension.install set to true
- com.apple.developer.team-identifier set to Team ID
The provisioning profile for the Dext has
- com.apple.developer.driverkit set true
- com.apple.application-identifier set to <Team ID>.<Driver Bundle Identifier>
- keychain-access-groups set to <Team ID>.*
- com.apple.developer.team-identifier set to Team ID
Update 2:
Here is the process I am following to generate a provisioning profile:
Register an New Provisioning Profile - I select "Developer ID" under "Distribution", at the very bottom. That is also what my generated certificate is for.
Generate a Provisioning Profile - Profile type "Mac" and I select an App ID.
Select Certificates - Select a certificate that is compatible with the distribution mode.
Additional Entitlements - Select entitlement "DriverKit and System Extension Template for Mac Dev ID profile/Mac Direct Dist Profile" That causes "Extended Entitlements" to show up with "com.apple.developer.driverkit" set to "true"
Review, Name and Generate. - Provisioning Profile Name - Select a name and generate, then download and install.
Update 3:
I filed a support request, and finally got the response "we have contacted the DriverKit entitlement screener to have your entitlement template updated to include the USB Transport entitlement" Hopefully that is progress!
I use the entitlements that are embedded in the provisionprofile generated in the Certificates, Identifiers and Profiles page in the apple developer account.
For both the app and dext I create an "identifier", with the correct entitlement ("System Extension" for the app and from the Additional Capabilities the DriverKit "USB Transport - VendorID" for the dext.)
Then, generate two profiles, one for the app and one for the dext. Download those.
You can then generate a plist for the app and the dext with this makefile rule:
This guarantees that the entitlements you use will match what your provisionprofile specifies.
If you don't have the correct entitlements in your provisionprofile you either did not select the correct ones. Or you have not been granted the correct entitlements by Apple (and therefore they are not available to select when creating the Identifier.)