<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecTrustCopyCustomAnchorCertificates(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecTrustCopyCustomAnchorCertificates"
  },
  "title" : "SecTrustCopyCustomAnchorCertificates(_:_:)"
}
-->

# SecTrustCopyCustomAnchorCertificates(_:_:)

Retrieves the custom anchor certificates, if any, used by a given trust.

```
func SecTrustCopyCustomAnchorCertificates(_ trust: SecTrust, _ anchors: UnsafeMutablePointer<CFArray?>) -> OSStatus
```

## Parameters

`trust`

The trust management object from which you wish to retrieve the custom anchor certificates.

`anchors`

On return, a reference to an array of `SecCertificateRef` objects representing the set of anchor certificates that are considered valid (trusted) anchors by the [`SecTrustEvaluateWithError(_:_:)`](/documentation/Security/SecTrustEvaluateWithError(_:_:)) function when verifying a certificate using the trust management object in the `trust` parameter. Returns `NULL` if no custom anchors have been specified. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to release this object when you are finished with it.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

You can use the [`SecTrustSetAnchorCertificates(_:_:)`](/documentation/Security/SecTrustSetAnchorCertificates(_:_:)) function to set custom anchor certificates.

It is safe to call this function concurrently on two or more threads as long as it is not used to get values from a trust management object that is simultaneously being changed by another function. For example, you can call this function on two threads at the same time, but not if you are simultaneously calling the [`SecTrustSetAnchorCertificates(_:_:)`](/documentation/Security/SecTrustSetAnchorCertificates(_:_:)) function for the same trust management object on another thread.

## See Also

[`SecTrustSetAnchorCertificates(_:_:)`](/documentation/Security/SecTrustSetAnchorCertificates(_:_:))

Sets the anchor certificates used when evaluating a trust management object.



---

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)