<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.7.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecCertificateGetData",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecCertificateGetData"
  },
  "title" : "SecCertificateGetData"
}
-->

# SecCertificateGetData

Retrieves the data for a certificate.

```
OSStatus SecCertificateGetData(SecCertificateRef certificate, CSSM_DATA_PTR data);
```

## Parameters

`certificate`

A certificate object for the certificate from which to retrieve the data.

`data`

On return, points to the data for the certificate specified. You must allocate the space for a `CSSM_DATA` structure before calling this function. This data pointer is only guaranteed to remain valid as long as the certificate remains unchanged and valid.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

This function requires a certificate object, which can, for example, be created with the [`SecCertificateCreateFromData`](/documentation/Security/SecCertificateCreateFromData) function, obtained from an identity with the [`SecIdentityCopyCertificate(_:_:)`](/documentation/Security/SecIdentityCopyCertificate(_:_:)) function, or obtained over a network (see [Secure Transport](/documentation/Security/secure-transport)).

---

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)