by sanitrance

Xamarin Tips: Xamarin.iOS Binding with SecKey API

Tuğçe Arar
Apr 2, 2021

--

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 iOS application developed in Xcode to use SecKeyRef is not required, but in Xamarin.iOS application in Visual Studio for 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 your project.

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

--

--