---
title: "SecTrustGetCertificateCount(_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sectrustgetcertificatecount(_:)"
---

# SecTrustGetCertificateCount(_:)

Returns the number of certificates in an evaluated certificate chain.

## Declaration

```swift
func SecTrustGetCertificateCount(_ trust: SecTrust) -> CFIndex
```

## Parameters

- `trust`: The trust management object for the certificate that has been evaluated. Use the doc://com.apple.security/documentation/Security/SecTrustCreateWithCertificates(_:_:_:) function to create a trust management object and the doc://com.apple.security/documentation/Security/SecTrustEvaluateWithError(_:_:) function to evaluate the certificate chain.

## Return Value

Return Value The number of certificates in the certificate chain.

## Discussion

Discussion Call the SecTrustEvaluateWithError(_:_:) function before calling this function.
