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

# SSLGetNegotiatedProtocolVersion(_:_:)

Obtains the negotiated protocol version of the active session.

```
func SSLGetNegotiatedProtocolVersion(_ context: SSLContext, _ protocol: UnsafeMutablePointer<SSLProtocol>) -> OSStatus
```

## Parameters

`context`

An SSL session context reference.

`protocol`

On return, points to the negotiated protocol version of the active session. The value is set to [`SSLProtocol.sslProtocolUnknown`](/documentation/Security/SSLProtocol/sslProtocolUnknown) if no SSL session is in progress.

## Return Value

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

## Discussion

This function retrieves the version of the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocol negotiated for the session. Note that the negotiated protocol may not be the same as your preferred protocol, depending on which protocol versions you enabled with the [`SSLSetProtocolVersionEnabled`](/documentation/Security/SSLSetProtocolVersionEnabled) function. This function can return any of the following values:

- `kSSLProtocol2`
- `kSSLProtocol3`
- `kTLSProtocol1`
- `kSSLProtocolUnknown`

---

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)