iOS如何使用ASyncSocket进行SSL握手?

iOS如何使用ASyncSocket进行SSL握手?,ios,ssl,asyncsocket,handshake,Ios,Ssl,Asyncsocket,Handshake,我已使用ASyncSocket通过套接字连接成功连接服务器。现在,我尝试使用SSL握手来连接服务器和SSL。你知道怎么做吗 AsyncSocket的ConnectTest示例显示了如何实现安全设置 - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port { NSMutableDictionary *settings = [NSMutableDictionary di

我已使用ASyncSocket通过套接字连接成功连接服务器。现在,我尝试使用SSL握手来连接服务器和SSL。你知道怎么做吗

AsyncSocket的ConnectTest示例显示了如何实现安全设置

- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
    NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:3];
     [settings setObject:@"www.paypal.com" forKey:(NSString *)kCFStreamSSLPeerName];
    [sock startTLS:settings];

// To connect to a test server, with a self-signed certificate, use settings similar to this:

//  // Allow expired certificates
    //  [settings setObject:[NSNumber numberWithBool:YES]
    //               forKey:(NSString *)kCFStreamSSLAllowsExpiredCertificates];
    //  
    //  // Allow self-signed certificates
    //  [settings setObject:[NSNumber numberWithBool:YES]
    //               forKey:(NSString *)kCFStreamSSLAllowsAnyRoot];
    //  
    //  // In fact, don't even validate the certificate chain
    //  [settings setObject:[NSNumber numberWithBool:NO]
    //               forKey:(NSString *)kCFStreamSSLValidatesCertificateChain];
    }