Search code examples
iosruby-on-railssslssl-certificateiphone-privateapi

Implicitly trust SSL certificates in iOS app for private API


I'm working on an iOS app with a rails backend, running on a VPS (via my own domain).

My question is: is it insecure to use a self-signed SSL certificate on my server and ignore the warnings from NSURLConnection while communicating with it, considering that this is a private API which is only accessible via my iOS app?


Solution

  • The safe way to go in this scenario is: Sign it yourself and manually add the certificate to the local certificate database of every system you work from, so you don't need authentication to know it's yours. Sometimes this can be done automatically as easily as checking the box "ignore the warning for this certificate" the first time you connect from each system, which will prevent you from seen it again on that system unless the certificate changes.

    This way you won't see the warning again, unless it's somebody else's self certificate you're looking at.

    Ignoring the warning by default usually means that if somebody else signs its own certificate and presents it to you, you will go along without even noticing. Not a good idea.