All APIs (SecKeychainCopyDomainSearchList
, SecKeychainGetPath
,
SecKeychainOpen
) to achieve that seems to be deprecated.
Right. That’s because the entire concept of file-based keychains is, quoting TN3137, “on the road to deprecation”. In some situations you must use a file-based keychain, for example, if you’re building a launchd
daemon. If you’re writing normal app code, it’s best to adopt with the data protection keychain.
Just to clarify on this does that mean it targets all the keychains
present in your system, or by search list it means there is a search
list we provide in SecItemCopyMatching
dictionary?
Neither. It means all items in the keychain search list for the context in which you’re running. If you’re building a GUI app, that search list is the one you see when you run this command in Terminal:
% security list-keychains
"/Users/quinn/Library/Keychains/login.keychain-db"
"/Users/quinn/Library/Keychains/DeveloperID QQ.keychain-db"
"/Users/quinn/Library/Keychains/MouseCA.keychain-db"
"/Users/quinn/Library/Keychains/Scratch.keychain-db"
"/Library/Keychains/System.keychain"
Normally only the first and last entries are present; on my system I have three extra keychains that I set up using Keychain Access.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"