---
title: "SecCertificateCopySerialNumberData(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seccertificatecopyserialnumberdata(_:_:)"
---

# SecCertificateCopySerialNumberData(_:_:)

Returns the certificate’s serial number.

## Declaration

```swift
func SecCertificateCopySerialNumberData(_ certificate: SecCertificate, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> CFData?
```

## Parameters

- `certificate`: The certificate from which to copy the serial number.
- `error`: A doc://com.apple.documentation/documentation/CoreFoundation/CFError pointer the function uses to return an error instance on failure. Set to nil to ignore any error.

## Return Value

Return Value The content of a DER-encoded integer (without the tag and length fields) for this certificate’s serial number.

## Discussion

Discussion In Objective-C, if the function returns an error free it with a call to CFRelease when you are done with it. If it returns data, you must free that as well.
