Contents

kCFStreamPropertySSLContext

Declaration

let kCFStreamPropertySSLContext: CFString

Discussion

The SSLContextRef object used for read and write operations on a stream.

Before opening a stream, you can copy the object from this property and configure it using the Secure Transport API. You can also set this property to specify a new SSLContextRef for a stream. The behavior depends on whether the stream has been opened and on whether an SSL context is associated with the stream, as follows:

  • If the stream has not been opened, the specified object replaces any existing context, and is used in the initial stream handshake when the connection is opened.

  • If the stream has been opened without SSL enabled, setting this property initiates an SSL handshake over the existing socket.

  • After the initial SSL handshake occurs, changing the context object is unsupported.

If an SSL settings dictionary is set for the kCFStreamPropertySSLSettings key, an SSLContextRef object is created internally and configured based on that dictionary. However, if an SSLContextRef object is set afterwards, its configuration takes precedence over the previously configured context.

See Also

Streams