eric6/E5Network/E5SslUtilities.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric6/E5Network/E5SslUtilities.py	Sun Apr 14 15:09:21 2019 +0200
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing SSL utility functions.
+"""
+
+from __future__ import unicode_literals
+
+
+def initSSL():
+    """
+    Function to initialize some global SSL stuff.
+    """
+    blacklist = [
+        "SRP-AES-256-CBC-SHA",          # open to MitM
+        "SRP-AES-128-CBC-SHA",          # open to MitM
+    ]
+    
+    try:
+        from PyQt5.QtNetwork import QSslSocket
+    except ImportError:
+        # no SSL available, so there is nothing to initialize
+        return
+    
+    strongCiphers = [c for c in QSslSocket.supportedCiphers()
+                     if c.name() not in blacklist and c.usedBits() >= 128]
+    QSslSocket.setDefaultCiphers(strongCiphers)

eric ide

mercurial