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

# SSLSetError(_:_:)

Sets the status of a session context.

```
func SSLSetError(_ context: SSLContext, _ status: OSStatus) -> OSStatus
```

## Parameters

`context`

A session context.

`status`

A status result for the context, not to be confused with the return result of this function call. See [Secure Transport Result Codes](/documentation/Security/secure-transport-result-codes).

## Return Value

A result code that represents the outcome of this function call, not to be confused with the `status` parameter. See [Secure Transport Result Codes](/documentation/Security/secure-transport-result-codes).

## Discussion

Call this function after handling the steps of an SSL handshake, such as server certificate validation.

---

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)