Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I retrieve a list of the SSL/TLS cipher suites a particular website offers?

I've tried openssl, but if you examine the output:

$ echo -n | openssl s_client -connect www.google.com:443 
depth=1 /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
verify error:num=20:unable to get local issuer certificate
verify return:0
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
 1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
   i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
Server certificate
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
issuer=/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
No client certificate CA names sent
SSL handshake has read 1777 bytes and written 316 bytes
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
    Protocol  : TLSv1
    Cipher    : AES256-SHA
    Session-ID: 748E2B5FEFF9EA065DA2F04A06FBF456502F3E64DF1B4FF054F54817C473270C
    Master-Key: C4284AE7D76421F782A822B3780FA9677A726A25E1258160CA30D346D65C5F4049DA3D10A41F3FA4816DD9606197FAE5
    Key-Arg   : None
    Start Time: 1266259321
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)

it just shows that the cipher suite is something with AES256-SHA. I know I could grep through the hex dump of the conversation, but I was hoping for something a little more elegant.

I would prefer to do this on Linux, but Windows (or other) would be fine. This question is motivated by the security testing I do for PCI and general penetration testing.


GregS points out below that the SSL server picks from the cipher suites of the client. So it seems I would need to test all cipher suites one at a time. I think I can hack something together, but is there a simpler, more future-proof (e.g. new ciphers) way to do this?

share|improve this question

17 Answers 17

up vote 96 down vote accepted

I wrote a bash script to test cipher suites. It gets a list of supported cipher suites from OpenSSL and tries to connect using each one. If the handshake is successful, it prints YES. If the handshake isn't successful, it prints NO, followed by the OpenSSL error text.

#!/usr/bin/env bash

# OpenSSL requires the port number.
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')

echo Obtaining cipher list from $(openssl version).

for cipher in ${ciphers[@]}
echo -n Testing $cipher...
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1)
if [[ "$result" =~ ":error:" ]] ; then
  error=$(echo -n $result | cut -d':' -f6)
  echo NO \($error\)
  if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher    :" ]] ; then
    echo YES
    echo $result
sleep $DELAY

Here's sample output showing 3 unsupported ciphers, and 1 supported cipher:

[@linux ~]$ ./test_ciphers
Obtaining cipher list from OpenSSL 0.9.8k 25 Mar 2009.
Testing ADH-AES256-SHA...NO (sslv3 alert handshake failure)
Testing DHE-RSA-AES256-SHA...NO (sslv3 alert handshake failure)
Testing DHE-DSS-AES256-SHA...NO (sslv3 alert handshake failure)
Testing AES256-SHA...YES
share|improve this answer
openssl 1.0 needs a change: if [[ "$result" =~ "Cipher :" ]] ; then instead of if [[ "$result" =~ "Cipher is " ]] ; then I also test for SSL2 and secure renegotiation: echo -n Testing ssl2... result=$(echo -n | openssl s_client -ssl2 -connect $SERVER 2>&1) if [[ "$result" =~ "Cipher :" ]] ; then echo supported. INSECURE! else echo no support, OK fi echo -n Testing SSL secure renegotiation... echo -n "" | openssl s_client -connect $SERVER 2>&1 | grep 'Secure Renegotiation' –  Hubert Kario Jul 20 '11 at 7:40
There is another, very sophisticated shell script available that uses sslscan and openssl: TLSSLed –  Robert Oct 2 '12 at 9:21
up vote 57 down vote

Is there a tool that can test what SSL/TLS cipher suites a particular website offers?

Yes, you could use the online tool on SSL Labs' website to query the Public SSL Server Database.

Here is a snippet of information that it provides:

alt text

(screenshot from results of google.com)

share|improve this answer
Unfortunately it does support only HTTPS on standard port, can't use it to check POP3S, IMAPS or IMAP with TLS –  Hubert Kario Jul 20 '11 at 8:35
And while it only supports HTTPS, it even lacks support for SNI. –  Gurken Papst Jun 8 '12 at 21:21
And while it's great for public-facing sites, you can't use it for sites on networks that are isolated from the Internet. –  Iszi May 21 at 13:30

Nmap with ssl-enum-ciphers

There is no better or faster way to get a list of available ciphers from a network service. Plus, nmap will provide a strength rating of strong, weak, or unknown for each available cipher.

First, download the ssl-enum-ciphers.nse nmap script (explanation here). Then from the same directory as the script, run nmap as follows:

List ciphers supported by an HTTP server

$ nmap --script ssl-enum-ciphers -p 443 www.example.com

List ciphers supported by an IMAP server

$ nmap --script ssl-enum-ciphers -p 993 mail.example.com

Here is a snippet of output from a Dovecot IMAP server:

