<!--
{
  "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/SecCertificateCreateWithData(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecCertificateCreateWithData"
  },
  "title" : "SecCertificateCreateWithData(_:_:)"
}
-->

# SecCertificateCreateWithData(_:_:)

Creates a certificate object from a DER representation of a certificate.

```
func SecCertificateCreateWithData(_ allocator: CFAllocator?, _ data: CFData) -> SecCertificate?
```

## Parameters

`allocator`

The `CFAllocator` object you wish to use to allocate the certificate object. Pass `NULL` to use the default allocator.

`data`

A DER (Distinguished Encoding Rules) representation of an X.509 certificate.

## Return Value

The newly created certificate object. 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 `data` parameter is not a valid DER-encoded X.509 certificate.

## Discussion

The certificate object returned by this function is used as input to other functions in the API.

---

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)