title: Problems getting a site's https certificates
body: <p>I have an Android app that has some trouble with a site's certificate when connecting via https. As I'm experiencing trouble even when using a custom keystore with the certificates ("No peer certificate") I'm trying to get more information about the connection, handshake and certificates actually given by the server.</p>
  
  <p>The version of openssl is follows:</p>
  
  <pre><code>$ openssl version
  OpenSSL 1.0.1e 11 Feb 2013
  </code></pre>
  
  <p>When I just try to get info about the certificates I get this response:</p>
  
  <pre><code>$ openssl s_client -showcerts -connect [hostname]:443 &lt;/dev/null
  CONNECTED(00000003)
  3069977808:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:749:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 7 bytes and written 308 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  ---
  </code></pre>
  
  <p>This is how Chrome describes the connection (sorry for the Norwegian text, but you get an idea of the connection and encryption type:
  <img src="https://i.stack.imgur.com/n0Prc.png" alt="adf"></p>
  
  <p>Based on the info from Chrome I've tried different commands to get the certificates, but they all seem to fail. My top candidate was this one:</p>
  
  <pre><code>$ openssl s_client -showcerts -connect [hostname]:443 -tls1_2 -cipher RC4-MD5
  CONNECTED(00000003)
  3069396176:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1258:SSL alert number 40
  3069396176:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:s3_pkt.c:596:
  ---
  no peer certificate available
  ---
  No client certificate CA names sent
  ---
  SSL handshake has read 7 bytes and written 0 bytes
  ---
  New, (NONE), Cipher is (NONE)
  Secure Renegotiation IS NOT supported
  Compression: NONE
  Expansion: NONE
  SSL-Session:
      Protocol  : TLSv1.2
      Cipher    : 0000
      Session-ID: 
      Session-ID-ctx: 
      Master-Key: 
      Key-Arg   : None
      PSK identity: None
      PSK identity hint: None
      SRP username: None
      Start Time: 1414399499
      Timeout   : 7200 (sec)
      Verify return code: 0 (ok)
  ---
  </code></pre>
  
  <p>Anyone got any hints based on the info given?</p>