Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 我是否可以将NSURLCredentialStorage与数据保护一起使用?_Iphone_Ios_Security_Keychain - Fatal编程技术网

Iphone 我是否可以将NSURLCredentialStorage与数据保护一起使用?

Iphone 我是否可以将NSURLCredentialStorage与数据保护一起使用?,iphone,ios,security,keychain,Iphone,Ios,Security,Keychain,据我所知,NSURLCredentialStorage只是一个密钥链服务的包装器,具有更方便的API。这就是我想用它的原因。但我还想利用keychain提供的数据保护功能ksecataccessiblewhen unlocked this device only 当使用NSURLCresidentialstorage存储凭据时,有没有办法设置此属性?结果是,答案是肯定的。我查看了NSURLCredentialStorage创建的钥匙链项目。它属于kSecClassInternetPassword

据我所知,
NSURLCredentialStorage
只是一个密钥链服务的包装器,具有更方便的API。这就是我想用它的原因。但我还想利用keychain提供的数据保护功能
ksecataccessiblewhen unlocked this device only


当使用NSURLCresidentialstorage存储凭据时,有没有办法设置此属性?

结果是,答案是肯定的。我查看了
NSURLCredentialStorage
创建的钥匙链项目。它属于
kSecClassInternetPassword
类,并且将访问密钥
kSecAttrAccessible
设置为“ak”,未锁定时即为
kSecAttrAccessible
。因此,当设备锁定时,密码不会被解密

唯一的缺点是
nsurlCredentialsStorage
无法将其更改为
ksecataccessible(当未锁定此设备时)仅为备份数据提供额外的安全级别。您只能使用较低级别的keychain API(即
SecItemUpdate
)在keychain项上手动更改该属性