E5Network/E5SslUtilities.py

changeset 4317
0de465a93200
child 4318
c2f374ca452b
equal deleted inserted replaced
4316:493891cbacee 4317:0de465a93200
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing SSL utility functions.
8 """
9
10 from PyQt5.QtCore import qVersion
11
12 def initSSL():
13 """
14 Function to initialize some global SSL stuff.
15 """
16 if qVersion() < "5.3.0":
17 # Qt 5.3.0 and newer don't use weak ciphers anymore
18 try:
19 from PyQt5.QtNetwork import QSslSocket
20 except ImportError:
21 # no SSL available, so there is nothing to initialize
22 return
23
24 strongCiphers = [c for c in QSslSocket.supportedCiphers()
25 if c.usedBits() >= 128]
26 QSslSocket.setDefaultCiphers(strongCiphers)

eric ide

mercurial