File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -984,6 +984,25 @@ SSLv2 explicitly using the :data:`SSLContext.options` attribute::
984984The SSL context created above will allow SSLv3 and TLSv1 connections, but
985985not SSLv2.
986986
987+ Cipher selection
988+ ^^^^^^^^^^^^^^^^
989+
990+ If you have advanced security requirements, fine-tuning of the ciphers
991+ enabled when negotiating a SSL session is possible through the
992+ :meth: `SSLContext.set_ciphers ` method. Starting from Python 3.2.3, the
993+ ssl module disables certain weak ciphers by default, but you may want
994+ to further restrict the cipher choice. For example::
995+
996+ context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
997+ context.set_ciphers('HIGH:!aNULL:!eNULL')
998+
999+ The ``!aNULL:!eNULL `` part of the cipher spec is necessary to disable ciphers
1000+ which don't provide both encryption and authentication. Be sure to read
1001+ OpenSSL's documentation about the `cipher list
1002+ format <http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT> `_.
1003+ If you want to check which ciphers are enabled by a given cipher list,
1004+ use the ``openssl ciphers `` command on your system.
1005+
9871006
9881007.. seealso ::
9891008
You can’t perform that action at this time.
0 commit comments