• 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
Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?


  • Subject: Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?
  • From: email@hidden
  • Date: Tue, 19 Jun 2012 16:58:47 +0000
  • Acceptlanguage: en-US
  • Thread-topic: Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?

 

Hi,

I'm a newbie in iOS network programming, so please forgive my ignorance.

 

I'm in a situation where a client opens an initial socket communication to the server. A brief exchange of un-encoded messages is sent, which directs both sides to use a new protocol which utilizes SSL to encode the rest of the sessions messages.  Is it legitimate to transition from TCP_CLEAR to SSL_ANON once the connection is made?

 

As an experiment, I've tried the following code to try to get the SSL context, & then hopefully transition to SSL later.  The problem is that the calls to get the properties kCFStreamPropertySSLContext or CFReadStreamGetStatus come back with invalid (nil) pointers:

 

-(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {

            if(isPrimaryConnection)

                {

                int readLength = sizeof(APCP_MSG_HDR);

                [socket readDataToLength:readLength withTimeout:SOCKET_TIMEOUT tag:READ_APCP_HEADER];

            \\   SNIP

                CFReadStreamRef stream = [sock getCFReadStream];

                CFDataRef data = "" style='color:#5C2699'>CFDataRef) CFReadStreamCopyProperty(stream, kCFStreamPropertySSLContext);

                CFDataRef data2 = (CFDataRef) CFReadStreamGetStatus(stream);

. . .

 

 

Is there a way to do this? Any suggestions or alternatives would be appreciated.

 

Thanks

 

 

George Griffin

 

 _______________________________________________
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

  • Prev by Date: Re: Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?
  • Next by Date: NSURLConnections being dropped on the floor?
  • Previous by thread: Re: Question: is it possible to open a client-server socket in "clear" mode, and then transition that connection to SSL?
  • Next by thread: NSURLConnections being dropped on the floor?
  • Index(es):
    • Date
    • Thread