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


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



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


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

Return Value

The newly created certificate instance. Returns nil if the data passed in the data parameter is not a valid DER-encoded X.509 certificate.


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

See Also

Import and Export

Storing a DER-Encoded X.509 Certificate

Import and export a certificate from a file.

func SecCertificateCopyData(SecCertificate) -> CFData

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software