title: How do I allow a user to trust and pin a self-signed SSL Certificate using AFNetworking in iOS
body: <p>I'm working on an iOS application that will be used by enterprises. Our app will be talking to a server that may be configured with a self-signed certificate generated by the company that has deployed our server software. </p>
  
  <p>Our iOS application is using AFNetworking which allows for SSL Pinning. But I get the impression that this only pins SSL certificates that were included as part of the app bundle when it was created. It does not allow you to work with a certificate that the iOS device becomes aware of later.</p>
  
  <p>I'm looking for a way for the customer to push out (perhaps via a profile) the self-signed cert so that our application can securely talk to the server. Is there a way? Or do I need to skip AFNetworking and use the Foundation classes directly.</p>
  
  <p>I welcome any comments to help clarify this question as well.</p>
  
  <p>UPDATE: For others who may have been confused as I was. While I understand pinning to be an important topic, I was confusing it with my first priority: removing support for invalid certificates from our prototype app. What I wanted was a way for a user to explicitly trust a self-signed cert. This is simple. Just add it as a profile to your iOS device. But I was also being tripped up by the fact that the self-signed certs we were using in development weren't quite right so iOS would not trust them. See <a href="http://blog.httpwatch.com/2013/12/12/five-tips-for-using-self-signed-ssl-certificates-with-ios/" rel="nofollow">http://blog.httpwatch.com/2013/12/12/five-tips-for-using-self-signed-ssl-certificates-with-ios/</a> on how to generate a "good" self-signed cert. Now that I have self-signed certs being trusted, I will follow up on how to use pinning.</p>