]> granicus.if.org Git - python/commitdiff
Add a subsection explaning cipher selection.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 4 Jan 2012 01:53:44 +0000 (02:53 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 4 Jan 2012 01:53:44 +0000 (02:53 +0100)
Doc/library/ssl.rst

index 497c5ba6212245925c99d77a45f01bd2d03ce89e..00322cf2a199eeed1e1b177e4d23e44cb600d62b 100644 (file)
@@ -984,6 +984,25 @@ SSLv2 explicitly using the :data:`SSLContext.options` attribute::
 The SSL context created above will allow SSLv3 and TLSv1 connections, but
 not SSLv2.
 
+Cipher selection
+^^^^^^^^^^^^^^^^
+
+If you have advanced security requirements, fine-tuning of the ciphers
+enabled when negotiating a SSL session is possible through the
+:meth:`SSLContext.set_ciphers` method.  Starting from Python 3.2.3, the
+ssl module disables certain weak ciphers by default, but you may want
+to further restrict the cipher choice.  For example::
+
+   context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+   context.set_ciphers('HIGH:!aNULL:!eNULL')
+
+The ``!aNULL:!eNULL`` part of the cipher spec is necessary to disable ciphers
+which don't provide both encryption and authentication.  Be sure to read
+OpenSSL's documentation about the `cipher list
+format <http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT>`_.
+If you want to check which ciphers are enabled by a given cipher list,
+use the ``openssl ciphers`` command on your system.
+
 
 .. seealso::