I have a SecTrustRef
object from the system that I'd like to evaluate myself. Just calling SecTrustEvaluateAsync
will be sufficient for this job. The problem is, I must evaluate it in a different process as only this other process has access to the keychains where the CA certificates are stored that may cause evaluation to succeed.
The two processes have an IPC link that allows me to exchange arbitrary byte data between them but I don't see any way to easily serialize a SecTrustRef
into byte data and deserialize that data back to an object at the other process. There doesn't seem to be a persistent storage mechanism for SecTrustRef
.
So am I overlooking something important here, or do I really have to get all the certs (SecTrustGetCertificateAtIndex
) and all the policies (SecTrustCopyPolicies
) and serialize these myself?
And if so, how would I serialize a policy?
For the certificate (SecCertificateRef
) it's rather easy, I just call SecCertificateCopyData
and later on SecCertificateCreateWithData
.
But for policies I can only call SecPolicyCopyProperties
on one side and later on SecPolicyCreateWithProperties
, however the later one requires a 2nd parameter, a policyIdentifier
and I see no way to get that value from an existing policy. What am I missing?