993/tcp open  imaps
| ssl-enum-ciphers:
|   SSLv3:
|     ciphers:
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA - strong
|       TLS_RSA_WITH_IDEA_CBC_SHA - weak
|   TLSv1.0:
|     ciphers:
|       TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_128_CBC_SHA - strong
|       TLS_DHE_RSA_WITH_AES_256_CBC_SHA - strong
|       TLS_RSA_WITH_IDEA_CBC_SHA - weak
|_  least strength: weak

Nmap done: 1 IP address (1 host up) scanned in 1.03 seconds
share|improve this answer
Is there any way to use this script on IMAP with STARTTLS? STARTTLS on SMTP seems to work, but on IMAP the script doesn't even appear to run. –  Giel Jul 11 '14 at 9:17

sslscan is a nice little utility.

It tests connecting with TLS and SSL (and the build script can link with its own copy of OpenSSL so that obsolete SSL versions are checked as well) and reports about the server's cipher suites and certificate.

share|improve this answer

Since this is such a great reference thread for SSL scanning tools, I'll list CipherScan which was created a year ago and can also identify problems with key exchange ciphers. https://github.com/jvehent/cipherscan

If you want my fork which supports SNI and FreeBSD, the URL is https://github.com/oparoz/cipherscan

It's a script which calls openssl s_client and supports using your own OpenSSL binary so that you can test upcoming features or new ciphers (chacha20+poly1305 per example).

It also lets you connect to any port you want and use starttlss.

Here is a typical output

# ./cipherscan -o ./openssl api.mycompany.com:443
prio  ciphersuite                  protocols              pfs_keysize
1     DHE-RSA-AES256-GCM-SHA384    TLSv1.2                DH,4096bits
2     DHE-RSA-AES256-SHA256        TLSv1.2                DH,4096bits
3     ECDHE-RSA-AES256-GCM-SHA384  TLSv1.2                ECDH,P-384,384bits
4     ECDHE-RSA-AES256-SHA384      TLSv1.2                ECDH,P-384,384bits
5     DHE-RSA-AES128-GCM-SHA256    TLSv1.2                DH,4096bits
6     DHE-RSA-AES128-SHA256        TLSv1.2                DH,4096bits
7     ECDHE-RSA-AES128-GCM-SHA256  TLSv1.2                ECDH,P-384,384bits
8     ECDHE-RSA-AES128-SHA256      TLSv1.2                ECDH,P-384,384bits
9     DHE-RSA-CAMELLIA256-SHA      TLSv1,TLSv1.1,TLSv1.2  DH,4096bits
10    DHE-RSA-AES256-SHA           TLSv1,TLSv1.1,TLSv1.2  DH,4096bits
11    ECDHE-RSA-AES256-SHA         TLSv1,TLSv1.1,TLSv1.2  ECDH,P-384,384bits
12    DHE-RSA-CAMELLIA128-SHA      TLSv1,TLSv1.1,TLSv1.2  DH,4096bits
13    DHE-RSA-AES128-SHA           TLSv1,TLSv1.1,TLSv1.2  DH,4096bits
14    ECDHE-RSA-AES128-SHA         TLSv1,TLSv1.1,TLSv1.2  ECDH,P-384,384bits
15    CAMELLIA256-SHA              TLSv1,TLSv1.1,TLSv1.2
16    AES256-SHA                   TLSv1,TLSv1.1,TLSv1.2
17    CAMELLIA128-SHA              TLSv1,TLSv1.1,TLSv1.2
18    AES128-SHA                   TLSv1,TLSv1.1,TLSv1.2

Certificate: trusted, 4096 bit, sha256WithRSAEncryption signature
TLS ticket lifetime hint: 300
OCSP stapling: supported

And here are a list of options

-a | --allciphers   Test all known ciphers individually at the end.
-b | --benchmark    Activate benchmark mode.
-d | --delay        Pause for n seconds between connections
-D | --debug        Output ALL the information.
-h | --help         Shows this help text.
-j | --json         Output results in JSON format.
-o | --openssl      path/to/your/openssl binary you want to use.
-v | --verbose      Increase verbosity.

The json output is useful if you're calling this from other scripts.

share|improve this answer


This one is Python based, works in Linux/Mac/Windows from command line.

share|improve this answer

After a little googling I found this Testing for SSL-TLS (OWASP-CM-001):

The nmap scanner, via the “–sV” scan option, is able to identify SSL services. Vulnerability Scanners, in addition to performing service discovery, may include checks against weak ciphers (for example, the Nessus scanner has the capability of checking SSL services on arbitrary ports, and will report weak ciphers).

and also: Foundstone SSL Digger is a tool to assess the strength of SSL servers by testing the ciphers supported. Some of these ciphers are known to be insecure.

share|improve this answer

SSLScan is great; a new tool SSLDiagnos works for Windows, or you can just write a script using the openssl s_client.

