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

# SSLCopyPeerTrust(_:_:)

Retrieves a trust management object for the certificate used by a session.

```
func SSLCopyPeerTrust(_ context: SSLContext, _ trust: UnsafeMutablePointer<SecTrust?>) -> OSStatus
```

## Parameters

`context`

An SSL session context reference.

`trust`

On return, a trust management object you can use to evaluate trust for the certificate used by the session. A trust management object includes the certificate to be verified plus the policy or policies to be used in evaluating trust. See [Certificate, Key, and Trust Services](/documentation/Security/certificate-key-and-trust-services) for functions to create and evaluate trust management objects. You must call the `CFRelease` function for this object when you are finished with it.

## Return Value

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

## Discussion

This function is valid any time after a handshake attempt.

---

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)