1 Item Class Keys And Values 钥匙链项目的类别的键与值
Specify the class of a keychain item.
指定一个钥匙链项目的类别.
2 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.
在使用SecItemAdd函数时会创建一个新的钥匙链项目,你需要使用下方列出的键以及一个对应的值放入该函数的入参attributes字典中,指定该函数创建的新钥匙链项目的类型.
Later, use this same pair in the query dictionary when searching for an item with one of the SecItemCopyMatching, SecItemUpdate, or SecItemDelete functions.
之后,在这几个函数:SecItemCopyMatching,SecItemUpdate或者SecItemDeletez中查找钥匙链项目时,需要在寻找字典中使用和在SecItemAdd中使用的相同键值对.
3 Topics 主题
3.1 Item Class Keys 钥匙链项目类型键
- kSecClass
A dictionary key whose value is the item's class.
一个字符串,用来作为字典的键,值代表对应的钥匙链项目的类型.
3.2 Item Class Values
Values you use with the kSecClass key.
使用kSecClass键时,值为下列值之一.
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.
表示钥匙链项目类型为标识符.
4 See Also 参考
4.1 Adding Keychain Items添加钥匙链项目
4.1.1 Adding a Password to the Keychain添加一个密码到钥匙链.
Add network credentials to the keychain on behalf of the user.
为用户添加网络证书到钥匙链.
4.1.2 SecItemAdd
Adds one or more items to a keychain.
保存一个或者多个钥匙链项目到钥匙链.
4.1.3 Item Attribute Keys and Values 钥匙链项目的属性的键与值
Specify the attributes of keychain items.
指定钥匙链项目的属性.