I have created a XPC server and client using C APIs. I want to ensure that I trust the client, so I want to have a codesigning requirement on the server side, something like -
xpc_connection_set_peer_code_signing_requirement(listener, "anchor apple generic and certificate leaf[subject.OU] = \"1234567\"")
This checks if the client code was signed by a code-signing-identity issued by Apple and that the teamID in the leaf certificate is 1234567.
My questions are-
- Is using teamID as a signing requirement enough? What else can I add to this requirement to make it more secure?
- How does
xpc_connection_set_peer_code_signing_requirementwork internally? Does it do any cryptographic operations to verify the clients signature or does it simply do string matching on the teamID? - Is there a way actually verify the clients signature(cryptographically) before establishing a connection with the server? (so we know the client is who he claims to be)