• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
kCFStreamPropertySSLPeerCertificates issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kCFStreamPropertySSLPeerCertificates issue


  • Subject: kCFStreamPropertySSLPeerCertificates issue
  • From: Kevin Yu <email@hidden>
  • Date: Wed, 07 Aug 2013 18:17:41 +0800

in iOS platform, I tried to get server's ssl certificate and have code like the following:

        case NSStreamEventOpenCompleted:
            NSLog(@"connected");
            if (aStream == self.netInputStream) {
                //try to verify the certificate from server.
                NSArray* certificates = (NSArray*)CFBridgingRelease(CFReadStreamCopyProperty((CFReadStreamRef)aStream, kCFStreamPropertySSLPeerCertificates));
                if ([certificates count]>0) {
                    SecCertificateRef  certificate = (__bridge SecCertificateRef) [certificates objectAtIndex:0];
                    NSString * description = (NSString*)CFBridgingRelease(SecCertificateCopySubjectSummary(certificate));
                  //NSData* data = "" *) CFBridgingRelease(SecCertificateCopyData(certificate));

                    

                    NSLog(@"description=%@",description);
                }

                

            }
            break;

However, the Xcode said there's error

Undefined symbols for architecture i386:
  "_kCFStreamPropertySSLPeerCertificates", referenced from:
      -[DrayStream stream:handleEvent:] in DrayStream.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


when I checked the CFSocketStream.h it said the kCFStreamPropertySSLPeerCertificates is considered deprecated in Mac OS 10.6 and later.

My question are:
1. Is there anything wrong in my code? and how to correct it?
2. If kCFStreamPropertySSLPeerCertificates is deprecated, what's the right way to do the job?

Any help is appreciated.

regards,
Kevin
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: kCFStreamPropertySSLPeerCertificates issue
      • From: Jens Alfke <email@hidden>
  • Prev by Date: kCFStreamPropertySSLPeerCertificates issue
  • Next by Date: Re: kCFStreamPropertySSLPeerCertificates issue
  • Previous by thread: kCFStreamPropertySSLPeerCertificates issue
  • Next by thread: Re: kCFStreamPropertySSLPeerCertificates issue
  • Index(es):
    • Date
    • Thread