Search code examples
iossslssl-certificateclient-certificatesself-signed

Saving and loading client certificate on iOS


I'm new in iOS development and actually I'm using Xamarin for iOS but documentation regading certificate management in Xamarin.iOS is poor. So ObjC answer will be fine.

My task is to receive certificate from server, save it permanently to keychain and then use it for authentication.

So at the moment I do:

  1. Receive certificate from server as byte array.
  2. SecPKCS12Import
  3. SecItemAdd

And when I need certificate I do execute SecItemCopyMatching and find certificate using Label.

Is that a right approach? The problem is that when I try to get identity using same Label from the keychain I get errSecParam error.

Thank you!


Solution

  • Problem was in this Xamarin iOS issue https://bugzilla.xamarin.com/show_bug.cgi?id=24972