Perigee 14 Newbie Poster

Hi, I just experienced this issue after upgrading Xcode to 4.3.3, and thought the fix might be useful to others. The original fix is posted here and modified here.

Create the file readcert.m with the following code:

#import <Security/Security.h>
#import <Foundation/Foundation.h>

void checkCerts () {
    OSStatus status;

    const void *keys[] = {
        kSecClass,
        kSecReturnRef,
        kSecMatchLimit
    };
    const void *values[] = {
        kSecClassCertificate,
        kCFBooleanTrue,
        kSecMatchLimitAll
    };
    CFDictionaryRef query = CFDictionaryCreate(NULL, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

    CFArrayRef results;
    if ((status = SecItemCopyMatching((CFDictionaryRef) query, (CFTypeRef *)&results)) != noErr) {
        NSLog(@"Failed to copy certificates: %d", status);
        return;
    }

    CFIndex count = CFArrayGetCount(results);
    CFIndex i;
    for (i = 0; i < count; i++) {
        SecCertificateRef cert = (SecCertificateRef) CFArrayGetValueAtIndex(results, i);
        CFErrorRef error;
        CFDictionaryRef vals = SecCertificateCopyValues(cert, NULL, &error);
         if (vals == NULL) {
            CFStringRef subjectSummary = SecCertificateCopySubjectSummary(cert);
              NSLog(@"Found a triggering certificate: %@", subjectSummary);
         }
    }

    CFRelease(results);
}

int main (int argc, char *argv[]) {
    NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
    checkCerts();
    [p release];

    return 0;
}

Compile in the terminal:

clang -o readcert readcert.m -framework Security -framework Foundation

Then run:

./readcert

It should output names of the bad certs. You can delete it from my keychain, but but for best results try executing the following command:

sudo security delete-certificate -c NAME_OF_BAD_CERT

This fixed worked for me ;)

Dani commented: Thanks for posting +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.