<!--
{
  "documentType" : "article",
  "framework" : "Security",
  "identifier" : "/documentation/Security/identities",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Identities"
}
-->

# Identities

Combine certificates and cryptographic keys into identities.

## Discussion

An identity consists of a private key packaged with the certificate that contains and vouches for the corresponding public key. You use the certificate, key, and trust services API to create an identity from a private key and its certificate, or to import an identity from a password-protected PKCS #12 file. You then use the API to extract the key and certificate from the identity. You can also use the keychain services API to store the identity to or retrieve it from a keychain, much as you would the certificate or key by itself.

## Topics

### Essentials

[Creating an Identity](/documentation/Security/creating-an-identity)

Create an identity from a certificate and private key.

[Storing an Identity in the Keychain](/documentation/Security/storing-an-identity-in-the-keychain)

Securely store an identity in the keychain.

[`SecIdentityCreateWithCertificate`](/documentation/Security/SecIdentityCreateWithCertificate(_:_:_:))

Creates a new identity for a certificate and its associated private key.

[`SecIdentity`](/documentation/Security/SecIdentity)

An abstract Core Foundation-type object representing an identity.

[`SecIdentityGetTypeID`](/documentation/Security/SecIdentityGetTypeID())

Returns the unique identifier of the opaque type to which an identity object belongs.

### Identity Import

[Importing an Identity](/documentation/Security/importing-an-identity)

Learn how to import an identity from file.

[`SecPKCS12Import`](/documentation/Security/SecPKCS12Import(_:_:_:))

Returns the identities and certificates in a PKCS #12-formatted blob.

[Keychain Import and Export Options](/documentation/Security/keychain-import-and-export-options)

Use these constants when you pass dictionary-based arguments to import and export functions.

[PKCS #12 Import Item Keys](/documentation/Security/pkcs-12-import-item-keys)

Recognized the dictionary keys returned by an import operation.

### Identity Components

[Parsing an Identity](/documentation/Security/parsing-an-identity)

Extract the private key and certificate from an identity.

[`SecIdentityCopyCertificate`](/documentation/Security/SecIdentityCopyCertificate(_:_:))

Retrieves a certificate associated with an identity.

[`SecIdentityCopyPrivateKey`](/documentation/Security/SecIdentityCopyPrivateKey(_:_:))

Retrieves the private key associated with an identity.

### System Identities

[`SecIdentityCopySystemIdentity`](/documentation/Security/SecIdentityCopySystemIdentity(_:_:_:))

Obtains the system identity associated with a specified domain.

[`SecIdentitySetSystemIdentity`](/documentation/Security/SecIdentitySetSystemIdentity(_:_:))

Assigns the system identity to be associated with a specified domain.

[System Identity Domains](/documentation/Security/system-identity-domains)

Set or obtain a system identity for domains.

### Identity Naming

[`SecIdentitySetPreferred`](/documentation/Security/SecIdentitySetPreferred(_:_:_:))

Sets the identity that should be preferred for the specified name and key use.

[`SecIdentityCopyPreferred`](/documentation/Security/SecIdentityCopyPreferred(_:_:_:))

Retrieves the preferred identity for the specified name and key use.

[`SecIdentityCopyPreference`](/documentation/Security/SecIdentityCopyPreference)

Returns the preferred identity for the specified name and key use.

[`SecIdentitySetPreference`](/documentation/Security/SecIdentitySetPreference)

Sets the preferred identity for the specified name and key use.

### Identity Search

[`SecIdentitySearch`](/documentation/Security/SecIdentitySearch)

Contains information about an identity search.

[`SecIdentitySearchCopyNext`](/documentation/Security/SecIdentitySearchCopyNext)

Finds the next identity matching specified search criteria

[`SecIdentitySearchCreate`](/documentation/Security/SecIdentitySearchCreate)

Creates a search object for finding identities.

[`SecIdentitySearchGetTypeID`](/documentation/Security/SecIdentitySearchGetTypeID)

Returns the unique identifier of the opaque type to which a `SecIdentitySearch` object belongs.

### Legacy Symbols

[`OpaqueSecIdentityRef`](/documentation/Security/OpaqueSecIdentityRef)

### Creating an Identity for Local Network TLS

  <doc://com.apple.documentation/documentation/Network/creating-an-identity-for-local-network-tls>



---

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)