---
title: "SecCertificateCopyKey(_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seccertificatecopykey(_:)"
---

# SecCertificateCopyKey(_:)

Retrieves the public key for a given certificate.

## Declaration

```swift
func SecCertificateCopyKey(_ certificate: SecCertificate) -> SecKey?
```

## Parameters

- `certificate`: The certificate from which to copy the key.

## Return Value

Return Value The public key. In Objective-C, free this key with a call to the CFRelease function when you are done with it.

## Discussion

Discussion The return reference is NULL if the public key has an encoding issue or uses an unsupported algorithm.
