the xamarinios binding library cannot use the seckey api from the security framework

So I will answer my own questions since I found the solution. The reason behind the problem is SecKeyRef using KeyChain access to read and write key as stated in official documentation:

A SecKeyRef instance that represents a key that is stored in a keychain can be safely cast to a SecKeychainItemRef for manipulation as a keychain item. On the other hand, if the key is not stored in a keychain, casting the object to a SecKeychainItemRef and passing it to Keychain Services functions returns errors.

Having a provisioning profile in Xcode to use SecKeyRef is not important, but in Visual Studio Mac, it is required to use Entitlements.plist to enable keychain access. So if your binding library used the SecKey API, you need to enable KeyChain Access in Entitlements.plist and set apple developer account in project.

<key>keychain-access-groups</key>
<array>
    <string>$(AppIdentifierPrefix)com.company.yourapp</string>
</array>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top