title: Get SSL certificate details
body: <p>I want to examine the SSL certificate that <code>-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge</code> receives and I have the following snippet which gives me the Issuer Common Name, and the DER.</p>
  
  <pre><code>SecTrustRef trustRef = [[challenge protectionSpace] serverTrust];
  SecTrustEvaluate(trustRef, NULL);
  CFIndex count = SecTrustGetCertificateCount(trustRef); 
  
  for (CFIndex i = 0; i &lt; count; i++)
  {
      SecCertificateRef certRef = SecTrustGetCertificateAtIndex(trustRef, i);
      CFStringRef certSummary = SecCertificateCopySubjectSummary(certRef);
      CFDataRef certData = SecCertificateCopyData(certRef);
  }
  </code></pre>
  
  <p>In addition I would like to get the fingerprint and the signature.
  My SSL knowledge isn't that deep; can I perhaps extract the above from the DER representation?</p>
  
  <p>The documentation doesn't help. <a href="http://developer.apple.com/library/ios/#documentation/Security/Reference/certifkeytrustservices/Reference/reference.html" rel="noreferrer">http://developer.apple.com/library/ios/#documentation/Security/Reference/certifkeytrustservices/Reference/reference.html</a>.</p>