---
title: Parsing an Identity
framework: security
role: article
role_heading: Article
path: security/parsing-an-identity
---

# Parsing an Identity

Extract the private key and certificate from an identity.

## Overview

Overview After you have an identity, you can extract the private key from it with a call to the SecIdentityCopyPrivateKey(_:_:) function: Similarly, you can extract the certificate with a call to the SecIdentityCopyCertificate(_:_:) function: In both cases, you inspect the returned status value to determine whether an error occurred during the extraction. In Objective-C, you are responsible for freeing the associated memory with a call to CFRelease when you’re done with these objects. In Swift, the system manages the memory automatically, releasing it when the object goes out of scope.
