Item Class Keys and Values

Specify the class of a keychain item.

Overview

Keychain items come in a variety of classes according to the kind of data they hold, such as passwords, cryptographic keys, and certificates. The item's class dictates which attributes apply and enables the system to decide whether or not the data should be encrypted on disk. For example, passwords require encryption, but certificates don't because they are not secret.

Use the key and one of the corresponding values listed here to specify the class for a new item you create with a call to the SecItemAdd function by placing the key/value pair in the attributes dictionary.

Later, use this same pair in the query dictionary when searching for an item with one of the SecItemCopyMatching, SecItemUpdate, or SecItemDelete functions.

Topics

Item Class Keys

kSecClass

A dictionary key whose value is the item's class.

Item Class Values

Values you use with the kSecClass key.

kSecClassGenericPassword

The value that indicates a generic password item.

kSecClassInternetPassword

The value that indicates an Internet password item.

kSecClassCertificate

The value that indicates a certificate item.

kSecClassKey

The value that indicates a cryptographic key item.

kSecClassIdentity

The value that indicates an identity item.

See Also

Adding Keychain Items

Adding a Password to the Keychain

Add network credentials to the keychain on behalf of the user.

SecItemAdd

Adds one or more items to a keychain.

Item Attribute Keys and Values

Specify the attributes of keychain items.