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

# SecCertificateCopyData(_:)

Returns a DER representation of a certificate given a certificate object.

```
func SecCertificateCopyData(_ certificate: SecCertificate) -> CFData
```

## Parameters

`certificate`

The certificate object for which you wish to return the DER (Distinguished Encoding Rules) representation of the X.509 certificate.

## Return Value

The DER representation of the certificate. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to release this object when you are finished with it. Returns `nil` if the data passed in the `certificate` parameter is not a valid certificate object.

## Discussion

---

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)