Have you a link to a sample code tha use system keychain and not a "local app" keychain at least in objective-c?
macOS doesn’t have the concept of “local app” keychain [1]. Rather, each app has its own keychain search list and sees all the items in all the keychains in that search list. This search list typically includes the login keychain and the System keychain, but there can be other keychains inserted in the list, either by the user or programmatically. Such keychains can either be filed-based or backed by security token (like a smart card).
Credentials within the keychain are governed by an access control list, so when you try to use the credential you may end up triggering a user authentication dialog.
Given the above architecture there should be no problems with you seeing digital identities in the System keychain, or in a configured smart card keychain. You can use normal keychain APIs to query for the digital identities you care about and you’ll get back results from all the keychains in the search list (using one of those identity’s private key might trigger an authorisation dialog, but that’s a separate issue).
In short, call
SecItemCopyMatching
to request all digital identities and see what you get back. For example:
var copyResult: CFTypeRef? = nil
let err = SecItemCopyMatching([
kSecClass: kSecClassIdentity,
kSecMatchLimit: kSecMatchLimitAll,
kSecReturnRef: true
] as NSDictionary, ©Result)
if err == errSecSuccess {
let identities = copyResult! as! [SecIdentity]
for identity in identities {
NSLog("%@", "\(identity)")
}
}
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
—
WWDC runs Mon, 4 Jun through to Fri, 8 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face.
[1] Well, it does when you start dealing with iCloud Keychain, as discussed in this post.