Value of the kSecAttrKeyClass attribute is not equal to kSecAttrKeyClassPrivate
| Originator: | wiml | ||
| Number: | rdar://19804744 | Date Originated: | 11-Feb-2015 03:57 PM |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 8.1 (12B411), 9.2 (13C75) |
| Classification: | Bug | Reproducible: | Always |
W Lewis11-Feb-2015 03:57 PM
Summary:
If you retrieve keys from the keychain using SecItemCopyMatching, the value of the kSecAttrKeyClass key in the returned dictionary is not equal to the documented values e.g. kSecAttrKeyClassPrivate.
The returned value is a CFNumber (equal to 1), and kSecAttrKeyClassPrivate is a CFString (equal to "1"). They don't compare CFEqual.
Steps to Reproduce:
1. Insert some keys into the keychain e.g. using SecKeyGeneratePair()
2. Retrieve them using SecItemCopyMatching({ kSecClass: kSecClassKey, kSecReturnRef: true, kSecReturnAttributes: true })
3. Attempt to determine which returned items are public keys, which are private, symmetric, etc.
Expected Results:
Useful data in conformance with documentation
Actual Results:
(lldb) p (CFTypeRef)kSecAttrKeyClassPrivate
(CFTypeRef) $18 = 0x03ff76a0 @"1"
(lldb) p (CFTypeRef)CFDictionaryGetValue(d, kSecAttrKeyClass)
(CFTypeRef) $19 = 0x79685170 class name = __NSCFNumber
(lldb) p (Boolean)CFEqual(kcls, kSecAttrKeyClassPrivate)
(Boolean) $20 = '\0'
(lldb) po $19
1
Version:
iOS Simulator 8.1 (12B411)
Notes:
Configuration:
iOS Simulator
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
W Lewis 03-Feb-2016 06:43 PM
Verified still broken in iOS 9.2 (13C75), in the simulator and on a phone.