title: How to list all openssl ciphers available in statically linked python releases?
body: <p>In the python 2.7.8 to 2.7.9 upgrade, the ssl module changed from using</p>
  
  <pre><code>_DEFAULT_CIPHERS = 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2'
  </code></pre>
  
  <p>to</p>
  
  <pre><code>_DEFAULT_CIPHERS = (
      'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:'
      'DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:ECDH+RC4:'
      'DH+RC4:RSA+RC4:!aNULL:!eNULL:!MD5'
  )
  </code></pre>
  
  <p><strong>I'd like to know how this affects the actual "ordered SSL cipher preference list" that gets used when establishing SSL/TLS connections with my python installs on Windows.</strong></p>
  
  <p>For example, to figure out what "ordered SSL cipher preference list" a cipher list expands to, I'd normally use the <code>openssl ciphers</code> command line (see <a href="https://www.openssl.org/docs/apps/ciphers.html">man page</a>) e.g with openssl v1.0.1k I can see what that default python 2.7.8 cipher list expands to:</p>
  
  <pre><code>$ openssl ciphers -v 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2'
  ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
  ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(256) Mac=AEAD
  ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA384
  ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA384
  ECDHE-RSA-AES256-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1
  ECDHE-ECDSA-AES256-SHA  SSLv3 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA1
  SRP-DSS-AES-256-CBC-SHA SSLv3 Kx=SRP      Au=DSS  Enc=AES(256)  Mac=SHA1
  SRP-RSA-AES-256-CBC-SHA SSLv3 Kx=SRP      Au=RSA  Enc=AES(256)  Mac=SHA1
  ...
  snip!
  </code></pre>
  
  <p>That works great when on Linux where python is dynamically loading the same OpenSSL library that <code>openssl ciphers</code> uses:</p>
  
  <pre><code>$ ldd /usr/lib/python2.7/lib-dynload/_ssl.x86_64-linux-gnu.so | grep libssl
          libssl.so.1.0.0 =&gt; /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007ff75d6bf000)
  $ ldd /usr/bin/openssl | grep libssl
          libssl.so.1.0.0 =&gt; /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fa48f0fe000)
  </code></pre>
  
  <p><strong>However</strong>, on Windows the Python build appears to statically link the OpenSSL library. This means that the <code>openssl ciphers</code> command cannot help me, because it uses a different version of the library, which may have support for different ciphers than the library built into python.</p>
  
  <p>I can find out what version of OpenSSL was used to build each of the two python releases easily enough:</p>
  
  <pre><code>$ python-2.7.8/python -c 'import ssl; print ssl.OPENSSL_VERSION'
  OpenSSL 1.0.1h 5 Jun 2014
  
  $ python-2.7.9/python -c 'import ssl; print ssl.OPENSSL_VERSION'
  OpenSSL 1.0.1j 15 Oct 2014
  </code></pre>
  
  <p>But even if I could find and download a build of the <code>openssl</code> command line for both the 1.0.1h and 1.0.1j releases, I cannot be sure that they were compiled with the same options as the lib built into python, and from the <a href="https://www.openssl.org/docs/apps/ciphers.html">man page</a> we know that</p>
  
  <blockquote>
    <p>Some compiled versions of OpenSSL may not include all the ciphers listed here because some ciphers were excluded at compile time.</p>
  </blockquote>
  
  <p><strong>So, is there a way to get python's ssl module to give me output similar to that from the <code>openssl ciphers -v</code> command?</strong></p>