12 import platform |
12 import platform |
13 |
13 |
14 from PyQt6.QtCore import QByteArray, QObject |
14 from PyQt6.QtCore import QByteArray, QObject |
15 from PyQt6.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslError |
15 from PyQt6.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslError |
16 |
16 |
17 from eric7 import Globals, Preferences, Utilities |
17 from eric7 import EricUtilities, Preferences, Utilities |
18 from eric7.EricWidgets import EricMessageBox |
18 from eric7.EricWidgets import EricMessageBox |
19 from eric7.SystemUtilities import OSUtilities |
19 from eric7.SystemUtilities import OSUtilities |
20 |
20 |
21 |
21 |
22 class EricSslErrorState(enum.Enum): |
22 class EricSslErrorState(enum.Enum): |
47 super().__init__(parent) |
47 super().__init__(parent) |
48 |
48 |
49 caList = self.__getSystemCaCertificates() |
49 caList = self.__getSystemCaCertificates() |
50 if Preferences.getSettings().contains("Help/CaCertificatesDict"): |
50 if Preferences.getSettings().contains("Help/CaCertificatesDict"): |
51 # port old entries stored under 'Help' |
51 # port old entries stored under 'Help' |
52 certificateDict = Globals.toDict( |
52 certificateDict = EricUtilities.toDict( |
53 Preferences.getSettings().value("Help/CaCertificatesDict") |
53 Preferences.getSettings().value("Help/CaCertificatesDict") |
54 ) |
54 ) |
55 Preferences.getSettings().setValue( |
55 Preferences.getSettings().setValue( |
56 "Ssl/CaCertificatesDict", certificateDict |
56 "Ssl/CaCertificatesDict", certificateDict |
57 ) |
57 ) |
58 Preferences.getSettings().remove("Help/CaCertificatesDict") |
58 Preferences.getSettings().remove("Help/CaCertificatesDict") |
59 else: |
59 else: |
60 certificateDict = Globals.toDict( |
60 certificateDict = EricUtilities.toDict( |
61 Preferences.getSettings().value("Ssl/CaCertificatesDict") |
61 Preferences.getSettings().value("Ssl/CaCertificatesDict") |
62 ) |
62 ) |
63 for server in certificateDict: |
63 for server in certificateDict: |
64 for cert in QSslCertificate.fromData(certificateDict[server]): |
64 for cert in QSslCertificate.fromData(certificateDict[server]): |
65 if cert not in caList: |
65 if cert not in caList: |
124 @return tuple indicating to ignore the SSL errors and indicating a |
124 @return tuple indicating to ignore the SSL errors and indicating a |
125 change of the default SSL configuration |
125 change of the default SSL configuration |
126 @rtype tuple of (EricSslErrorState, bool) |
126 @rtype tuple of (EricSslErrorState, bool) |
127 """ |
127 """ |
128 caMerge = {} |
128 caMerge = {} |
129 certificateDict = Globals.toDict( |
129 certificateDict = EricUtilities.toDict( |
130 Preferences.getSettings().value("Ssl/CaCertificatesDict") |
130 Preferences.getSettings().value("Ssl/CaCertificatesDict") |
131 ) |
131 ) |
132 for caServer in certificateDict: |
132 for caServer in certificateDict: |
133 caMerge[caServer] = QSslCertificate.fromData(certificateDict[caServer]) |
133 caMerge[caServer] = QSslCertificate.fromData(certificateDict[caServer]) |
134 caNew = [] |
134 caNew = [] |
264 |
264 |
265 @return list of system certificates |
265 @return list of system certificates |
266 @rtype list of QSslCertificate |
266 @rtype list of QSslCertificate |
267 """ |
267 """ |
268 caList = QSslCertificate.fromData( |
268 caList = QSslCertificate.fromData( |
269 Globals.toByteArray( |
269 EricUtilities.toByteArray( |
270 Preferences.getSettings().value("Ssl/SystemCertificates") |
270 Preferences.getSettings().value("Ssl/SystemCertificates") |
271 ) |
271 ) |
272 ) |
272 ) |
273 if not caList: |
273 if not caList: |
274 caList = QSslConfiguration.systemCaCertificates() |
274 caList = QSslConfiguration.systemCaCertificates() |