<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/kCFStreamPropertySSLContext",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@kCFStreamPropertySSLContext"
  },
  "title" : "kCFStreamPropertySSLContext"
}
-->

# kCFStreamPropertySSLContext

```
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)