share|improve this answer

There is a nice little script at pentesterscripting.com to utilise both SSLScan and OpenSSL to check for:

  • SSL v2;
  • Week ciphers suits;
  • MD5; and
  • TLS Renegotiation vulnerability


Usage: ./ssltest.sh HOST PORT

share|improve this answer
Link is dead, Jim –  staticx Apr 28 '14 at 13:27

An online ssl tool that also reports about accepted ciphers is at https://paranoidsecurity.nl

share|improve this answer
Please refer to this meta post for recommending software as an answer. –  KronoS Sep 11 '12 at 18:08

Nmap's ssl-enum-ciphers script can list the supported ciphers and SSL/TLS versions, as well as the supported compressors.

share|improve this answer

If you want a nice grepable output (and support for checking all SSL/TLS versions)

Usage: ./script.sh www.url.com

#!/usr/bin/env bash
ciphers2=$(openssl ciphers -ssl2 'ALL:eNULL' | sed -e 's/:/ /g')
ciphers3=$(openssl ciphers -ssl3 'ALL:eNULL' | sed -e 's/:/ /g')
cipherst1=$(openssl ciphers -tls1 'ALL:eNULL' | sed -e 's/:/ /g')
cipherst11=$(openssl ciphers -tls1.1 'ALL:eNULL' | sed -e 's/:/ /g')
cipherst12=$(openssl ciphers -tls1.2 'ALL:eNULL' | sed -e 's/:/ /g')

for cipher in ${ciphers2[@]}
result=$(echo -n | openssl s_client -ssl2 -cipher "$cipher" -connect $1:443 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
SSL2=$(echo "${SSL2})" | sed -e 's/:)/)/g')

for cipher in ${ciphers3[@]}
result=$(echo -n | openssl s_client -ssl3 -cipher "$cipher" -connect $1:443 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
SSL3=$(echo "${SSL3})" | sed -e 's/:)/)/g')
for cipher in ${cipherst1[@]}
result=$(echo -n | openssl s_client -tls1 -cipher "$cipher" -connect $1:443 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
TLS1=$(echo "${TLS1})" | sed -e 's/:)/)/g')

for cipher in ${cipherst11[@]}
result=$(echo -n | openssl s_client -tls1_1 -cipher "$cipher" -connect $1:443 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
TLS11=$(echo "${TLS11})" | sed -e 's/:)/)/g')

for cipher in ${cipherst12[@]}
result=$(echo -n | openssl s_client -tls1_2 -cipher "$cipher" -connect $1:443 2>&1)
if [[ "$result" =~ "Cipher is ${cipher}" ]] ; then
TLS12=$(echo "${TLS12})" | sed -e 's/:)/)/g')

echo "$1,$SSL2,$SSL3,$TLS1,$TLS11,$TLS12";
share|improve this answer

I wrote a tool that does exactly this. It's called tlsenum and it's available on GitHub.

[ayrx@division tlsenum]$ ./tlsenum.py twitter.com 443
TLS Versions supported by server: 3.0, 1.0, 1.1, 1.2
Supported Cipher suites in order of priority:

Here is an example output of the tool against twitter.com.

It's similar to what SSL Lab's does but I find that having a command line tool that you can automate and parse is much more useful.

share|improve this answer

I am using for most of the SSL tests testssl.sh (see https://testssl.sh / devel version @ https://github.com/drwetter/testssl.sh. It tests for vulnerabilities, ciphers, protocols etc.

share|improve this answer

The only thing you can do is try them all, one at a time, and see which ones are accepted. I am not aware of a tool to do this, though it should not be hard to cobble one together from scripting tools and openssl s_client.

While the client advertises which ciphersuites it will accept, the server simply picks one and uses it or fails the connection if it finds nothing it likes.

share|improve this answer

All those answers are fine. One part of the answer could explain why do we need a tool to discover list of server and not ask directly in TLS that server gives all its supported cipher suites just like TLS client does when it connects to a server.

Answer is that server does not send a list ever, it just select in client cipher list the cipher it wants to use, this is the way SSL/TLS protocol is written : http://wiki.opensslfoundation.com/index.php/SSL_and_TLS_Protocols#Cipher_Suites

That's why client has to enumerate ciphers to be able to find those supported by server and for that to do at least one new start handshake (ClientHello) for each cipher suite.

share|improve this answer

While looking for something that does AUTH TLS on FTP, I discovered this tool: ssl-cipher-suite-enum

It’s a perl script that basically does what hackajar’s shell script does, only more sophisticated.

It also offers a basic evaluation of offered ciphers and protocols. It’s somewhat like SSL Labs tools, only for home use. :)

By default, it only supports AUTH SSL on FTP, but a simple search and replace can fix that. As a bonus, it also claims to support SMTP with STARTTLS and RDP.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.