---
title: "certificate(withIdentifier:)"
framework: ManagedApp
role: symbol
role_heading: Instance Method
platforms: [iOS 18.4+, iPadOS 18.4+, macOS 27.0+, visionOS 2.4+]
path: "managedapp/managedappcertificatesprovider/certificate(withidentifier:)"
---

# certificate(withIdentifier:)

Provides a certificate by its identifier.

## Declaration

```swift
func certificate(withIdentifier identifier: String) async throws(ManagedAppError) -> SecCertificate
```

## Parameters

- `identifier`: The identifier of the requested certificate. This function throws doc://com.apple.managedapp/documentation/ManagedApp/ManagedAppError/invalidIdentifier if the value you supply isn’t currently in doc://com.apple.managedapp/documentation/ManagedApp/ManagedAppIdentitiesProvider/identifiers.

## Return Value

Return Value The requested certificate

## Discussion

Discussion The MDM server can update the certificate at any time. After that, identifiers yields a new array of identifiers. Call this method again to obtain the updated certificate. The MDM server can change the available certificates at any time. When that happens, the list of valid identifiers updates accordingly. For example, the list of valid identifiers might change between the time that the app accesses identifiers and then calls this method passing in one of its elements. So, the app needs to handle the case that this method throws ManagedAppError.invalidIdentifier. important: Avoid storing the certificate and instead, call this method whenever the app needs the certificate. For security reasons, avoid logging or displaying the certificate. Even though the certificate is a “public” certificate, it can contain sensitive information. note: ManagedAppError.invalidIdentifier if no certificate exists with the specified identifier.
