---
title: SSLSetProtocolVersionEnabled
framework: security
role: symbol
role_heading: Function
path: security/sslsetprotocolversionenabled
---

# SSLSetProtocolVersionEnabled

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

## Declaration

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

Return Value A result code. See Secure Transport Result Codes.

## Discussion

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.
