title: How to make iPhoneHTTPServer secure server
body: <p>I am very new to iPhone development.</p>
  
  <p>I downloaded the iPhoneHTTPServer application from bellow link.
  <a href="https://github.com/robbiehanson/CocoaHTTPServer/tree/master/Samples/iPhoneHTTPServer" rel="nofollow">https://github.com/robbiehanson/CocoaHTTPServer/tree/master/Samples/iPhoneHTTPServer</a></p>
  
  <p>It works fine for HTTP request. </p>
  
  <p>Now I want to make it as a secure server. (use HTTPS)
  for that I have override following two methods in MyHTTPConnection.m</p>
  
  <p>I am sure about changes in this method:</p>
  
  <pre><code> /**
   * Overrides HTTPConnection's method
   **/
   - (BOOL)isSecureServer
   {
      // Create an HTTPS server (all connections will be secured via SSL/TLS)
      return YES; 
   }
  </code></pre>
  
  <p>I need to apply changes in bellow method: (Please guide me here.)
  PROBLEM : DDKeychain and Cocoa.h is not available for iOS.</p>
  
  <pre><code> /**
    * Overrides HTTPConnection's method
    * 
    * This method is expected to returns an array appropriate for use in  
    * kCFStreamSSLCertificates SSL Settings.
    * It should be an array of SecCertificateRefs except for the first element in
    * the array, which is a SecIdentityRef.
    **/
    - (NSArray *)sslIdentityAndCertificates
    {
        NSArray *result = [DDKeychain SSLIdentityAndCertificates];
        if([result count] == 0)
        {
          [DDKeychain createNewIdentity];
          return [DDKeychain SSLIdentityAndCertificates];
        }
        return result;
    }
  </code></pre>