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

# SecCertificateCopyKey(_:)

Retrieves the public key for a given certificate.

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

## Parameters

`certificate`

The certificate from which to copy the key.

## Return Value

The public key. In Objective-C, free this key with a call to the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function when you are done with it.

## Discussion

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

---

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)