* The BLIPConnection receivedRequest: delegate method now returns BOOL. If the method returns NO (or if the method isn't implemented in the delegate), that means it didn't handle the message at all; an error will be returned to the sender.
* If the connection closes unexpectedly due to an error, then the auto-generated responses to pending requests will contain that error. This makes it easier to display a meaningful error message in the handler for the request.
5 // Created by Jens Alfke on 5/21/09.
6 // Copyright 2009 Jens Alfke. All rights reserved.
9 #import "TCPEndpoint.h"
10 #import "CollectionUtils.h"
11 #import <Security/Security.h>
14 /** These are some optional category methods for TCPEndpoint for dumping info about certificates.
15 They're useful if you're working with SSL connections, but they do link against the Security
16 framework, so they're moved into this extra file that you can choose to compile into your
19 @implementation TCPEndpoint (Certificates)
22 + (NSString*) describeCert: (SecCertificateRef)cert {
26 #if TARGET_OS_IPHONE && !defined(__SEC_TYPES__)
27 CFStringRef summary = NULL;
28 SecCertificateCopySubjectSummary(cert);
29 desc = $sprintf(@"Certificate[%@]", summary);
30 if(summary) CFRelease(summary);
32 CFStringRef name=NULL;
33 CFArrayRef emails=NULL;
34 SecCertificateCopyCommonName(cert, &name);
35 SecCertificateCopyEmailAddresses(cert, &emails);
36 desc = $sprintf(@"Certificate[\"%@\", <%@>]",
37 name, [(NSArray*)emails componentsJoinedByString: @">, <"]);
38 if(name) CFRelease(name);
39 if(emails) CFRelease(emails);
44 + (NSString*) describeIdentity: (SecIdentityRef)identity {
47 SecCertificateRef cert;
48 SecIdentityCopyCertificate(identity, &cert);
49 return $sprintf(@"Identity[%@]", [self describeCert: cert]);