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

# SecCertificateCopyPublicKey(_:)

Retrieves the public key from a certificate.

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

## Parameters

`certificate`

The certificate object from which to retrieve the public key.

`key`

In macOS, points to the public key for the specified certificate. 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

In iOS, the certificate’s public key.

## Discussion

In macOS, a result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

---

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)