title: How to determine SSL cert expiration date from NSURLAuthenticationMethodServerTrust challenge
body: <p>Inside the delegate </p>
  
  <pre><code>- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
  </code></pre>
  
  <p>After getting Server Challenge, i am able to extract  X.509 Certificate using following code:</p>
  
  <pre><code>    SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
      SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, 0);
  </code></pre>
  
  <p>Now I Need to get the expire date from this SecCertificateRef.</p>
  
  <p>And also want to check whether the certificate is having valid domain name.
  I have gone through apple docs and googled for long time, some suggested to use SLL library to get these details. In project no Third party libraries are permitted. Is any way to get these details without third party libs?</p>