I’ve looked into Apple’s Certificate reference, and I don’t see anything about removing certificates from the Keychain.
Is it allowed?
If so, how? If not, why not?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Certificates are a subtype of keychain items, so you can use
SecKeychainItemDeleteto remove them. To prevent compiler warnings, you’ll need to explicitly cast theSecCertificateRefto aSecKeychainItemRef— plain C doesn’t have language support for subclasses.If you target Mac OS 10.6 or later, you can also use the newer
SecItemDeleteAPI. It doesn’t provide any advantages in the simplest case, but you can change the query argument to delete multiple certificates at once, or delete certificates without having direct references to them.