about:benjie

Random learnings and other thoughts from an unashamed geek

OSStatus iPhone SDK Meanings

| Comments

Image representing iPhone as depicted in Crunchbase

If you’ve got a line like this:

1
 LOGGING_FACILITY1( sanityCheck == noErr, @"Problem adding private key, OSStatus == %d.", sanityCheck );

But you don’t know what the OSStatus value means, and you’re devving on iPhone, here’s the answers:

OSStatus definition - what the different codes mean.
1
2
3
4
5
6
7
8
9
10
11
12
 enum
 {
 errSecSuccess                = 0,       /* No error. */
 errSecUnimplemented          = -4,      /* Function or operation not implemented. */
 errSecParam                  = -50,     /* One or more parameters passed to a function where not valid. */
 errSecAllocate               = -108,    /* Failed to allocate memory. */
 errSecNotAvailable           = -25291,  /* No keychain is available. You may need to restart your computer. */
 errSecDuplicateItem          = -25299,  /* The specified item already exists in the keychain. */
 errSecItemNotFound           = -25300,  /* The specified item could not be found in the keychain. */
 errSecInteractionNotAllowed  = -25308,  /* User interaction is not allowed. */
 errSecDecode                 = -26275,  /* Unable to decode the provided data. */
 };

This was taken from /Developer/Platform/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h (so quite easy to find then… NOT!) because SecCopyErrorMessageString doesn’t work on iPhone OS. I hope this helps you - if it does, let me know in the comments! To help you find this in the search engines this might be triggered if you are using SecItemAdd, SecItemCopyMatching or any of the other keychain services in the iPhone SDK. You might be using Apple’s [SecKeyWrapper sharedWrapper] functions too… Anything security related really. Or private key, public key, asymmetric key, signing, blah blah blah.

Comments