<!--
{
  "availability" : [
    "macOS: 10.2.0 - 10.9.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SSLSetProtocolVersionEnabled",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SSLSetProtocolVersionEnabled"
  },
  "title" : "SSLSetProtocolVersionEnabled"
}
-->

# SSLSetProtocolVersionEnabled

Sets the allowed Secure Sockets Layer (SSL) protocol versions.

```
OSStatus SSLSetProtocolVersionEnabled(SSLContextRef context, SSLProtocol protocol, Boolean enable);
```

## Parameters

`context`

An SSL session context reference.

`protocol`

The SSL protocol version to enable. Pass `kSSLProtocolAll` to enable all protocols.

`enable`

A Boolean value indicating whether to enable or disable the specified protocol. Specify `true` to enable the protocol.

## Return Value

A result code. See [Secure Transport Result Codes](/documentation/Security/secure-transport-result-codes).

## Discussion

Calling this function is optional. The default is that all supported protocols are enabled. When you call this function, only the specified protocol is affected. Therefore, if you call it once to disable SSL version 2 (for example), the other protocols all remain enabled. You may call this function as many times as you wish to enable and disable specific protocols. You can specify one of the following values for the `protocol` parameter:

- `kSSLProtocol2`
- `kSSLProtocol3`
- `kTLSProtocol1`
- `kSSLProtocolAll`

This function cannot be called when a session is active.

---

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)