<!--
{
  "availability" : [
    "macOS: 10.5.0 - 10.9.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SSLCopyTrustedRoots",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SSLCopyTrustedRoots"
  },
  "title" : "SSLCopyTrustedRoots"
}
-->

# SSLCopyTrustedRoots

Retrieves the current list of trusted root certificates.

```
OSStatus SSLCopyTrustedRoots(SSLContextRef context, CFArrayRef*trustedRoots);
```

## Parameters

`context`

An SSL session context reference.

`trustedRoots`

On return, a pointer to a value of type `CFArrayRef`. This array contains values of type `SecCertificateRef` representing the current set of trusted roots. You must call the `CFRelease` function to release this array when you are finished with it.

## Return Value

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

## Discussion

You can use the [`SSLSetTrustedRoots`](/documentation/Security/SSLSetTrustedRoots) function to replace or add to the set of trusted root certificates. If [`SSLSetTrustedRoots`](/documentation/Security/SSLSetTrustedRoots) has never been called for this session, the [`SSLCopyTrustedRoots`](/documentation/Security/SSLCopyTrustedRoots) function returns the system’s default set of trusted root certificates.

---

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)