What is interesting is that it is possible to open the keychain (SecKeychainOpen returns 0), but when trying to write to it, it fails with the same 100001 code.
						let path = "~/Library/Keychains/login.keychain-db"
var keychain: SecKeychain?
var status = SecKeychainOpen(path, &keychain)
log.warning("SecKeychainOpen \(status)")
let addErr = SecItemAdd([
kSecClass: kSecClassGenericPassword,
kSecAttrService: "aTestTestTest",
kSecAttrAccount: "mrgumby",
kSecUseKeychain: keychain,
kSecValueData: "opendoor".data(using: .utf8)!
] as NSDictionary, nil)
if addErr != errSecSuccess {
log.warning("Keychain SecItemAdd failed, error: \(addErr)")
} else {
log.warning("Keychain success")
}
result:
SecKeychainOpen 0
Keychain SecItemAdd failed, error: 100001
Adding
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
<array>
<string>/Library/Keychains/login.keychain-db</string>
</array>
To extension entitlements doesn't help.
Topic:
App & System Services
SubTopic:
Core OS
Tags: