---
title: "SSLCopyPeerTrust(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sslcopypeertrust(_:_:)"
---

# SSLCopyPeerTrust(_:_:)

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

## Declaration

```swift
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 doc://com.apple.security/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

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

## Discussion

Discussion This function is valid any time after a handshake attempt.
