|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2015 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing SSL utility functions. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 |
|
13 def initSSL(): |
|
14 """ |
|
15 Function to initialize some global SSL stuff. |
|
16 """ |
|
17 blacklist = [ |
|
18 "SRP-AES-256-CBC-SHA", # open to MitM |
|
19 "SRP-AES-128-CBC-SHA", # open to MitM |
|
20 ] |
|
21 |
|
22 try: |
|
23 from PyQt5.QtNetwork import QSslSocket |
|
24 except ImportError: |
|
25 # no SSL available, so there is nothing to initialize |
|
26 return |
|
27 |
|
28 strongCiphers = [c for c in QSslSocket.supportedCiphers() |
|
29 if c.name() not in blacklist and c.usedBits() >= 128] |
|
30 QSslSocket.setDefaultCiphers(strongCiphers) |