16 from PyQt6.QtNetwork import QSslConfiguration # __IGNORE_WARNING_I10__ |
16 from PyQt6.QtNetwork import QSslConfiguration # __IGNORE_WARNING_I10__ |
17 except ImportError: |
17 except ImportError: |
18 # no SSL available, so there is nothing to initialize |
18 # no SSL available, so there is nothing to initialize |
19 return |
19 return |
20 |
20 |
21 blacklist = [ |
21 blocklist = [ |
22 "SRP-AES-256-CBC-SHA", # open to MitM |
22 "SRP-AES-256-CBC-SHA", # open to MitM |
23 "SRP-AES-128-CBC-SHA", # open to MitM |
23 "SRP-AES-128-CBC-SHA", # open to MitM |
24 ] |
24 ] |
25 |
25 |
26 strongCiphers = [ |
26 strongCiphers = [ |
27 c |
27 c |
28 for c in QSslConfiguration.supportedCiphers() |
28 for c in QSslConfiguration.supportedCiphers() |
29 if c.name() not in blacklist and c.usedBits() >= 128 |
29 if c.name() not in blocklist and c.usedBits() >= 128 |
30 ] |
30 ] |
31 defaultSslConfiguration = QSslConfiguration.defaultConfiguration() |
31 defaultSslConfiguration = QSslConfiguration.defaultConfiguration() |
32 defaultSslConfiguration.setCiphers(strongCiphers) |
32 defaultSslConfiguration.setCiphers(strongCiphers) |
33 QSslConfiguration.setDefaultConfiguration(defaultSslConfiguration) |
33 QSslConfiguration.setDefaultConfiguration(defaultSslConfiguration) |