title: HTTPS with self-signed certificate in the app's keychain
body: <p>I have to connect my iPhone app to a server with a self-signed certificate via HTTPS. I cannot change the certificate or the server.</p>
  
  <p>Since I don't want to accept all self-signed certs, just this one, my idea was to import the cert to the apps keychain (reading the cert from file and adding it to the keychain with <code>SecItemAdd</code>).</p>
  
  <p>If I run the App in the Simulator, install the cert and then search the keychain for it (using <code>SecItemCopyMatching</code>), the cert is found, but the connection still fails with <em>"untrusted server certificate"</em> error.</p>
  
  <p>Is this a problem with the simulator or my app? Do I have to do anything else, for this to work? Or can I assume, that if I add a certificate to the keychain on a real device, the connect to the server will be successfull(I'm using <code>NSURLConnection.sendSynchronousRequest</code>)?</p>
  
  <p>Thanks for any help!</p>