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项上手动更改该属性