Descriptive Error Messages for the Security Framework

Document Sample
scope of work template
							Descriptive Error Messages for the Security Framework




Descriptive Error Messages for the Security Framework
Friday, May 19, 2006

Have you ever wondered how to translate OSStatus codes like -9612 from e.g. SSLHandshake() to
something user presentable using Cocoa?

Here is how! NSString* OPStringForSecErrorCode(OSStatus status) /*" Returns the error string
from the SecErrorMessages.strings    file found in the Security.framework bundle for the error
(status)   code given. "*/ {    NSBundle* secBundle = [NSBundle bundleWithIdentifier:
@"com.apple.security"]; // Convert status to Int32 string representation, e.g. "-25924":
NSString* keyString = [NSString stringWithFormat: @"%d", status];           NSString* errorString =
[secBundle localizedStringForKey: keyString                                      value: keyString
                             table: @"SecErrorMessages"]; return errorString; }

This code is also part of the BSD-licensed OPNetwork.framework (OPSSLSocket class).

Have fun!

Dirk




                                                Page 1/1

						
Related docs
Other docs by cgg16615
Internet Explorer Error Messages Explained
Views: 17  |  Downloads: 0
micro lynx error messages
Views: 21  |  Downloads: 0
DIAMOND 8+ PREDI CLAIMS BATCH ERROR MESSAGES
Views: 34  |  Downloads: 0
An explanation of error messages of ASF
Views: 2  |  Downloads: 0
DBCONN Error Messages
Views: 82  |  Downloads: 0