<!--
{
  "availability" : [
    "iOS: 5.0.0 - 13.0.0",
    "iPadOS: 5.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.8.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SSLCreateContext(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SSLCreateContext"
  },
  "title" : "SSLCreateContext(_:_:_:)"
}
-->

# SSLCreateContext(_:_:_:)

Allocates and returns a new context.

```
func SSLCreateContext(_ alloc: CFAllocator?, _ protocolSide: SSLProtocolSide, _ connectionType: SSLConnectionType) -> SSLContext?
```

## Parameters

`alloc`

The allocator to use. Pass `NULL` or <doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault> to use the default allocator.

`protocolSide`

Either [`SSLProtocolSide.serverSide`](/documentation/Security/SSLProtocolSide/serverSide) or [`SSLProtocolSide.clientSide`](/documentation/Security/SSLProtocolSide/clientSide).

`connectionType`

Either [`SSLConnectionType.streamType`](/documentation/Security/SSLConnectionType/streamType) or [`SSLConnectionType.datagramType`](/documentation/Security/SSLConnectionType/datagramType).

## Return Value

A new context. In Objective-C, use <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> to release this object’s memory when you are done with it.

## Discussion

---

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)