eric7/E5Network/E5SslUtilities.py

branch
eric7
changeset 8312
800c432b34c8
parent 7923
91e843545d9a
child 8318
962bce857696
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric7/E5Network/E5SslUtilities.py	Sat May 15 18:45:04 2021 +0200
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing SSL utility functions.
+"""
+
+
+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