Hi
We are building an macOS application which integrates VPN functions right now. We are using developer ID ceritifcate to sign the app and system network extension and sandbox is enabled.
One issue we are facing now is that we need to establish mTLS connection to server. During this connection, we need to send client certificate to server via provideIdentity() API.
We have the certificate, key and p12 file which are generated in another daemon. But we can not use SecPkcs12Import function to import the p12 file in our system extension due to the sandbox limitation and the different context.
I know that we cannot construct secIdentity object by ourselves. So I am wondering if there is any way that we can get the secIdentity object in system extension?
Is it possible to send secIdentity object between app and system extension?
I knew I’d seen this before. I thought it might’ve been on DevForums but it turns out it was a DTS incident that Matt took.
The sandbox violation you’re seeing confirms that the sandbox has blocked accessing to the System keychain. This makes sense when you think of it as an App Sandbox. Sandboxed apps shouldn’t be able to access the System keychain. The problem comes up when you build an NE sysex, which are sandboxed but don’t have a per-user keychain that they can rely on.
My understanding is that your sysex needs long-term access to this digital identity, right? That is, you want to import it and then have persistent access to it, across restarts of your process and even restarts of the Mac.
If so, your best option is to store the digital identity in the System keychain, using a temporary exception entitlement to grant you access to it. Specifically, add this to your .entitlements
file:
<key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
<array>
<string>/Library/Keychains/</string>
</array>
IMO the fact that you have to do this is a a bug and I encourage you to file it as such. Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"