[Catalyst] Access keychain for certificate

Hello,


we're using certificate-based authentication in our apps for communication to backend services. Now I wanted to port an app for macOS with the help of catalyst. The app itself works fine, but unfortunately I can't get anything from the macOS keychain.


For testing I created a blank playground with macOS as target:


let dic : NSDictionary = [kSecMatchLimit: kSecMatchLimitAll,
                          kSecReturnAttributes: kCFBooleanTrue!,
                          kSecAttrKeyClass: kSecAttrKeyClassPrivate,
                          kSecReturnRef: kCFBooleanTrue!,
                          kSecClass: kSecClassIdentity]
var result : CFTypeRef?
let resultCode : OSStatus = SecItemCopyMatching(dic, &result)
if resultCode == errSecSuccess{...}


With that I do get all identities that are currently available in my keychain, without any issues. This exact code works on my iOS device as well. When running this code as a UIKitForMac/Catalyst app the resultCode is always errSecItemNotFound (-25300).


Does anyone know what the correct way is to get information from the macOS keychain in a catalyst app?

Any help is appreciated, Thanks!

@xPPPinkix Did you find the solution to this problem, currently i am facing this issue.

@xPPPinkix @Naren193 the same issue, any solution?

I found this: https://developer.apple.com/forums/thread/696431

[Catalyst] Access keychain for certificate
 
 
Q