Sorry I didn’t reply to this earlier. I’m not sure how I missed your replies last August. I’m also not sure why your code is failing, and there’s too much there for me to check line-by-line. However, I have a general debugging process for issues like this. The basic idea idea is to dump the contents of the keychain after each step to make sure that the stuff you think you’ve set is actually set. In your case that means three probes: One after you create the private key, to see its attributes. One after you add the certificate, to see its attributes. One after the identity lookup fails, to see if any identities are available and what they’re attributes are. As to what these probes look like, I recently updated SecItem: Pitfalls and Best Practices with some suggestions on that front. First, the Starting from Scratch section explains how to reset the keychain so that each of your tests starts from a known clear state. Second, the Lost Keychain Items, Redux section explains how to dump all the attributes