Thu, 26 Sep 2024 15:49:36 +0200
Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
--- a/eric7.epj Thu Sep 26 09:48:49 2024 +0200 +++ b/eric7.epj Thu Sep 26 15:49:36 2024 +0200 @@ -850,6 +850,7 @@ "src/eric7/DesignerTemplates", "src/eric7/Documentation/Help", "src/eric7/Documentation/Source", + "src/eric7/EricCore/EricPreferences", "src/eric7/EricNetwork/data/effective_tld_names.dat", "src/eric7/EricNetwork/data/test_psl.txt", "src/eric7/IconEditor/cursors/aim-cursor.xpm", @@ -1204,6 +1205,7 @@ "src/eric7/DocumentationTools/TemplatesListsStyleCSS.py", "src/eric7/DocumentationTools/__init__.py", "src/eric7/EricCore/EricFileSystemWatcher.py", + "src/eric7/EricCore/EricPreferences.py", "src/eric7/EricCore/EricProcess.py", "src/eric7/EricCore/EricStdRedirector.py", "src/eric7/EricCore/EricTreeSortFilterProxyModel.py", @@ -1248,6 +1250,9 @@ "src/eric7/EricUtilities/EricCache.py", "src/eric7/EricUtilities/EricMutexLocker.py", "src/eric7/EricUtilities/__init__.py", + "src/eric7/EricUtilities/crypto/__init__.py", + "src/eric7/EricUtilities/crypto/py3AES.py", + "src/eric7/EricUtilities/crypto/py3PBKDF2.py", "src/eric7/EricWidgets/EricAnimatedLabel.py", "src/eric7/EricWidgets/EricAnimatedWidget.py", "src/eric7/EricWidgets/EricApplication.py", @@ -2672,9 +2677,6 @@ "src/eric7/Utilities/MouseUtilities.py", "src/eric7/Utilities/PasswordChecker.py", "src/eric7/Utilities/__init__.py", - "src/eric7/Utilities/crypto/__init__.py", - "src/eric7/Utilities/crypto/py3AES.py", - "src/eric7/Utilities/crypto/py3PBKDF2.py", "src/eric7/Utilities/uic.py", "src/eric7/VCS/CommandOptionsDialog.py", "src/eric7/VCS/ProjectBrowserHelper.py",
--- a/src/eric7/APIs/Python3/eric7.api Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Thu Sep 26 15:49:36 2024 +0200 @@ -1108,6 +1108,14 @@ eric7.EricCore.EricFileSystemWatcher._EricFileSystemEventHandler?2(parent=None) eric7.EricCore.EricFileSystemWatcher._GlobalFileSystemWatcher?8 eric7.EricCore.EricFileSystemWatcher.instance?4() +eric7.EricCore.EricPreferences.EricPreferences.proxyDefaults?7 +eric7.EricCore.EricPreferences._settingsNameGlobal?8 +eric7.EricCore.EricPreferences._settingsNameOrganization?8 +eric7.EricCore.EricPreferences.convertPasswords?4(oldPassword, newPassword) +eric7.EricCore.EricPreferences.getNetworkProxy?4(key) +eric7.EricCore.EricPreferences.initPreferences?4() +eric7.EricCore.EricPreferences.setNetworkProxy?4(key, value) +eric7.EricCore.EricPreferences.syncPreferences?4() eric7.EricCore.EricProcess.EricProcess.failed?7 eric7.EricCore.EricProcess.EricProcess.succeeded?7 eric7.EricCore.EricProcess.EricProcess.timedOut?4() @@ -1242,12 +1250,12 @@ eric7.EricNetwork.EricJsonServer.EricJsonServer.startClient?4(interpreter, clientScript, clientArgs, idString="", environment=None) eric7.EricNetwork.EricJsonServer.EricJsonServer.stopAllClients?4() eric7.EricNetwork.EricJsonServer.EricJsonServer.stopClient?4(idString="") -eric7.EricNetwork.EricJsonServer.EricJsonServer?1(name="", multiplex=False, parent=None) +eric7.EricNetwork.EricJsonServer.EricJsonServer?1(name="", interface="127.0.0.1", multiplex=False, parent=None) eric7.EricNetwork.EricJsonStreamReader.EricJsonReader.address?4() eric7.EricNetwork.EricJsonStreamReader.EricJsonReader.dataReceived?7 eric7.EricNetwork.EricJsonStreamReader.EricJsonReader.handleNewConnection?4() eric7.EricNetwork.EricJsonStreamReader.EricJsonReader.port?4() -eric7.EricNetwork.EricJsonStreamReader.EricJsonReader?1(name="", ip=None, parent=None) +eric7.EricNetwork.EricJsonStreamReader.EricJsonReader?1(name="", interface="127.0.0.1", parent=None) eric7.EricNetwork.EricJsonStreamWriter.EricJsonWriter.close?4() eric7.EricNetwork.EricJsonStreamWriter.EricJsonWriter.write?4(data) eric7.EricNetwork.EricJsonStreamWriter.EricJsonWriter?1(host, port) @@ -1282,7 +1290,7 @@ eric7.EricNetwork.EricSslCertificatesDialog.EricSslCertificatesDialog.on_serversExportButton_clicked?4() eric7.EricNetwork.EricSslCertificatesDialog.EricSslCertificatesDialog.on_serversImportButton_clicked?4() eric7.EricNetwork.EricSslCertificatesDialog.EricSslCertificatesDialog.on_serversViewButton_clicked?4() -eric7.EricNetwork.EricSslCertificatesDialog.EricSslCertificatesDialog?1(parent=None) +eric7.EricNetwork.EricSslCertificatesDialog.EricSslCertificatesDialog?1(settings, parent=None) eric7.EricNetwork.EricSslCertificatesInfoDialog.EricSslCertificatesInfoDialog?1(certificateChain, parent=None) eric7.EricNetwork.EricSslCertificatesInfoWidget.EricSslCertificatesInfoWidget.on_chainComboBox_activated?4(index) eric7.EricNetwork.EricSslCertificatesInfoWidget.EricSslCertificatesInfoWidget.showCertificate?4(certificate) @@ -1292,7 +1300,7 @@ eric7.EricNetwork.EricSslErrorHandler.EricSslErrorHandler.sslErrors?4(errors, server, port=-1) eric7.EricNetwork.EricSslErrorHandler.EricSslErrorHandler.sslErrorsReply?4(reply, errors) eric7.EricNetwork.EricSslErrorHandler.EricSslErrorHandler.sslErrorsReplySlot?4(reply, errors) -eric7.EricNetwork.EricSslErrorHandler.EricSslErrorHandler?1(parent=None) +eric7.EricNetwork.EricSslErrorHandler.EricSslErrorHandler?1(settings, parent=None) eric7.EricNetwork.EricSslErrorHandler.EricSslErrorState.NOT_IGNORED?7 eric7.EricNetwork.EricSslErrorHandler.EricSslErrorState.SYSTEM_IGNORED?7 eric7.EricNetwork.EricSslErrorHandler.EricSslErrorState.USER_IGNORED?7 @@ -1366,13 +1374,64 @@ eric7.EricUtilities.EricCache.EricCache.setSize?4(newSize) eric7.EricUtilities.EricCache.EricCache?1(size=100) eric7.EricUtilities.EricMutexLocker.EricMutexLocker?1(mutex) +eric7.EricUtilities._configDir?8 +eric7.EricUtilities._escape?8 +eric7.EricUtilities._escape_map?8 +eric7.EricUtilities._uescape?8 +eric7.EricUtilities._uunescape?8 +eric7.EricUtilities.crypto.CryptoMarker?7 +eric7.EricUtilities.crypto.Delimiter?7 +eric7.EricUtilities.crypto.EncodeMarker?7 +eric7.EricUtilities.crypto.MainPassword?7 +eric7.EricUtilities.crypto.changeRememberedMain?4(newPassword) +eric7.EricUtilities.crypto.dataDecrypt?4(edata, password, keyLength=32) +eric7.EricUtilities.crypto.dataEncrypt?4(data, password, keyLength=32, hashIterations=10000) +eric7.EricUtilities.crypto.pwConvert?4(pw, encode=True) +eric7.EricUtilities.crypto.pwDecode?4(epw) +eric7.EricUtilities.crypto.pwDecrypt?4(epw, mainPW=None) +eric7.EricUtilities.crypto.pwEncode?4(pw) +eric7.EricUtilities.crypto.pwEncrypt?4(pw, mainPW=None) +eric7.EricUtilities.crypto.pwRecode?4(epw, oldPassword, newPassword) +eric7.EricUtilities.crypto.pwReencrypt?4(epw, oldPassword, newPassword) +eric7.EricUtilities.crypto.py3AES.AES.KeySize?7 +eric7.EricUtilities.crypto.py3AES.AES.Rcon?7 +eric7.EricUtilities.crypto.py3AES.AES.decrypt?4(iput, key, size) +eric7.EricUtilities.crypto.py3AES.AES.encrypt?4(iput, key, size) +eric7.EricUtilities.crypto.py3AES.AES.rsbox?7 +eric7.EricUtilities.crypto.py3AES.AES.sbox?7 +eric7.EricUtilities.crypto.py3AES.AESModeOfOperation.ModeOfOperation?7 +eric7.EricUtilities.crypto.py3AES.AESModeOfOperation.aes?7 +eric7.EricUtilities.crypto.py3AES.AESModeOfOperation.decrypt?4(cipherIn, originalsize, mode, key, size, IV) +eric7.EricUtilities.crypto.py3AES.AESModeOfOperation.encrypt?4(inputData, mode, key, size, IV) +eric7.EricUtilities.crypto.py3AES.append_PKCS7_padding?4(b) +eric7.EricUtilities.crypto.py3AES.decryptData?4(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]) +eric7.EricUtilities.crypto.py3AES.encryptData?4(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]) +eric7.EricUtilities.crypto.py3AES.strip_PKCS7_padding?4(b) +eric7.EricUtilities.crypto.py3PBKDF2.Delimiter?7 +eric7.EricUtilities.crypto.py3PBKDF2.Hashes?7 +eric7.EricUtilities.crypto.py3PBKDF2.hashPassword?4(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32) +eric7.EricUtilities.crypto.py3PBKDF2.hashPasswordTuple?4(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32) +eric7.EricUtilities.crypto.py3PBKDF2.pbkdf2?4(password, salt, iterations, digestMod) +eric7.EricUtilities.crypto.py3PBKDF2.rehashPassword?4(password, hashParameters) +eric7.EricUtilities.crypto.py3PBKDF2.verifyPassword?4(password, pwHash) eric7.EricUtilities.dataString?4(size, loc=None) +eric7.EricUtilities.decodeBytes?4(buffer) +eric7.EricUtilities.decodeString?4(text) +eric7.EricUtilities.escape_entities?4(m, escmap=_escape_map) +eric7.EricUtilities.escape_uentities?4(m) +eric7.EricUtilities.getConfigDir?4() +eric7.EricUtilities.html_encode?4(text, pattern=_escape) +eric7.EricUtilities.html_udecode?4(text, pattern=_uunescape) +eric7.EricUtilities.html_uencode?4(text, pattern=_uescape) +eric7.EricUtilities.readStringFromStream?4(stream) +eric7.EricUtilities.setConfigDir?4(d) eric7.EricUtilities.strGroup?4(txt, sep, groupLen=4) eric7.EricUtilities.strToQByteArray?4(txt) eric7.EricUtilities.toBool?4(value) eric7.EricUtilities.toByteArray?4(value) eric7.EricUtilities.toDict?4(value) eric7.EricUtilities.toList?4(value) +eric7.EricUtilities.unescape_uentities?4(m) eric7.EricUtilities.versionIsValid?4(version) eric7.EricUtilities.versionToTuple?4(version) eric7.EricWidgets.EricAnimatedLabel.EricAnimatedLabel.getAnimationFile?4() @@ -2084,8 +2143,6 @@ eric7.EricXML.XMLStreamReaderBase.XMLStreamReaderBase.showErrorMessage?4() eric7.EricXML.XMLStreamReaderBase.XMLStreamReaderBase.toBool?4(value) eric7.EricXML.XMLStreamReaderBase.XMLStreamReaderBase?1(device) -eric7.Globals.configDir?7 -eric7.Globals.getConfigDir?4() eric7.Globals.getInstallInfoFilePath?4() eric7.Globals.getWebBrowserSupport?4() eric7.Globals.recentNameBreakpointConditions?7 @@ -2101,7 +2158,6 @@ eric7.Globals.recentNameTestFileHistory?7 eric7.Globals.recentNameTestFramework?7 eric7.Globals.recentNameTestNameHistory?7 -eric7.Globals.setConfigDir?4(d) eric7.Globals.settingsNameGlobal?7 eric7.Globals.settingsNameOrganization?7 eric7.Globals.settingsNameRecent?7 @@ -7661,8 +7717,6 @@ eric7.Preferences.ConfigurationPages.MultiProjectPage.MultiProjectPage.save?4() eric7.Preferences.ConfigurationPages.MultiProjectPage.MultiProjectPage?1() eric7.Preferences.ConfigurationPages.MultiProjectPage.create?4(_dlg) -eric7.Preferences.ConfigurationPages.NetworkPage.NetworkPage.on_clearProxyPasswordsButton_clicked?4() -eric7.Preferences.ConfigurationPages.NetworkPage.NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged?4(index) eric7.Preferences.ConfigurationPages.NetworkPage.NetworkPage.save?4() eric7.Preferences.ConfigurationPages.NetworkPage.NetworkPage.setMode?4(displayMode) eric7.Preferences.ConfigurationPages.NetworkPage.NetworkPage?1(configDialog) @@ -11307,57 +11361,14 @@ eric7.Utilities.PasswordChecker.PasswordStrength.VeryStrong?7 eric7.Utilities.PasswordChecker.PasswordStrength.VeryWeak?7 eric7.Utilities.PasswordChecker.PasswordStrength.Weak?7 -eric7.Utilities._escape?8 -eric7.Utilities._escape_map?8 eric7.Utilities._percentReplacementFunc?5(matchobj) eric7.Utilities._slashmap?8 -eric7.Utilities._uescape?8 -eric7.Utilities._uunescape?8 eric7.Utilities.codingBytes_regexps?7 eric7.Utilities.coding_regexps?7 eric7.Utilities.convertLineEnds?4(text, eol) -eric7.Utilities.crypto.CryptoMarker?7 -eric7.Utilities.crypto.Delimiter?7 -eric7.Utilities.crypto.EncodeMarker?7 -eric7.Utilities.crypto.MainPassword?7 -eric7.Utilities.crypto.changeRememberedMain?4(newPassword) -eric7.Utilities.crypto.dataDecrypt?4(edata, password, keyLength=32) -eric7.Utilities.crypto.dataEncrypt?4(data, password, keyLength=32, hashIterations=10000) -eric7.Utilities.crypto.pwConvert?4(pw, encode=True) -eric7.Utilities.crypto.pwDecode?4(epw) -eric7.Utilities.crypto.pwDecrypt?4(epw, mainPW=None) -eric7.Utilities.crypto.pwEncode?4(pw) -eric7.Utilities.crypto.pwEncrypt?4(pw, mainPW=None) -eric7.Utilities.crypto.pwRecode?4(epw, oldPassword, newPassword) -eric7.Utilities.crypto.pwReencrypt?4(epw, oldPassword, newPassword) -eric7.Utilities.crypto.py3AES.AES.KeySize?7 -eric7.Utilities.crypto.py3AES.AES.Rcon?7 -eric7.Utilities.crypto.py3AES.AES.decrypt?4(iput, key, size) -eric7.Utilities.crypto.py3AES.AES.encrypt?4(iput, key, size) -eric7.Utilities.crypto.py3AES.AES.rsbox?7 -eric7.Utilities.crypto.py3AES.AES.sbox?7 -eric7.Utilities.crypto.py3AES.AESModeOfOperation.ModeOfOperation?7 -eric7.Utilities.crypto.py3AES.AESModeOfOperation.aes?7 -eric7.Utilities.crypto.py3AES.AESModeOfOperation.decrypt?4(cipherIn, originalsize, mode, key, size, IV) -eric7.Utilities.crypto.py3AES.AESModeOfOperation.encrypt?4(inputData, mode, key, size, IV) -eric7.Utilities.crypto.py3AES.append_PKCS7_padding?4(b) -eric7.Utilities.crypto.py3AES.decryptData?4(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]) -eric7.Utilities.crypto.py3AES.encryptData?4(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]) -eric7.Utilities.crypto.py3AES.strip_PKCS7_padding?4(b) -eric7.Utilities.crypto.py3PBKDF2.Delimiter?7 -eric7.Utilities.crypto.py3PBKDF2.Hashes?7 -eric7.Utilities.crypto.py3PBKDF2.hashPassword?4(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32) -eric7.Utilities.crypto.py3PBKDF2.hashPasswordTuple?4(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32) -eric7.Utilities.crypto.py3PBKDF2.pbkdf2?4(password, salt, iterations, digestMod) -eric7.Utilities.crypto.py3PBKDF2.rehashPassword?4(password, hashParameters) -eric7.Utilities.crypto.py3PBKDF2.verifyPassword?4(password, pwHash) eric7.Utilities.decode?4(text) -eric7.Utilities.decodeBytes?4(buffer) -eric7.Utilities.decodeString?4(text) eric7.Utilities.decodeWithEncoding?4(text, encoding) eric7.Utilities.encode?4(text, origEncoding, forcedEncoding="") -eric7.Utilities.escape_entities?4(m, escmap=_escape_map) -eric7.Utilities.escape_uentities?4(m) eric7.Utilities.extractFlags?4(text) eric7.Utilities.extractFlagsFromFile?4(filename) eric7.Utilities.extractLineFlags?4(line, startComment=") @@ -11375,21 +11386,16 @@ eric7.Utilities.getTestFileNames?4(fn) eric7.Utilities.get_coding?4(text) eric7.Utilities.get_codingBytes?4(text) -eric7.Utilities.html_encode?4(text, pattern=_escape) -eric7.Utilities.html_udecode?4(text, pattern=_uunescape) -eric7.Utilities.html_uencode?4(text, pattern=_uescape) eric7.Utilities.linesep?4() eric7.Utilities.normalizeCode?4(codestring) eric7.Utilities.parseOptionString?4(s) eric7.Utilities.readEncodedFile?4(filename) eric7.Utilities.readEncodedFileWithEncoding?4(filename, encoding) eric7.Utilities.readEncodedFileWithHash?4(filename) -eric7.Utilities.readStringFromStream?4(stream) eric7.Utilities.rxIndex?4(rx, txt) eric7.Utilities.slash?4(txt) eric7.Utilities.supportedCodecs?7 eric7.Utilities.uic.compileUiFiles?4(directory, recurse=False) -eric7.Utilities.unescape_uentities?4(m) eric7.Utilities.unslash?4(txt) eric7.Utilities.writeEncodedFile?4(filename, text, origEncoding, forcedEncoding="") eric7.VCS.CommandOptionsDialog.VcsCommandOptionsDialog.getOptions?4()
--- a/src/eric7/Debugger/DebugUI.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Debugger/DebugUI.py Thu Sep 26 15:49:36 2024 +0200 @@ -1339,7 +1339,9 @@ program = self.ui.currentProg if message: - info = self.tr("Message: {0}").format(Utilities.html_uencode(message)) + info = self.tr("Message: {0}").format( + EricUtilities.html_uencode(message) + ) else: info = "" if program is None: @@ -1498,7 +1500,7 @@ "<p>Break here?</p>" ).format( exceptionType, - Utilities.html_encode(exceptionMessage), + EricUtilities.html_encode(exceptionMessage), stackTrace[0][0], stackTrace[0][1], ), @@ -1513,7 +1515,8 @@ "<p>The debugged program raised the exception" ' <b>{0}</b><br>"<b>{1}</b>"</p>' ).format( - exceptionType, Utilities.html_encode(exceptionMessage) + exceptionType, + EricUtilities.html_encode(exceptionMessage), ), ) if res == EricMessageBox.Yes: @@ -1783,13 +1786,13 @@ msg = self.tr( """<p>A watch expression '<b>{0}</b>'""" """ already exists.</p>""" - ).format(Utilities.html_encode(cond)) + ).format(EricUtilities.html_encode(cond)) else: msg = self.tr( """<p>A watch expression '<b>{0}</b>'""" """ for the variable <b>{1}</b> already""" """ exists.</p>""" - ).format(special, Utilities.html_encode(cond)) + ).format(special, EricUtilities.html_encode(cond)) EricMessageBox.warning( self.ui, self.tr("Watch expression already exists"), msg )
--- a/src/eric7/Debugger/DebuggerInterfacePython.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Debugger/DebuggerInterfacePython.py Thu Sep 26 15:49:36 2024 +0200 @@ -18,7 +18,7 @@ from PyQt6.QtCore import QObject, QProcess, QProcessEnvironment, QTimer, pyqtSlot -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences, Utilities from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp from eric7.Globals import getConfig @@ -1662,7 +1662,7 @@ """ eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(jsonStr.strip())), + ).format(str(err), EricUtilities.html_encode(jsonStr.strip())), EricMessageBox.Ok, ) return
--- a/src/eric7/Debugger/VariablesViewer.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Debugger/VariablesViewer.py Thu Sep 26 15:49:36 2024 +0200 @@ -22,7 +22,7 @@ from PyQt6.QtGui import QBrush, QFontMetrics from PyQt6.QtWidgets import QAbstractItemView, QMenu, QToolTip, QTreeView -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.DebugClients.Python.DebugConfig import UnknownAttributeValueMarker from eric7.EricWidgets.EricApplication import ericApp @@ -634,7 +634,7 @@ return None if Qt.mightBeRichText(tooltip): - tooltip = Utilities.html_encode(tooltip) + tooltip = EricUtilities.html_encode(tooltip) if column == 0: indentation = self.treeView.indentation()
--- a/src/eric7/Debugger/WatchPointViewer.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Debugger/WatchPointViewer.py Thu Sep 26 15:49:36 2024 +0200 @@ -10,7 +10,7 @@ from PyQt6.QtCore import QItemSelectionModel, QModelIndex, QSortFilterProxyModel, Qt from PyQt6.QtWidgets import QAbstractItemView, QDialog, QHeaderView, QMenu, QTreeView -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox from eric7.EricWidgets.EricApplication import ericApp @@ -249,12 +249,12 @@ if not special: msg = self.tr( """<p>A watch expression '<b>{0}</b>' already exists.</p>""" - ).format(Utilities.html_encode(cond)) + ).format(EricUtilities.html_encode(cond)) else: msg = self.tr( """<p>A watch expression '<b>{0}</b>'""" """ for the variable <b>{1}</b> already exists.</p>""" - ).format(special, Utilities.html_encode(cond)) + ).format(special, EricUtilities.html_encode(cond)) EricMessageBox.warning( self, self.tr("Watch expression already exists"), msg )
--- a/src/eric7/Documentation/Help/source.qhp Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Thu Sep 26 15:49:36 2024 +0200 @@ -109,6 +109,7 @@ </section> <section title="eric7.EricCore" ref="index-eric7.EricCore.html"> <section title="eric7.EricCore.EricFileSystemWatcher" ref="eric7.EricCore.EricFileSystemWatcher.html" /> + <section title="eric7.EricCore.EricPreferences" ref="eric7.EricCore.EricPreferences.html" /> <section title="eric7.EricCore.EricProcess" ref="eric7.EricCore.EricProcess.html" /> <section title="eric7.EricCore.EricStdRedirector" ref="eric7.EricCore.EricStdRedirector.html" /> <section title="eric7.EricCore.EricTreeSortFilterProxyModel" ref="eric7.EricCore.EricTreeSortFilterProxyModel.html" /> @@ -150,6 +151,11 @@ <section title="eric7.EricNetwork.EricUrlInfo" ref="eric7.EricNetwork.EricUrlInfo.html" /> </section> <section title="eric7.EricUtilities" ref="index-eric7.EricUtilities.html"> + <section title="eric7.EricUtilities.crypto" ref="index-eric7.EricUtilities.crypto.html"> + <section title="eric7.EricUtilities.crypto.__init__" ref="eric7.EricUtilities.crypto.__init__.html" /> + <section title="eric7.EricUtilities.crypto.py3AES" ref="eric7.EricUtilities.crypto.py3AES.html" /> + <section title="eric7.EricUtilities.crypto.py3PBKDF2" ref="eric7.EricUtilities.crypto.py3PBKDF2.html" /> + </section> <section title="eric7.EricUtilities.EricCache" ref="eric7.EricUtilities.EricCache.html" /> <section title="eric7.EricUtilities.EricMutexLocker" ref="eric7.EricUtilities.EricMutexLocker.html" /> <section title="eric7.EricUtilities.__init__" ref="eric7.EricUtilities.__init__.html" /> @@ -1272,11 +1278,6 @@ <section title="eric7.Utilities.ClassBrowsers.pyclbr" ref="eric7.Utilities.ClassBrowsers.pyclbr.html" /> <section title="eric7.Utilities.ClassBrowsers.rbclbr" ref="eric7.Utilities.ClassBrowsers.rbclbr.html" /> </section> - <section title="eric7.Utilities.crypto" ref="index-eric7.Utilities.crypto.html"> - <section title="eric7.Utilities.crypto.__init__" ref="eric7.Utilities.crypto.__init__.html" /> - <section title="eric7.Utilities.crypto.py3AES" ref="eric7.Utilities.crypto.py3AES.html" /> - <section title="eric7.Utilities.crypto.py3PBKDF2" ref="eric7.Utilities.crypto.py3PBKDF2.html" /> - </section> <section title="eric7.Utilities.AutoSaver" ref="eric7.Utilities.AutoSaver.html" /> <section title="eric7.Utilities.BackgroundClient" ref="eric7.Utilities.BackgroundClient.html" /> <section title="eric7.Utilities.BackgroundService" ref="eric7.Utilities.BackgroundService.html" /> @@ -1608,31 +1609,31 @@ </section> </toc> <keywords> - <keyword name="AES" id="AES" ref="eric7.Utilities.crypto.py3AES.html#AES" /> - <keyword name="AES.__addRoundKey" id="AES.__addRoundKey" ref="eric7.Utilities.crypto.py3AES.html#AES.__addRoundKey" /> - <keyword name="AES.__aes_invMain" id="AES.__aes_invMain" ref="eric7.Utilities.crypto.py3AES.html#AES.__aes_invMain" /> - <keyword name="AES.__aes_invRound" id="AES.__aes_invRound" ref="eric7.Utilities.crypto.py3AES.html#AES.__aes_invRound" /> - <keyword name="AES.__aes_main" id="AES.__aes_main" ref="eric7.Utilities.crypto.py3AES.html#AES.__aes_main" /> - <keyword name="AES.__aes_round" id="AES.__aes_round" ref="eric7.Utilities.crypto.py3AES.html#AES.__aes_round" /> - <keyword name="AES.__core" id="AES.__core" ref="eric7.Utilities.crypto.py3AES.html#AES.__core" /> - <keyword name="AES.__createRoundKey" id="AES.__createRoundKey" ref="eric7.Utilities.crypto.py3AES.html#AES.__createRoundKey" /> - <keyword name="AES.__expandKey" id="AES.__expandKey" ref="eric7.Utilities.crypto.py3AES.html#AES.__expandKey" /> - <keyword name="AES.__galois_multiplication" id="AES.__galois_multiplication" ref="eric7.Utilities.crypto.py3AES.html#AES.__galois_multiplication" /> - <keyword name="AES.__getRconValue" id="AES.__getRconValue" ref="eric7.Utilities.crypto.py3AES.html#AES.__getRconValue" /> - <keyword name="AES.__getSBoxInvert" id="AES.__getSBoxInvert" ref="eric7.Utilities.crypto.py3AES.html#AES.__getSBoxInvert" /> - <keyword name="AES.__getSBoxValue" id="AES.__getSBoxValue" ref="eric7.Utilities.crypto.py3AES.html#AES.__getSBoxValue" /> - <keyword name="AES.__mixColumn" id="AES.__mixColumn" ref="eric7.Utilities.crypto.py3AES.html#AES.__mixColumn" /> - <keyword name="AES.__mixColumns" id="AES.__mixColumns" ref="eric7.Utilities.crypto.py3AES.html#AES.__mixColumns" /> - <keyword name="AES.__rotate" id="AES.__rotate" ref="eric7.Utilities.crypto.py3AES.html#AES.__rotate" /> - <keyword name="AES.__shiftRow" id="AES.__shiftRow" ref="eric7.Utilities.crypto.py3AES.html#AES.__shiftRow" /> - <keyword name="AES.__shiftRows" id="AES.__shiftRows" ref="eric7.Utilities.crypto.py3AES.html#AES.__shiftRows" /> - <keyword name="AES.__subBytes" id="AES.__subBytes" ref="eric7.Utilities.crypto.py3AES.html#AES.__subBytes" /> - <keyword name="AES.decrypt" id="AES.decrypt" ref="eric7.Utilities.crypto.py3AES.html#AES.decrypt" /> - <keyword name="AES.encrypt" id="AES.encrypt" ref="eric7.Utilities.crypto.py3AES.html#AES.encrypt" /> - <keyword name="AESModeOfOperation" id="AESModeOfOperation" ref="eric7.Utilities.crypto.py3AES.html#AESModeOfOperation" /> - <keyword name="AESModeOfOperation.__extractBytes" id="AESModeOfOperation.__extractBytes" ref="eric7.Utilities.crypto.py3AES.html#AESModeOfOperation.__extractBytes" /> - <keyword name="AESModeOfOperation.decrypt" id="AESModeOfOperation.decrypt" ref="eric7.Utilities.crypto.py3AES.html#AESModeOfOperation.decrypt" /> - <keyword name="AESModeOfOperation.encrypt" id="AESModeOfOperation.encrypt" ref="eric7.Utilities.crypto.py3AES.html#AESModeOfOperation.encrypt" /> + <keyword name="AES" id="AES" ref="eric7.EricUtilities.crypto.py3AES.html#AES" /> + <keyword name="AES.__addRoundKey" id="AES.__addRoundKey" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__addRoundKey" /> + <keyword name="AES.__aes_invMain" id="AES.__aes_invMain" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__aes_invMain" /> + <keyword name="AES.__aes_invRound" id="AES.__aes_invRound" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__aes_invRound" /> + <keyword name="AES.__aes_main" id="AES.__aes_main" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__aes_main" /> + <keyword name="AES.__aes_round" id="AES.__aes_round" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__aes_round" /> + <keyword name="AES.__core" id="AES.__core" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__core" /> + <keyword name="AES.__createRoundKey" id="AES.__createRoundKey" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__createRoundKey" /> + <keyword name="AES.__expandKey" id="AES.__expandKey" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__expandKey" /> + <keyword name="AES.__galois_multiplication" id="AES.__galois_multiplication" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__galois_multiplication" /> + <keyword name="AES.__getRconValue" id="AES.__getRconValue" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__getRconValue" /> + <keyword name="AES.__getSBoxInvert" id="AES.__getSBoxInvert" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__getSBoxInvert" /> + <keyword name="AES.__getSBoxValue" id="AES.__getSBoxValue" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__getSBoxValue" /> + <keyword name="AES.__mixColumn" id="AES.__mixColumn" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__mixColumn" /> + <keyword name="AES.__mixColumns" id="AES.__mixColumns" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__mixColumns" /> + <keyword name="AES.__rotate" id="AES.__rotate" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__rotate" /> + <keyword name="AES.__shiftRow" id="AES.__shiftRow" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__shiftRow" /> + <keyword name="AES.__shiftRows" id="AES.__shiftRows" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__shiftRows" /> + <keyword name="AES.__subBytes" id="AES.__subBytes" ref="eric7.EricUtilities.crypto.py3AES.html#AES.__subBytes" /> + <keyword name="AES.decrypt" id="AES.decrypt" ref="eric7.EricUtilities.crypto.py3AES.html#AES.decrypt" /> + <keyword name="AES.encrypt" id="AES.encrypt" ref="eric7.EricUtilities.crypto.py3AES.html#AES.encrypt" /> + <keyword name="AESModeOfOperation" id="AESModeOfOperation" ref="eric7.EricUtilities.crypto.py3AES.html#AESModeOfOperation" /> + <keyword name="AESModeOfOperation.__extractBytes" id="AESModeOfOperation.__extractBytes" ref="eric7.EricUtilities.crypto.py3AES.html#AESModeOfOperation.__extractBytes" /> + <keyword name="AESModeOfOperation.decrypt" id="AESModeOfOperation.decrypt" ref="eric7.EricUtilities.crypto.py3AES.html#AESModeOfOperation.decrypt" /> + <keyword name="AESModeOfOperation.encrypt" id="AESModeOfOperation.encrypt" ref="eric7.EricUtilities.crypto.py3AES.html#AESModeOfOperation.encrypt" /> <keyword name="APIGenerator" id="APIGenerator" ref="eric7.DocumentationTools.APIGenerator.html#APIGenerator" /> <keyword name="APIGenerator (Constructor)" id="APIGenerator (Constructor)" ref="eric7.DocumentationTools.APIGenerator.html#APIGenerator.__init__" /> <keyword name="APIGenerator (Module)" id="APIGenerator (Module)" ref="eric7.DocumentationTools.APIGenerator.html" /> @@ -5999,6 +6000,8 @@ <keyword name="EricPlugin.pytest_sessionfinish" id="EricPlugin.pytest_sessionfinish" ref="eric7.Testing.Interfaces.PytestRunner.html#EricPlugin.pytest_sessionfinish" /> <keyword name="EricPlugin.pytest_sessionstart" id="EricPlugin.pytest_sessionstart" ref="eric7.Testing.Interfaces.PytestRunner.html#EricPlugin.pytest_sessionstart" /> <keyword name="EricPluginWizard (Package)" id="EricPluginWizard (Package)" ref="index-eric7.Plugins.WizardPlugins.EricPluginWizard.html" /> + <keyword name="EricPreferences" id="EricPreferences" ref="eric7.EricCore.EricPreferences.html#EricPreferences" /> + <keyword name="EricPreferences (Module)" id="EricPreferences (Module)" ref="eric7.EricCore.EricPreferences.html" /> <keyword name="EricProcess" id="EricProcess" ref="eric7.EricCore.EricProcess.html#EricProcess" /> <keyword name="EricProcess (Constructor)" id="EricProcess (Constructor)" ref="eric7.EricCore.EricProcess.html#EricProcess.__init__" /> <keyword name="EricProcess (Module)" id="EricProcess (Module)" ref="eric7.EricCore.EricProcess.html" /> @@ -12265,8 +12268,6 @@ <keyword name="NetworkPage" id="NetworkPage" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage" /> <keyword name="NetworkPage (Constructor)" id="NetworkPage (Constructor)" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage.__init__" /> <keyword name="NetworkPage (Module)" id="NetworkPage (Module)" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html" /> - <keyword name="NetworkPage.on_clearProxyPasswordsButton_clicked" id="NetworkPage.on_clearProxyPasswordsButton_clicked" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage.on_clearProxyPasswordsButton_clicked" /> - <keyword name="NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged" id="NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged" /> <keyword name="NetworkPage.save" id="NetworkPage.save" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage.save" /> <keyword name="NetworkPage.setMode" id="NetworkPage.setMode" ref="eric7.Preferences.ConfigurationPages.NetworkPage.html#NetworkPage.setMode" /> <keyword name="NetworkProxyPage" id="NetworkProxyPage" ref="eric7.Preferences.ConfigurationPages.NetworkProxyPage.html#NetworkProxyPage" /> @@ -20070,7 +20071,7 @@ <keyword name="_Unparser.write_key_value_pair" id="_Unparser.write_key_value_pair" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse.html#_Unparser.write_key_value_pair" /> <keyword name="__checkCodeStyle" id="__checkCodeStyle" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html#__checkCodeStyle" /> <keyword name="__checkSyntax" id="__checkSyntax" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html#__checkSyntax" /> - <keyword name="__getMainPassword" id="__getMainPassword" ref="eric7.Utilities.crypto.__init__.html#__getMainPassword" /> + <keyword name="__getMainPassword" id="__getMainPassword" ref="eric7.EricUtilities.crypto.__init__.html#__getMainPassword" /> <keyword name="__getPygmentsLexer" id="__getPygmentsLexer" ref="eric7.QScintilla.Lexers.__init__.html#__getPygmentsLexer" /> <keyword name="__initChannelModesDict" id="__initChannelModesDict" ref="eric7.Network.IRC.IrcUtilities.html#__initChannelModesDict" /> <keyword name="__init__" id="__init__" ref="eric7.Plugins.WizardPlugins.EricPluginWizard.Templates.html#__init__" /> @@ -20154,7 +20155,7 @@ <keyword name="amendConfig" id="amendConfig" ref="eric7.Plugins.VcsPlugins.vcsSubversion.SvnUtilities.html#amendConfig" /> <keyword name="analyze" id="analyze" ref="eric7.DataViews.CodeMetrics.html#analyze" /> <keyword name="appStartup" id="appStartup" ref="eric7.Toolbox.Startup.html#appStartup" /> - <keyword name="append_PKCS7_padding" id="append_PKCS7_padding" ref="eric7.Utilities.crypto.py3AES.html#append_PKCS7_padding" /> + <keyword name="append_PKCS7_padding" id="append_PKCS7_padding" ref="eric7.EricUtilities.crypto.py3AES.html#append_PKCS7_padding" /> <keyword name="assert (Module)" id="assert (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.assert.html" /> <keyword name="ast_unparse (Module)" id="ast_unparse (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse.html" /> <keyword name="awsHardcodedPassword (Module)" id="awsHardcodedPassword (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.awsHardcodedPassword.html" /> @@ -20170,7 +20171,7 @@ <keyword name="case_insensitive_set_diff" id="case_insensitive_set_diff" ref="eric7.PipInterface.piplicenses.html#case_insensitive_set_diff" /> <keyword name="case_insensitive_set_intersect" id="case_insensitive_set_intersect" ref="eric7.PipInterface.piplicenses.html#case_insensitive_set_intersect" /> <keyword name="certificateValidation (Module)" id="certificateValidation (Module)" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.certificateValidation.html" /> - <keyword name="changeRememberedMain" id="changeRememberedMain" ref="eric7.Utilities.crypto.__init__.html#changeRememberedMain" /> + <keyword name="changeRememberedMain" id="changeRememberedMain" ref="eric7.EricUtilities.crypto.__init__.html#changeRememberedMain" /> <keyword name="checkAssertUsed" id="checkAssertUsed" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.assert.html#checkAssertUsed" /> <keyword name="checkBindAllInterfaces" id="checkBindAllInterfaces" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.generalBindAllInterfaces.html#checkBindAllInterfaces" /> <keyword name="checkContextlibSuppress" id="checkContextlibSuppress" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.tryExcept.html#checkContextlibSuppress" /> @@ -20240,6 +20241,7 @@ <keyword name="containsSpace" id="containsSpace" ref="eric7.WebBrowser.Tools.WebBrowserTools.html#containsSpace" /> <keyword name="continued_indentation" id="continued_indentation" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#continued_indentation" /> <keyword name="convertLineEnds" id="convertLineEnds" ref="eric7.Utilities.__init__.html#convertLineEnds" /> + <keyword name="convertPasswords" id="convertPasswords" ref="eric7.EricCore.EricPreferences.html#convertPasswords" /> <keyword name="convertPasswords" id="convertPasswords" ref="eric7.Preferences.__init__.html#convertPasswords" /> <keyword name="convert_from_hex_to_uf2" id="convert_from_hex_to_uf2" ref="eric7.MicroPython.Tools.uf2conv.html#convert_from_hex_to_uf2" /> <keyword name="convert_from_uf2" id="convert_from_uf2" ref="eric7.MicroPython.Tools.uf2conv.html#convert_from_uf2" /> @@ -20466,23 +20468,23 @@ <keyword name="create_parser" id="create_parser" ref="eric7.PipInterface.piplicenses.html#create_parser" /> <keyword name="create_summary_list" id="create_summary_list" ref="eric7.PipInterface.piplicenses.html#create_summary_list" /> <keyword name="critical" id="critical" ref="eric7.EricWidgets.EricMessageBox.html#critical" /> - <keyword name="crypto (Package)" id="crypto (Package)" ref="index-eric7.Utilities.crypto.html" /> + <keyword name="crypto (Package)" id="crypto (Package)" ref="index-eric7.EricUtilities.crypto.html" /> <keyword name="cursors (Package)" id="cursors (Package)" ref="index-eric7.IconEditor.cursors.html" /> <keyword name="data (Package)" id="data (Package)" ref="index-eric7.EricNetwork.data.html" /> <keyword name="data (Package)" id="data (Package)" ref="index-eric7.UI.data.html" /> <keyword name="data (Package)" id="data (Package)" ref="index-eric7.WebBrowser.data.html" /> - <keyword name="dataDecrypt" id="dataDecrypt" ref="eric7.Utilities.crypto.__init__.html#dataDecrypt" /> - <keyword name="dataEncrypt" id="dataEncrypt" ref="eric7.Utilities.crypto.__init__.html#dataEncrypt" /> + <keyword name="dataDecrypt" id="dataDecrypt" ref="eric7.EricUtilities.crypto.__init__.html#dataDecrypt" /> + <keyword name="dataEncrypt" id="dataEncrypt" ref="eric7.EricUtilities.crypto.__init__.html#dataEncrypt" /> <keyword name="dataString" id="dataString" ref="eric7.EricUtilities.__init__.html#dataString" /> <keyword name="dataString" id="dataString" ref="eric7.WebBrowser.Download.DownloadUtilities.html#dataString" /> <keyword name="dateFromTime_t" id="dateFromTime_t" ref="eric7.Plugins.VcsPlugins.vcsPySvn.SvnUtilities.html#dateFromTime_t" /> <keyword name="deactivate" id="deactivate" ref="eric7.Plugins.WizardPlugins.EricPluginWizard.Templates.html#deactivate" /> <keyword name="decode" id="decode" ref="eric7.Utilities.__init__.html#decode" /> - <keyword name="decodeBytes" id="decodeBytes" ref="eric7.Utilities.__init__.html#decodeBytes" /> - <keyword name="decodeString" id="decodeString" ref="eric7.Utilities.__init__.html#decodeString" /> + <keyword name="decodeBytes" id="decodeBytes" ref="eric7.EricUtilities.__init__.html#decodeBytes" /> + <keyword name="decodeString" id="decodeString" ref="eric7.EricUtilities.__init__.html#decodeString" /> <keyword name="decodeWithEncoding" id="decodeWithEncoding" ref="eric7.Utilities.__init__.html#decodeWithEncoding" /> <keyword name="decoratedName" id="decoratedName" ref="eric7.MicroPython.MicroPythonFileSystemUtilities.html#decoratedName" /> - <keyword name="decryptData" id="decryptData" ref="eric7.Utilities.crypto.py3AES.html#decryptData" /> + <keyword name="decryptData" id="decryptData" ref="eric7.EricUtilities.crypto.py3AES.html#decryptData" /> <keyword name="deepgetattr" id="deepgetattr" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityUtils.html#deepgetattr" /> <keyword name="desktopName" id="desktopName" ref="eric7.SystemUtilities.DesktopUtilities.html#desktopName" /> <keyword name="determineSourceType" id="determineSourceType" ref="eric7.Utilities.ClassBrowsers.__init__.html#determineSourceType" /> @@ -20499,7 +20501,7 @@ <keyword name="drawRect" id="drawRect" ref="eric7.Snapshot.SnapshotRegionGrabber.html#drawRect" /> <keyword name="editMessageFilters" id="editMessageFilters" ref="eric7.EricWidgets.EricErrorMessage.html#editMessageFilters" /> <keyword name="encode" id="encode" ref="eric7.Utilities.__init__.html#encode" /> - <keyword name="encryptData" id="encryptData" ref="eric7.Utilities.crypto.py3AES.html#encryptData" /> + <keyword name="encryptData" id="encryptData" ref="eric7.EricUtilities.crypto.py3AES.html#encryptData" /> <keyword name="engineDisplayName" id="engineDisplayName" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.__init__.html#engineDisplayName" /> <keyword name="ensureUniqueFilename" id="ensureUniqueFilename" ref="eric7.WebBrowser.Tools.WebBrowserTools.html#ensureUniqueFilename" /> <keyword name="ensure_latest_bundle" id="ensure_latest_bundle" ref="eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions.html#ensure_latest_bundle" /> @@ -20539,8 +20541,8 @@ <keyword name="eric7config (Module)" id="eric7config (Module)" ref="eric7.eric7config.html" /> <keyword name="eric7dbgstub (Module)" id="eric7dbgstub (Module)" ref="eric7.DebugClients.Python.eric7dbgstub.html" /> <keyword name="error" id="error" ref="eric7.MicroPython.Tools.uf2conv.html#error" /> - <keyword name="escape_entities" id="escape_entities" ref="eric7.Utilities.__init__.html#escape_entities" /> - <keyword name="escape_uentities" id="escape_uentities" ref="eric7.Utilities.__init__.html#escape_uentities" /> + <keyword name="escape_entities" id="escape_entities" ref="eric7.EricUtilities.__init__.html#escape_entities" /> + <keyword name="escape_uentities" id="escape_uentities" ref="eric7.EricUtilities.__init__.html#escape_uentities" /> <keyword name="escapedBytesRepresentation" id="escapedBytesRepresentation" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityUtils.html#escapedBytesRepresentation" /> <keyword name="evaluateCall" id="evaluateCall" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.djangoXssVulnerability.html#evaluateCall" /> <keyword name="evaluateVar" id="evaluateVar" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.djangoXssVulnerability.html#evaluateVar" /> @@ -20645,7 +20647,7 @@ <keyword name="getConfigData" id="getConfigData" ref="eric7.Plugins.PluginVcsPySvn.html#getConfigData" /> <keyword name="getConfigData" id="getConfigData" ref="eric7.Plugins.PluginVcsSubversion.html#getConfigData" /> <keyword name="getConfigData" id="getConfigData" ref="eric7.Plugins.WizardPlugins.EricPluginWizard.Templates.html#getConfigData" /> - <keyword name="getConfigDir" id="getConfigDir" ref="eric7.Globals.__init__.html#getConfigDir" /> + <keyword name="getConfigDir" id="getConfigDir" ref="eric7.EricUtilities.__init__.html#getConfigDir" /> <keyword name="getConfigPath" id="getConfigPath" ref="eric7.Plugins.VcsPlugins.vcsGit.GitUtilities.html#getConfigPath" /> <keyword name="getConfigPath" id="getConfigPath" ref="eric7.Plugins.VcsPlugins.vcsMercurial.HgUtilities.html#getConfigPath" /> <keyword name="getConfigPath" id="getConfigPath" ref="eric7.Plugins.VcsPlugins.vcsPySvn.SvnUtilities.html#getConfigPath" /> @@ -20726,6 +20728,7 @@ <keyword name="getMicroPython" id="getMicroPython" ref="eric7.Preferences.__init__.html#getMicroPython" /> <keyword name="getModuleQualnameFromPath" id="getModuleQualnameFromPath" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.SecurityUtils.html#getModuleQualnameFromPath" /> <keyword name="getMultiProject" id="getMultiProject" ref="eric7.Preferences.__init__.html#getMultiProject" /> + <keyword name="getNetworkProxy" id="getNetworkProxy" ref="eric7.EricCore.EricPreferences.html#getNetworkProxy" /> <keyword name="getOpenFilPathsAndFilter" id="getOpenFilPathsAndFilter" ref="eric7.EricWidgets.EricFileDialog.html#getOpenFilPathsAndFilter" /> <keyword name="getOpenFileAndDirNames" id="getOpenFileAndDirNames" ref="eric7.EricWidgets.EricFileDialog.html#getOpenFileAndDirNames" /> <keyword name="getOpenFileAndDirPaths" id="getOpenFileAndDirPaths" ref="eric7.EricWidgets.EricFileDialog.html#getOpenFileAndDirPaths" /> @@ -20848,14 +20851,14 @@ <keyword name="hasQtLinguist" id="hasQtLinguist" ref="eric7.SystemUtilities.QtUtilities.html#hasQtLinguist" /> <keyword name="hasShell" id="hasShell" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.injectionShell.html#hasShell" /> <keyword name="has_info" id="has_info" ref="eric7.MicroPython.Tools.uf2conv.html#has_info" /> - <keyword name="hashPassword" id="hashPassword" ref="eric7.Utilities.crypto.py3PBKDF2.html#hashPassword" /> - <keyword name="hashPasswordTuple" id="hashPasswordTuple" ref="eric7.Utilities.crypto.py3PBKDF2.html#hashPasswordTuple" /> + <keyword name="hashPassword" id="hashPassword" ref="eric7.EricUtilities.crypto.py3PBKDF2.html#hashPassword" /> + <keyword name="hashPasswordTuple" id="hashPasswordTuple" ref="eric7.EricUtilities.crypto.py3PBKDF2.html#hashPasswordTuple" /> <keyword name="hg (Module)" id="hg (Module)" ref="eric7.Plugins.VcsPlugins.vcsMercurial.hg.html" /> <keyword name="hgVersion" id="hgVersion" ref="eric7.Plugins.VcsPlugins.vcsMercurial.HgUtilities.html#hgVersion" /> <keyword name="histedit (Module)" id="histedit (Module)" ref="eric7.Plugins.VcsPlugins.vcsMercurial.HisteditExtension.histedit.html" /> - <keyword name="html_encode" id="html_encode" ref="eric7.Utilities.__init__.html#html_encode" /> - <keyword name="html_udecode" id="html_udecode" ref="eric7.Utilities.__init__.html#html_udecode" /> - <keyword name="html_uencode" id="html_uencode" ref="eric7.Utilities.__init__.html#html_uencode" /> + <keyword name="html_encode" id="html_encode" ref="eric7.EricUtilities.__init__.html#html_encode" /> + <keyword name="html_udecode" id="html_udecode" ref="eric7.EricUtilities.__init__.html#html_udecode" /> + <keyword name="html_uencode" id="html_uencode" ref="eric7.EricUtilities.__init__.html#html_uencode" /> <keyword name="ignoreCode" id="ignoreCode" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleChecker.html#ignoreCode" /> <keyword name="importPreferences" id="importPreferences" ref="eric7.Preferences.__init__.html#importPreferences" /> <keyword name="importShortcuts" id="importShortcuts" ref="eric7.Preferences.Shortcuts.html#importShortcuts" /> @@ -20869,6 +20872,7 @@ <keyword name="initBatchService" id="initBatchService" ref="eric7.Plugins.CheckerPlugins.SyntaxChecker.tomlCheckSyntax.html#initBatchService" /> <keyword name="initBatchService" id="initBatchService" ref="eric7.Plugins.CheckerPlugins.SyntaxChecker.yamlCheckSyntax.html#initBatchService" /> <keyword name="initDebugger" id="initDebugger" ref="eric7.DebugClients.Python.eric7dbgstub.html#initDebugger" /> + <keyword name="initPreferences" id="initPreferences" ref="eric7.EricCore.EricPreferences.html#initPreferences" /> <keyword name="initPreferences" id="initPreferences" ref="eric7.Preferences.__init__.html#initPreferences" /> <keyword name="initRecentSettings" id="initRecentSettings" ref="eric7.Preferences.__init__.html#initRecentSettings" /> <keyword name="initSSL" id="initSSL" ref="eric7.EricNetwork.EricSslUtilities.html#initSSL" /> @@ -21037,7 +21041,7 @@ <keyword name="patchQProcess" id="patchQProcess" ref="eric7.DebugClients.Python.QProcessExtension.html#patchQProcess" /> <keyword name="patchSubprocess" id="patchSubprocess" ref="eric7.DebugClients.Python.SubprocessExtension.html#patchSubprocess" /> <keyword name="patch_circup" id="patch_circup" ref="eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions.html#patch_circup" /> - <keyword name="pbkdf2" id="pbkdf2" ref="eric7.Utilities.crypto.py3PBKDF2.html#pbkdf2" /> + <keyword name="pbkdf2" id="pbkdf2" ref="eric7.EricUtilities.crypto.py3PBKDF2.html#pbkdf2" /> <keyword name="piplicenses (Module)" id="piplicenses (Module)" ref="eric7.PipInterface.piplicenses.html" /> <keyword name="pixmapFileToDataUrl" id="pixmapFileToDataUrl" ref="eric7.WebBrowser.Tools.WebBrowserTools.html#pixmapFileToDataUrl" /> <keyword name="pixmapFromByteArray" id="pixmapFromByteArray" ref="eric7.WebBrowser.Tools.WebBrowserTools.html#pixmapFromByteArray" /> @@ -21066,15 +21070,15 @@ <keyword name="proxyAuthenticationRequired" id="proxyAuthenticationRequired" ref="eric7.EricNetwork.EricNetworkProxyFactory.html#proxyAuthenticationRequired" /> <keyword name="purge (Module)" id="purge (Module)" ref="eric7.Plugins.VcsPlugins.vcsMercurial.PurgeExtension.purge.html" /> <keyword name="pushView" id="pushView" ref="eric7.WebBrowser.WebInspector.html#pushView" /> - <keyword name="pwConvert" id="pwConvert" ref="eric7.Utilities.crypto.__init__.html#pwConvert" /> - <keyword name="pwDecode" id="pwDecode" ref="eric7.Utilities.crypto.__init__.html#pwDecode" /> - <keyword name="pwDecrypt" id="pwDecrypt" ref="eric7.Utilities.crypto.__init__.html#pwDecrypt" /> - <keyword name="pwEncode" id="pwEncode" ref="eric7.Utilities.crypto.__init__.html#pwEncode" /> - <keyword name="pwEncrypt" id="pwEncrypt" ref="eric7.Utilities.crypto.__init__.html#pwEncrypt" /> - <keyword name="pwRecode" id="pwRecode" ref="eric7.Utilities.crypto.__init__.html#pwRecode" /> - <keyword name="pwReencrypt" id="pwReencrypt" ref="eric7.Utilities.crypto.__init__.html#pwReencrypt" /> - <keyword name="py3AES (Module)" id="py3AES (Module)" ref="eric7.Utilities.crypto.py3AES.html" /> - <keyword name="py3PBKDF2 (Module)" id="py3PBKDF2 (Module)" ref="eric7.Utilities.crypto.py3PBKDF2.html" /> + <keyword name="pwConvert" id="pwConvert" ref="eric7.EricUtilities.crypto.__init__.html#pwConvert" /> + <keyword name="pwDecode" id="pwDecode" ref="eric7.EricUtilities.crypto.__init__.html#pwDecode" /> + <keyword name="pwDecrypt" id="pwDecrypt" ref="eric7.EricUtilities.crypto.__init__.html#pwDecrypt" /> + <keyword name="pwEncode" id="pwEncode" ref="eric7.EricUtilities.crypto.__init__.html#pwEncode" /> + <keyword name="pwEncrypt" id="pwEncrypt" ref="eric7.EricUtilities.crypto.__init__.html#pwEncrypt" /> + <keyword name="pwRecode" id="pwRecode" ref="eric7.EricUtilities.crypto.__init__.html#pwRecode" /> + <keyword name="pwReencrypt" id="pwReencrypt" ref="eric7.EricUtilities.crypto.__init__.html#pwReencrypt" /> + <keyword name="py3AES (Module)" id="py3AES (Module)" ref="eric7.EricUtilities.crypto.py3AES.html" /> + <keyword name="py3PBKDF2 (Module)" id="py3PBKDF2 (Module)" ref="eric7.EricUtilities.crypto.py3PBKDF2.html" /> <keyword name="pyCheckSyntax (Module)" id="pyCheckSyntax (Module)" ref="eric7.Plugins.CheckerPlugins.SyntaxChecker.pyCheckSyntax.html" /> <keyword name="pySyntaxAndPyflakesBatchCheck" id="pySyntaxAndPyflakesBatchCheck" ref="eric7.Plugins.CheckerPlugins.SyntaxChecker.pyCheckSyntax.html#pySyntaxAndPyflakesBatchCheck" /> <keyword name="pySyntaxAndPyflakesCheck" id="pySyntaxAndPyflakesCheck" ref="eric7.Plugins.CheckerPlugins.SyntaxChecker.pyCheckSyntax.html#pySyntaxAndPyflakesCheck" /> @@ -21093,7 +21097,7 @@ <keyword name="readEncodedFileWithHash" id="readEncodedFileWithHash" ref="eric7.Utilities.__init__.html#readEncodedFileWithHash" /> <keyword name="readModule" id="readModule" ref="eric7.Utilities.ModuleParser.html#readModule" /> <keyword name="readShortcuts" id="readShortcuts" ref="eric7.Preferences.Shortcuts.html#readShortcuts" /> - <keyword name="readStringFromStream" id="readStringFromStream" ref="eric7.Utilities.__init__.html#readStringFromStream" /> + <keyword name="readStringFromStream" id="readStringFromStream" ref="eric7.EricUtilities.__init__.html#readStringFromStream" /> <keyword name="readToolGroups" id="readToolGroups" ref="eric7.Preferences.__init__.html#readToolGroups" /> <keyword name="read_config" id="read_config" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#read_config" /> <keyword name="readlines" id="readlines" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#readlines" /> @@ -21107,7 +21111,7 @@ <keyword name="registerPlugin" id="registerPlugin" ref="eric7.PluginManager.PluginRepositoryDialog.html#registerPlugin" /> <keyword name="registerView" id="registerView" ref="eric7.WebBrowser.WebInspector.html#registerView" /> <keyword name="register_check" id="register_check" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#register_check" /> - <keyword name="rehashPassword" id="rehashPassword" ref="eric7.Utilities.crypto.py3PBKDF2.html#rehashPassword" /> + <keyword name="rehashPassword" id="rehashPassword" ref="eric7.EricUtilities.crypto.py3PBKDF2.html#rehashPassword" /> <keyword name="relativeUniversalPath" id="relativeUniversalPath" ref="eric7.SystemUtilities.FileSystemUtilities.html#relativeUniversalPath" /> <keyword name="remoteFileName" id="remoteFileName" ref="eric7.SystemUtilities.FileSystemUtilities.html#remoteFileName" /> <keyword name="removeMarkers" id="removeMarkers" ref="eric7.UI.CompareDialog.html#removeMarkers" /> @@ -21146,7 +21150,7 @@ <keyword name="sessionType" id="sessionType" ref="eric7.SystemUtilities.DesktopUtilities.html#sessionType" /> <keyword name="setActions" id="setActions" ref="eric7.Preferences.Shortcuts.html#setActions" /> <keyword name="setConda" id="setConda" ref="eric7.Preferences.__init__.html#setConda" /> - <keyword name="setConfigDir" id="setConfigDir" ref="eric7.Globals.__init__.html#setConfigDir" /> + <keyword name="setConfigDir" id="setConfigDir" ref="eric7.EricUtilities.__init__.html#setConfigDir" /> <keyword name="setConfigured" id="setConfigured" ref="eric7.Preferences.__init__.html#setConfigured" /> <keyword name="setCooperation" id="setCooperation" ref="eric7.Preferences.__init__.html#setCooperation" /> <keyword name="setCss" id="setCss" ref="eric7.WebBrowser.Tools.Scripts.html#setCss" /> @@ -21175,6 +21179,7 @@ <keyword name="setLibraryPaths" id="setLibraryPaths" ref="eric7.Toolbox.Startup.html#setLibraryPaths" /> <keyword name="setMicroPython" id="setMicroPython" ref="eric7.Preferences.__init__.html#setMicroPython" /> <keyword name="setMultiProject" id="setMultiProject" ref="eric7.Preferences.__init__.html#setMultiProject" /> + <keyword name="setNetworkProxy" id="setNetworkProxy" ref="eric7.EricCore.EricPreferences.html#setNetworkProxy" /> <keyword name="setPdfViewer" id="setPdfViewer" ref="eric7.Preferences.__init__.html#setPdfViewer" /> <keyword name="setPip" id="setPip" ref="eric7.Preferences.__init__.html#setPip" /> <keyword name="setPluginManager" id="setPluginManager" ref="eric7.Preferences.__init__.html#setPluginManager" /> @@ -21229,12 +21234,13 @@ <keyword name="strToQByteArray" id="strToQByteArray" ref="eric7.EricUtilities.__init__.html#strToQByteArray" /> <keyword name="stringToArgumentsWindows" id="stringToArgumentsWindows" ref="eric7.DebugClients.Python.DebugUtilities.html#stringToArgumentsWindows" /> <keyword name="strip (Module)" id="strip (Module)" ref="eric7.Plugins.VcsPlugins.vcsMercurial.StripExtension.strip.html" /> - <keyword name="strip_PKCS7_padding" id="strip_PKCS7_padding" ref="eric7.Utilities.crypto.py3AES.html#strip_PKCS7_padding" /> + <keyword name="strip_PKCS7_padding" id="strip_PKCS7_padding" ref="eric7.EricUtilities.crypto.py3AES.html#strip_PKCS7_padding" /> <keyword name="subversion (Module)" id="subversion (Module)" ref="eric7.Plugins.VcsPlugins.vcsPySvn.subversion.html" /> <keyword name="subversion (Module)" id="subversion (Module)" ref="eric7.Plugins.VcsPlugins.vcsSubversion.subversion.html" /> <keyword name="summarize" id="summarize" ref="eric7.DataViews.CodeMetrics.html#summarize" /> <keyword name="supportedEngineNames" id="supportedEngineNames" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.__init__.html#supportedEngineNames" /> <keyword name="supportedLanguages" id="supportedLanguages" ref="eric7.Testing.__init__.html#supportedLanguages" /> + <keyword name="syncPreferences" id="syncPreferences" ref="eric7.EricCore.EricPreferences.html#syncPreferences" /> <keyword name="syncPreferences" id="syncPreferences" ref="eric7.Preferences.__init__.html#syncPreferences" /> <keyword name="tabs_obsolete" id="tabs_obsolete" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#tabs_obsolete" /> <keyword name="tabs_or_spaces" id="tabs_or_spaces" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html#tabs_or_spaces" /> @@ -21273,7 +21279,7 @@ <keyword name="uf2conv (Module)" id="uf2conv (Module)" ref="eric7.MicroPython.Tools.uf2conv.html" /> <keyword name="uiStartUp" id="uiStartUp" ref="eric7.eric7_ide.html#uiStartUp" /> <keyword name="uic (Module)" id="uic (Module)" ref="eric7.Utilities.uic.html" /> - <keyword name="unescape_uentities" id="unescape_uentities" ref="eric7.Utilities.__init__.html#unescape_uentities" /> + <keyword name="unescape_uentities" id="unescape_uentities" ref="eric7.EricUtilities.__init__.html#unescape_uentities" /> <keyword name="unparse" id="unparse" ref="eric7.Plugins.CheckerPlugins.CodeStyleChecker.ast_unparse.html#unparse" /> <keyword name="unregisterClassBrowser" id="unregisterClassBrowser" ref="eric7.Utilities.ClassBrowsers.__init__.html#unregisterClassBrowser" /> <keyword name="unregisterLexer" id="unregisterLexer" ref="eric7.QScintilla.Lexers.__init__.html#unregisterLexer" /> @@ -21290,7 +21296,7 @@ <keyword name="vcsMercurial (Package)" id="vcsMercurial (Package)" ref="index-eric7.Plugins.VcsPlugins.vcsMercurial.html" /> <keyword name="vcsPySvn (Package)" id="vcsPySvn (Package)" ref="index-eric7.Plugins.VcsPlugins.vcsPySvn.html" /> <keyword name="vcsSubversion (Package)" id="vcsSubversion (Package)" ref="index-eric7.Plugins.VcsPlugins.vcsSubversion.html" /> - <keyword name="verifyPassword" id="verifyPassword" ref="eric7.Utilities.crypto.py3PBKDF2.html#verifyPassword" /> + <keyword name="verifyPassword" id="verifyPassword" ref="eric7.EricUtilities.crypto.py3PBKDF2.html#verifyPassword" /> <keyword name="versionIsValid" id="versionIsValid" ref="eric7.EricUtilities.__init__.html#versionIsValid" /> <keyword name="versionToTuple" id="versionToTuple" ref="eric7.EricUtilities.__init__.html#versionToTuple" /> <keyword name="warning" id="warning" ref="eric7.EricWidgets.EricMessageBox.html#warning" /> @@ -21400,6 +21406,7 @@ <file>eric7.DocumentationTools.QtHelpGenerator.html</file> <file>eric7.DocumentationTools.TemplatesListsStyleCSS.html</file> <file>eric7.EricCore.EricFileSystemWatcher.html</file> + <file>eric7.EricCore.EricPreferences.html</file> <file>eric7.EricCore.EricProcess.html</file> <file>eric7.EricCore.EricStdRedirector.html</file> <file>eric7.EricCore.EricTreeSortFilterProxyModel.html</file> @@ -21434,6 +21441,9 @@ <file>eric7.EricUtilities.EricCache.html</file> <file>eric7.EricUtilities.EricMutexLocker.html</file> <file>eric7.EricUtilities.__init__.html</file> + <file>eric7.EricUtilities.crypto.__init__.html</file> + <file>eric7.EricUtilities.crypto.py3AES.html</file> + <file>eric7.EricUtilities.crypto.py3PBKDF2.html</file> <file>eric7.EricWidgets.EricAnimatedLabel.html</file> <file>eric7.EricWidgets.EricAnimatedWidget.html</file> <file>eric7.EricWidgets.EricApplication.html</file> @@ -22348,9 +22358,6 @@ <file>eric7.Utilities.MouseUtilities.html</file> <file>eric7.Utilities.PasswordChecker.html</file> <file>eric7.Utilities.__init__.html</file> - <file>eric7.Utilities.crypto.__init__.html</file> - <file>eric7.Utilities.crypto.py3AES.html</file> - <file>eric7.Utilities.crypto.py3PBKDF2.html</file> <file>eric7.Utilities.uic.html</file> <file>eric7.VCS.CommandOptionsDialog.html</file> <file>eric7.VCS.ProjectBrowserHelper.html</file> @@ -22606,6 +22613,7 @@ <file>index-eric7.EricGui.html</file> <file>index-eric7.EricNetwork.data.html</file> <file>index-eric7.EricNetwork.html</file> + <file>index-eric7.EricUtilities.crypto.html</file> <file>index-eric7.EricUtilities.html</file> <file>index-eric7.EricWidgets.html</file> <file>index-eric7.EricXML.html</file> @@ -22715,7 +22723,6 @@ <file>index-eric7.UI.data.html</file> <file>index-eric7.UI.html</file> <file>index-eric7.Utilities.ClassBrowsers.html</file> - <file>index-eric7.Utilities.crypto.html</file> <file>index-eric7.Utilities.html</file> <file>index-eric7.VCS.html</file> <file>index-eric7.ViewManager.html</file>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.EricCore.EricPreferences.html Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,180 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricCore.EricPreferences</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.EricCore.EricPreferences</h1> +<p> +Module implementing the preferences for the eric library. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>_settingsNameGlobal</td></tr> +<tr><td>_settingsNameOrganization</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#EricPreferences">EricPreferences</a></td> +<td>A class to hold all configuration items.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#convertPasswords">convertPasswords</a></td> +<td>Module function to convert all passwords.</td> +</tr> +<tr> +<td><a href="#getNetworkProxy">getNetworkProxy</a></td> +<td>Function to retrieve the various Network Proxy related settings.</td> +</tr> +<tr> +<td><a href="#initPreferences">initPreferences</a></td> +<td>Function to initialize the central configuration store.</td> +</tr> +<tr> +<td><a href="#setNetworkProxy">setNetworkProxy</a></td> +<td>Function to store the various Network Proxy settings.</td> +</tr> +<tr> +<td><a href="#syncPreferences">syncPreferences</a></td> +<td>Module function to sync the preferences to disk.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="EricPreferences" ID="EricPreferences"></a> +<h2>EricPreferences</h2> +<p> + A class to hold all configuration items. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>proxyDefaults</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="convertPasswords" ID="convertPasswords"></a> +<h2>convertPasswords</h2> +<b>convertPasswords</b>(<i>oldPassword, newPassword</i>) +<p> + Module function to convert all passwords. +</p> + +<dl> + +<dt><i>oldPassword</i> (str)</dt> +<dd> +current password +</dd> +<dt><i>newPassword</i> (str)</dt> +<dd> +new password +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="getNetworkProxy" ID="getNetworkProxy"></a> +<h2>getNetworkProxy</h2> +<b>getNetworkProxy</b>(<i>key</i>) +<p> + Function to retrieve the various Network Proxy related settings. +</p> + +<dl> + +<dt><i>key</i> (str)</dt> +<dd> +the key of the value to get +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the requested network proxy setting +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +Any +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="initPreferences" ID="initPreferences"></a> +<h2>initPreferences</h2> +<b>initPreferences</b>(<i></i>) +<p> + Function to initialize the central configuration store. +</p> + +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="setNetworkProxy" ID="setNetworkProxy"></a> +<h2>setNetworkProxy</h2> +<b>setNetworkProxy</b>(<i>key, value</i>) +<p> + Function to store the various Network Proxy settings. +</p> + +<dl> + +<dt><i>key</i> (str)</dt> +<dd> +the key of the setting to be set +</dd> +<dt><i>value</i> (Any)</dt> +<dd> +the value to be set +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="syncPreferences" ID="syncPreferences"></a> +<h2>syncPreferences</h2> +<b>syncPreferences</b>(<i></i>) +<p> + Module function to sync the preferences to disk. +</p> +<p> + In addition to syncing, the central configuration store is reinitialized + as well. +</p> + +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.EricNetwork.EricJsonServer.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricNetwork.EricJsonServer.html Thu Sep 26 15:49:36 2024 +0200 @@ -101,24 +101,29 @@ <a NAME="EricJsonServer.__init__" ID="EricJsonServer.__init__"></a> <h4>EricJsonServer (Constructor)</h4> -<b>EricJsonServer</b>(<i>name="", multiplex=False, parent=None</i>) +<b>EricJsonServer</b>(<i>name="", interface="127.0.0.1", multiplex=False, parent=None</i>) <p> Constructor </p> <dl> -<dt><i>name</i> (str)</dt> +<dt><i>name</i> (str (optional))</dt> <dd> -name of the server (used for output only) +name of the server (used for output only) (defaults to "") </dd> -<dt><i>multiplex</i> (bool)</dt> +<dt><i>interface</i> (str (optional))</dt> <dd> -flag indicating a multiplexing server +network interface to be used (IP address or one of "all", + "allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1") </dd> -<dt><i>parent</i> (QObject)</dt> +<dt><i>multiplex</i> (bool (optional))</dt> <dd> -parent object +flag indicating a multiplexing server (defaults to False) +</dd> +<dt><i>parent</i> (QObject (optional))</dt> +<dd> +reference to the parent object (defaults to None) </dd> </dl> <a NAME="EricJsonServer.__handleDisconnect" ID="EricJsonServer.__handleDisconnect"></a>
--- a/src/eric7/Documentation/Source/eric7.EricNetwork.EricJsonStreamReader.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricNetwork.EricJsonStreamReader.html Thu Sep 26 15:49:36 2024 +0200 @@ -97,24 +97,25 @@ <a NAME="EricJsonReader.__init__" ID="EricJsonReader.__init__"></a> <h4>EricJsonReader (Constructor)</h4> -<b>EricJsonReader</b>(<i>name="", ip=None, parent=None</i>) +<b>EricJsonReader</b>(<i>name="", interface="127.0.0.1", parent=None</i>) <p> Constructor </p> <dl> -<dt><i>name</i> (str)</dt> +<dt><i>name</i> (str (optional))</dt> <dd> -name of the server (used for output only) +name of the server (used for output only) (defaults to "") </dd> -<dt><i>ip</i> (str)</dt> +<dt><i>interface</i> (str (optional))</dt> <dd> -IP address to listen at +network interface to be used (IP address or one of "all", + "allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1") </dd> -<dt><i>parent</i> (QObject)</dt> +<dt><i>parent</i> (QObject (optional))</dt> <dd> -parent object +reference to the parent object (defaults to None) </dd> </dl> <a NAME="EricJsonReader.__handleDisconnect" ID="EricJsonReader.__handleDisconnect"></a>
--- a/src/eric7/Documentation/Source/eric7.EricNetwork.EricSslCertificatesDialog.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricNetwork.EricSslCertificatesDialog.html Thu Sep 26 15:49:36 2024 +0200 @@ -137,13 +137,17 @@ <a NAME="EricSslCertificatesDialog.__init__" ID="EricSslCertificatesDialog.__init__"></a> <h4>EricSslCertificatesDialog (Constructor)</h4> -<b>EricSslCertificatesDialog</b>(<i>parent=None</i>) +<b>EricSslCertificatesDialog</b>(<i>settings, parent=None</i>) <p> Constructor </p> <dl> +<dt><i>settings</i> (QSettings)</dt> +<dd> +reference to the settings object +</dd> <dt><i>parent</i> (QWidget)</dt> <dd> reference to the parent widget
--- a/src/eric7/Documentation/Source/eric7.EricNetwork.EricSslErrorHandler.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricNetwork.EricSslErrorHandler.html Thu Sep 26 15:49:36 2024 +0200 @@ -93,16 +93,20 @@ <a NAME="EricSslErrorHandler.__init__" ID="EricSslErrorHandler.__init__"></a> <h4>EricSslErrorHandler (Constructor)</h4> -<b>EricSslErrorHandler</b>(<i>parent=None</i>) +<b>EricSslErrorHandler</b>(<i>settings, parent=None</i>) <p> Constructor </p> <dl> -<dt><i>parent</i> (QObject)</dt> +<dt><i>settings</i> (QSettings)</dt> <dd> -reference to the parent object +reference to the settings object +</dd> +<dt><i>parent</i> (QObject (optional))</dt> +<dd> +reference to the parent object (defaults to None) </dd> </dl> <a NAME="EricSslErrorHandler.__certToString" ID="EricSslErrorHandler.__certToString"></a>
--- a/src/eric7/Documentation/Source/eric7.EricUtilities.__init__.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricUtilities.__init__.html Thu Sep 26 15:49:36 2024 +0200 @@ -13,7 +13,11 @@ <h3>Global Attributes</h3> <table> -<tr><td>None</td></tr> +<tr><td>_configDir</td></tr> +<tr><td>_escape</td></tr> +<tr><td>_escape_map</td></tr> +<tr><td>_uescape</td></tr> +<tr><td>_uunescape</td></tr> </table> <h3>Classes</h3> @@ -28,6 +32,46 @@ <td>Function to generate a formatted size string.</td> </tr> <tr> +<td><a href="#decodeBytes">decodeBytes</a></td> +<td>Function to decode some byte text into a string.</td> +</tr> +<tr> +<td><a href="#decodeString">decodeString</a></td> +<td>Function to decode a string containing Unicode encoded characters.</td> +</tr> +<tr> +<td><a href="#escape_entities">escape_entities</a></td> +<td>Function to encode html entities.</td> +</tr> +<tr> +<td><a href="#escape_uentities">escape_uentities</a></td> +<td>Function to encode html entities.</td> +</tr> +<tr> +<td><a href="#getConfigDir">getConfigDir</a></td> +<td>Module function to get the name of the directory storing the config data.</td> +</tr> +<tr> +<td><a href="#html_encode">html_encode</a></td> +<td>Function to correctly encode a text for html.</td> +</tr> +<tr> +<td><a href="#html_udecode">html_udecode</a></td> +<td>Function to correctly decode a html text to a unicode text.</td> +</tr> +<tr> +<td><a href="#html_uencode">html_uencode</a></td> +<td>Function to correctly encode a unicode text for html.</td> +</tr> +<tr> +<td><a href="#readStringFromStream">readStringFromStream</a></td> +<td>Module function to read a string from the given stream.</td> +</tr> +<tr> +<td><a href="#setConfigDir">setConfigDir</a></td> +<td>Module function to set the name of the directory storing the config data.</td> +</tr> +<tr> <td><a href="#strGroup">strGroup</a></td> <td>Function to group a string into sub-strings separated by a separator.</td> </tr> @@ -52,6 +96,10 @@ <td>Function to convert a value to a list.</td> </tr> <tr> +<td><a href="#unescape_uentities">unescape_uentities</a></td> +<td>Function to decode html entities.</td> +</tr> +<tr> <td><a href="#versionIsValid">versionIsValid</a></td> <td>Function to check, if the given version string is valid.</td> </tr> @@ -96,6 +144,293 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> +<a NAME="decodeBytes" ID="decodeBytes"></a> +<h2>decodeBytes</h2> +<b>decodeBytes</b>(<i>buffer</i>) +<p> + Function to decode some byte text into a string. +</p> + +<dl> + +<dt><i>buffer</i> (bytes)</dt> +<dd> +byte buffer to decode +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decoded text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="decodeString" ID="decodeString"></a> +<h2>decodeString</h2> +<b>decodeString</b>(<i>text</i>) +<p> + Function to decode a string containing Unicode encoded characters. +</p> + +<dl> + +<dt><i>text</i> (str)</dt> +<dd> +text containing encoded chars +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decoded text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="escape_entities" ID="escape_entities"></a> +<h2>escape_entities</h2> +<b>escape_entities</b>(<i>m, escmap=_escape_map</i>) +<p> + Function to encode html entities. +</p> + +<dl> + +<dt><i>m</i> (re.Match)</dt> +<dd> +the match object +</dd> +<dt><i>escmap</i> (dict)</dt> +<dd> +the map of entities to encode +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the converted text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="escape_uentities" ID="escape_uentities"></a> +<h2>escape_uentities</h2> +<b>escape_uentities</b>(<i>m</i>) +<p> + Function to encode html entities. +</p> + +<dl> + +<dt><i>m</i> (re.Match)</dt> +<dd> +the match object +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the converted text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="getConfigDir" ID="getConfigDir"></a> +<h2>getConfigDir</h2> +<b>getConfigDir</b>(<i></i>) +<p> + Module function to get the name of the directory storing the config data. +</p> + +<dl> +<dt>Return:</dt> +<dd> +directory name of the config dir +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="html_encode" ID="html_encode"></a> +<h2>html_encode</h2> +<b>html_encode</b>(<i>text, pattern=_escape</i>) +<p> + Function to correctly encode a text for html. +</p> + +<dl> + +<dt><i>text</i> (str)</dt> +<dd> +text to be encoded +</dd> +<dt><i>pattern</i> (str)</dt> +<dd> +search pattern for text to be encoded +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the encoded text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="html_udecode" ID="html_udecode"></a> +<h2>html_udecode</h2> +<b>html_udecode</b>(<i>text, pattern=_uunescape</i>) +<p> + Function to correctly decode a html text to a unicode text. +</p> + +<dl> + +<dt><i>text</i> (str)</dt> +<dd> +text to be decoded +</dd> +<dt><i>pattern</i> (str)</dt> +<dd> +search pattern for text to be decoded +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the decoded text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="html_uencode" ID="html_uencode"></a> +<h2>html_uencode</h2> +<b>html_uencode</b>(<i>text, pattern=_uescape</i>) +<p> + Function to correctly encode a unicode text for html. +</p> + +<dl> + +<dt><i>text</i> (str)</dt> +<dd> +text to be encoded +</dd> +<dt><i>pattern</i> (str)</dt> +<dd> +search pattern for text to be encoded +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the encoded text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="readStringFromStream" ID="readStringFromStream"></a> +<h2>readStringFromStream</h2> +<b>readStringFromStream</b>(<i>stream</i>) +<p> + Module function to read a string from the given stream. +</p> + +<dl> + +<dt><i>stream</i> (QDataStream)</dt> +<dd> +data stream opened for reading +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +string read from the stream +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="setConfigDir" ID="setConfigDir"></a> +<h2>setConfigDir</h2> +<b>setConfigDir</b>(<i>d</i>) +<p> + Module function to set the name of the directory storing the config data. +</p> + +<dl> + +<dt><i>d</i> (str)</dt> +<dd> +name of an existing directory +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> <a NAME="strGroup" ID="strGroup"></a> <h2>strGroup</h2> <b>strGroup</b>(<i>txt, sep, groupLen=4</i>) @@ -279,6 +614,35 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> +<a NAME="unescape_uentities" ID="unescape_uentities"></a> +<h2>unescape_uentities</h2> +<b>unescape_uentities</b>(<i>m</i>) +<p> + Function to decode html entities. +</p> + +<dl> + +<dt><i>m</i> (re.Match)</dt> +<dd> +the match object +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +the converted text +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> <a NAME="versionIsValid" ID="versionIsValid"></a> <h2>versionIsValid</h2> <b>versionIsValid</b>(<i>version</i>)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.EricUtilities.crypto.__init__.html Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,421 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricUtilities.crypto.__init__</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.EricUtilities.crypto.__init__</h1> +<p> +Package implementing cryptography related functionality. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>CryptoMarker</td></tr> +<tr><td>Delimiter</td></tr> +<tr><td>EncodeMarker</td></tr> +<tr><td>MainPassword</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#__getMainPassword">__getMainPassword</a></td> +<td>Private module function to get the password from the user.</td> +</tr> +<tr> +<td><a href="#changeRememberedMain">changeRememberedMain</a></td> +<td>Module function to change the remembered main password.</td> +</tr> +<tr> +<td><a href="#dataDecrypt">dataDecrypt</a></td> +<td>Module function to decrypt a password.</td> +</tr> +<tr> +<td><a href="#dataEncrypt">dataEncrypt</a></td> +<td>Module function to encrypt a password.</td> +</tr> +<tr> +<td><a href="#pwConvert">pwConvert</a></td> +<td>Module function to convert a plaintext password to the encoded form or vice versa.</td> +</tr> +<tr> +<td><a href="#pwDecode">pwDecode</a></td> +<td>Module function to decode a password.</td> +</tr> +<tr> +<td><a href="#pwDecrypt">pwDecrypt</a></td> +<td>Module function to decrypt a password.</td> +</tr> +<tr> +<td><a href="#pwEncode">pwEncode</a></td> +<td>Module function to encode a password.</td> +</tr> +<tr> +<td><a href="#pwEncrypt">pwEncrypt</a></td> +<td>Module function to encrypt a password.</td> +</tr> +<tr> +<td><a href="#pwRecode">pwRecode</a></td> +<td>Module function to re-encode a password.</td> +</tr> +<tr> +<td><a href="#pwReencrypt">pwReencrypt</a></td> +<td>Module function to re-encrypt a password.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="__getMainPassword" ID="__getMainPassword"></a> +<h2>__getMainPassword</h2> +<b>__getMainPassword</b>(<i></i>) +<p> + Private module function to get the password from the user. +</p> + +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="changeRememberedMain" ID="changeRememberedMain"></a> +<h2>changeRememberedMain</h2> +<b>changeRememberedMain</b>(<i>newPassword</i>) +<p> + Module function to change the remembered main password. +</p> + +<dl> + +<dt><i>newPassword</i> (str)</dt> +<dd> +new password to be used +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="dataDecrypt" ID="dataDecrypt"></a> +<h2>dataDecrypt</h2> +<b>dataDecrypt</b>(<i>edata, password, keyLength=32</i>) +<p> + Module function to decrypt a password. +</p> + +<dl> + +<dt><i>edata</i> (str)</dt> +<dd> +hashed data to decrypt +</dd> +<dt><i>password</i> (str)</dt> +<dd> +password to be used for decryption +</dd> +<dt><i>keyLength</i> (int)</dt> +<dd> +length of the key to be generated for decryption (16, 24 or 32) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decrypted data (bytes) and flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="dataEncrypt" ID="dataEncrypt"></a> +<h2>dataEncrypt</h2> +<b>dataEncrypt</b>(<i>data, password, keyLength=32, hashIterations=10000</i>) +<p> + Module function to encrypt a password. +</p> + +<dl> + +<dt><i>data</i> (bytes)</dt> +<dd> +data to encrypt +</dd> +<dt><i>password</i> (str)</dt> +<dd> +password to be used for encryption +</dd> +<dt><i>keyLength</i> (int)</dt> +<dd> +length of the key to be generated for encryption (16, 24 or 32) +</dd> +<dt><i>hashIterations</i> (int)</dt> +<dd> +number of hashes to be applied to the password for + generating the encryption key +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encrypted data (bytes) and flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwConvert" ID="pwConvert"></a> +<h2>pwConvert</h2> +<b>pwConvert</b>(<i>pw, encode=True</i>) +<p> + Module function to convert a plaintext password to the encoded form or + vice versa. +</p> +<p> + If there is an error, an empty code is returned for the encode function + or the given encoded password for the decode function. +</p> + +<dl> + +<dt><i>pw</i> (str)</dt> +<dd> +password to encode +</dd> +<dt><i>encode</i> (bool)</dt> +<dd> +flag indicating an encode or decode function +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encoded or decoded password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwDecode" ID="pwDecode"></a> +<h2>pwDecode</h2> +<b>pwDecode</b>(<i>epw</i>) +<p> + Module function to decode a password. +</p> + +<dl> + +<dt><i>epw</i> (str)</dt> +<dd> +encoded password to decode +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decoded password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwDecrypt" ID="pwDecrypt"></a> +<h2>pwDecrypt</h2> +<b>pwDecrypt</b>(<i>epw, mainPW=None</i>) +<p> + Module function to decrypt a password. +</p> + +<dl> + +<dt><i>epw</i> (str)</dt> +<dd> +hashed password to decrypt +</dd> +<dt><i>mainPW</i> (str)</dt> +<dd> +password to be used for decryption +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decrypted password (string) and flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwEncode" ID="pwEncode"></a> +<h2>pwEncode</h2> +<b>pwEncode</b>(<i>pw</i>) +<p> + Module function to encode a password. +</p> + +<dl> + +<dt><i>pw</i> (str)</dt> +<dd> +password to encode +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encoded password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwEncrypt" ID="pwEncrypt"></a> +<h2>pwEncrypt</h2> +<b>pwEncrypt</b>(<i>pw, mainPW=None</i>) +<p> + Module function to encrypt a password. +</p> + +<dl> + +<dt><i>pw</i> (str)</dt> +<dd> +password to encrypt +</dd> +<dt><i>mainPW</i> (str)</dt> +<dd> +password to be used for encryption +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encrypted password (string) and flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwRecode" ID="pwRecode"></a> +<h2>pwRecode</h2> +<b>pwRecode</b>(<i>epw, oldPassword, newPassword</i>) +<p> + Module function to re-encode a password. +</p> +<p> + In case of an error the encoded password is returned unchanged. +</p> + +<dl> + +<dt><i>epw</i> (str)</dt> +<dd> +encoded password to re-encode +</dd> +<dt><i>oldPassword</i> (str)</dt> +<dd> +password used to encode +</dd> +<dt><i>newPassword</i> (str)</dt> +<dd> +new password to be used +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encoded password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pwReencrypt" ID="pwReencrypt"></a> +<h2>pwReencrypt</h2> +<b>pwReencrypt</b>(<i>epw, oldPassword, newPassword</i>) +<p> + Module function to re-encrypt a password. +</p> + +<dl> + +<dt><i>epw</i> (str)</dt> +<dd> +hashed password to re-encrypt +</dd> +<dt><i>oldPassword</i> (str)</dt> +<dd> +password used to encrypt +</dd> +<dt><i>newPassword</i> (str)</dt> +<dd> +new password to be used +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encrypted password (string) and flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.EricUtilities.crypto.py3AES.html Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,1156 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricUtilities.crypto.py3AES</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.EricUtilities.crypto.py3AES</h1> +<p> +Module implementing classes for encryption according +Advanced Encryption Standard. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#AES">AES</a></td> +<td>Class implementing the Advanced Encryption Standard algorithm.</td> +</tr> +<tr> +<td><a href="#AESModeOfOperation">AESModeOfOperation</a></td> +<td>Class implementing the different AES mode of operations.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#append_PKCS7_padding">append_PKCS7_padding</a></td> +<td>Function to pad the given data to a multiple of 16-bytes by PKCS7 padding.</td> +</tr> +<tr> +<td><a href="#decryptData">decryptData</a></td> +<td>Module function to decrypt the given data with the given key.</td> +</tr> +<tr> +<td><a href="#encryptData">encryptData</a></td> +<td>Module function to encrypt the given data with the given key.</td> +</tr> +<tr> +<td><a href="#strip_PKCS7_padding">strip_PKCS7_padding</a></td> +<td>Function to strip off PKCS7 padding.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="AES" ID="AES"></a> +<h2>AES</h2> +<p> + Class implementing the Advanced Encryption Standard algorithm. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>KeySize</td></tr> +<tr><td>Rcon</td></tr> +<tr><td>rsbox</td></tr> +<tr><td>sbox</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#AES.__addRoundKey">__addRoundKey</a></td> +<td>Private method to add (XORs) the round key to the state.</td> +</tr> +<tr> +<td><a href="#AES.__aes_invMain">__aes_invMain</a></td> +<td>Private method to do the inverse AES encryption for one round.</td> +</tr> +<tr> +<td><a href="#AES.__aes_invRound">__aes_invRound</a></td> +<td>Private method to apply the 4 operations of the inverse round in sequence.</td> +</tr> +<tr> +<td><a href="#AES.__aes_main">__aes_main</a></td> +<td>Private method to do the AES encryption for one round.</td> +</tr> +<tr> +<td><a href="#AES.__aes_round">__aes_round</a></td> +<td>Private method to apply the 4 operations of the forward round in sequence.</td> +</tr> +<tr> +<td><a href="#AES.__core">__core</a></td> +<td>Private method performing the key schedule core operation.</td> +</tr> +<tr> +<td><a href="#AES.__createRoundKey">__createRoundKey</a></td> +<td>Private method to create a round key.</td> +</tr> +<tr> +<td><a href="#AES.__expandKey">__expandKey</a></td> +<td>Private method performing Rijndael's key expansion.</td> +</tr> +<tr> +<td><a href="#AES.__galois_multiplication">__galois_multiplication</a></td> +<td>Private method to perform a Galois multiplication of 8 bit characters a and b.</td> +</tr> +<tr> +<td><a href="#AES.__getRconValue">__getRconValue</a></td> +<td>Private method to retrieve a given Rcon value.</td> +</tr> +<tr> +<td><a href="#AES.__getSBoxInvert">__getSBoxInvert</a></td> +<td>Private method to retrieve a given Inverted S-Box value.</td> +</tr> +<tr> +<td><a href="#AES.__getSBoxValue">__getSBoxValue</a></td> +<td>Private method to retrieve a given S-Box value.</td> +</tr> +<tr> +<td><a href="#AES.__mixColumn">__mixColumn</a></td> +<td>Private method to perform a galois multiplication of 1 column the 4x4 matrix.</td> +</tr> +<tr> +<td><a href="#AES.__mixColumns">__mixColumns</a></td> +<td>Private method to perform a galois multiplication of the 4x4 matrix.</td> +</tr> +<tr> +<td><a href="#AES.__rotate">__rotate</a></td> +<td>Private method performing Rijndael's key schedule rotate operation.</td> +</tr> +<tr> +<td><a href="#AES.__shiftRow">__shiftRow</a></td> +<td>Private method to shift the bytes of a row to the left.</td> +</tr> +<tr> +<td><a href="#AES.__shiftRows">__shiftRows</a></td> +<td>Private method to iterate over the 4 rows and call __shiftRow() with that row.</td> +</tr> +<tr> +<td><a href="#AES.__subBytes">__subBytes</a></td> +<td>Private method to substitute all the values from the state with the value in the SBox using the state value as index for the SBox.</td> +</tr> +<tr> +<td><a href="#AES.decrypt">decrypt</a></td> +<td>Public method to decrypt a 128 bit input block against the given key of size specified.</td> +</tr> +<tr> +<td><a href="#AES.encrypt">encrypt</a></td> +<td>Public method to encrypt a 128 bit input block against the given key of size specified.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="AES.__addRoundKey" ID="AES.__addRoundKey"></a> +<h4>AES.__addRoundKey</h4> +<b>__addRoundKey</b>(<i>state, roundKey</i>) +<p> + Private method to add (XORs) the round key to the state. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be changed +</dd> +<dt><i>roundKey</i> (bytearray)</dt> +<dd> +key to be used for the modification +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__aes_invMain" ID="AES.__aes_invMain"></a> +<h4>AES.__aes_invMain</h4> +<b>__aes_invMain</b>(<i>state, expandedKey, nbrRounds</i>) +<p> + Private method to do the inverse AES encryption for one round. +</p> +<p> + Perform the initial operations, the standard round, and the + final operations of the inverse AES, creating a round key for + each round. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>expandedKey</i> (bytearray)</dt> +<dd> +expanded key to be used +</dd> +<dt><i>nbrRounds</i> (int)</dt> +<dd> +number of rounds to be done +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__aes_invRound" ID="AES.__aes_invRound"></a> +<h4>AES.__aes_invRound</h4> +<b>__aes_invRound</b>(<i>state, roundKey</i>) +<p> + Private method to apply the 4 operations of the inverse round in + sequence. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>roundKey</i> (bytearray)</dt> +<dd> +round key to be used +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__aes_main" ID="AES.__aes_main"></a> +<h4>AES.__aes_main</h4> +<b>__aes_main</b>(<i>state, expandedKey, nbrRounds</i>) +<p> + Private method to do the AES encryption for one round. +</p> +<p> + Perform the initial operations, the standard round, and the + final operations of the forward AES, creating a round key for + each round. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>expandedKey</i> (bytearray)</dt> +<dd> +expanded key to be used +</dd> +<dt><i>nbrRounds</i> (int)</dt> +<dd> +number of rounds to be done +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__aes_round" ID="AES.__aes_round"></a> +<h4>AES.__aes_round</h4> +<b>__aes_round</b>(<i>state, roundKey</i>) +<p> + Private method to apply the 4 operations of the forward round in + sequence. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>roundKey</i> (bytearray)</dt> +<dd> +round key to be used +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__core" ID="AES.__core"></a> +<h4>AES.__core</h4> +<b>__core</b>(<i>data, iteration</i>) +<p> + Private method performing the key schedule core operation. +</p> + +<dl> + +<dt><i>data</i> (bytearray)</dt> +<dd> +data to operate on +</dd> +<dt><i>iteration</i> (int)</dt> +<dd> +iteration counter +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__createRoundKey" ID="AES.__createRoundKey"></a> +<h4>AES.__createRoundKey</h4> +<b>__createRoundKey</b>(<i>expandedKey, roundKeyPointer</i>) +<p> + Private method to create a round key. +</p> + +<dl> + +<dt><i>expandedKey</i> (bytearray)</dt> +<dd> +expanded key to be used +</dd> +<dt><i>roundKeyPointer</i> (int)</dt> +<dd> +position within the expanded key +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +round key +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__expandKey" ID="AES.__expandKey"></a> +<h4>AES.__expandKey</h4> +<b>__expandKey</b>(<i>key, size, expandedKeySize</i>) +<p> + Private method performing Rijndael's key expansion. +</p> +<p> + Expands a 128, 192 or 256 bit key into a 176, 208 or 240 bit key. +</p> + +<dl> + +<dt><i>key</i> (bytes or bytearray)</dt> +<dd> +key to be expanded +</dd> +<dt><i>size</i> (int)</dt> +<dd> +size of the key in bytes (16, 24 or 32) +</dd> +<dt><i>expandedKeySize</i> (int)</dt> +<dd> +size of the expanded key +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +expanded key +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__galois_multiplication" ID="AES.__galois_multiplication"></a> +<h4>AES.__galois_multiplication</h4> +<b>__galois_multiplication</b>(<i>a, b</i>) +<p> + Private method to perform a Galois multiplication of 8 bit characters + a and b. +</p> + +<dl> + +<dt><i>a</i> (bytes)</dt> +<dd> +first factor +</dd> +<dt><i>b</i> (bytes)</dt> +<dd> +second factor +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +result +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<a NAME="AES.__getRconValue" ID="AES.__getRconValue"></a> +<h4>AES.__getRconValue</h4> +<b>__getRconValue</b>(<i>num</i>) +<p> + Private method to retrieve a given Rcon value. +</p> + +<dl> + +<dt><i>num</i> (int)</dt> +<dd> +position of the value +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +Rcon value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> +<a NAME="AES.__getSBoxInvert" ID="AES.__getSBoxInvert"></a> +<h4>AES.__getSBoxInvert</h4> +<b>__getSBoxInvert</b>(<i>num</i>) +<p> + Private method to retrieve a given Inverted S-Box value. +</p> + +<dl> + +<dt><i>num</i> (int)</dt> +<dd> +position of the value +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the Inverted S-Box +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> +<a NAME="AES.__getSBoxValue" ID="AES.__getSBoxValue"></a> +<h4>AES.__getSBoxValue</h4> +<b>__getSBoxValue</b>(<i>num</i>) +<p> + Private method to retrieve a given S-Box value. +</p> + +<dl> + +<dt><i>num</i> (int)</dt> +<dd> +position of the value +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the S-Box +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +int +</dd> +</dl> +<a NAME="AES.__mixColumn" ID="AES.__mixColumn"></a> +<h4>AES.__mixColumn</h4> +<b>__mixColumn</b>(<i>column, isInv</i>) +<p> + Private method to perform a galois multiplication of 1 column the + 4x4 matrix. +</p> + +<dl> + +<dt><i>column</i> (bytearray)</dt> +<dd> +column to be worked on +</dd> +<dt><i>isInv</i> (bool)</dt> +<dd> +flag indicating an inverse operation +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified column +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__mixColumns" ID="AES.__mixColumns"></a> +<h4>AES.__mixColumns</h4> +<b>__mixColumns</b>(<i>state, isInv</i>) +<p> + Private method to perform a galois multiplication of the 4x4 matrix. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>isInv</i> (bool)</dt> +<dd> +flag indicating an inverse operation +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__rotate" ID="AES.__rotate"></a> +<h4>AES.__rotate</h4> +<b>__rotate</b>(<i>data</i>) +<p> + Private method performing Rijndael's key schedule rotate operation. +</p> +<p> + Rotate the data word eight bits to the left: eg, + rotate(1d2c3a4f) == 2c3a4f1d. +</p> + +<dl> + +<dt><i>data</i> (bytearray)</dt> +<dd> +data of size 4 +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +rotated data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__shiftRow" ID="AES.__shiftRow"></a> +<h4>AES.__shiftRow</h4> +<b>__shiftRow</b>(<i>state, statePointer, nbr, isInv</i>) +<p> + Private method to shift the bytes of a row to the left. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>statePointer</i> (int)</dt> +<dd> +index into the state +</dd> +<dt><i>nbr</i> (int)</dt> +<dd> +number of positions to shift +</dd> +<dt><i>isInv</i> (bool)</dt> +<dd> +flag indicating an inverse operation +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__shiftRows" ID="AES.__shiftRows"></a> +<h4>AES.__shiftRows</h4> +<b>__shiftRows</b>(<i>state, isInv</i>) +<p> + Private method to iterate over the 4 rows and call __shiftRow() with + that row. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>isInv</i> (bool)</dt> +<dd> +flag indicating an inverse operation +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.__subBytes" ID="AES.__subBytes"></a> +<h4>AES.__subBytes</h4> +<b>__subBytes</b>(<i>state, isInv</i>) +<p> + Private method to substitute all the values from the state with the + value in the SBox using the state value as index for the SBox. +</p> + +<dl> + +<dt><i>state</i> (bytearray)</dt> +<dd> +state to be worked on +</dd> +<dt><i>isInv</i> (bool)</dt> +<dd> +flag indicating an inverse operation +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +modified state +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AES.decrypt" ID="AES.decrypt"></a> +<h4>AES.decrypt</h4> +<b>decrypt</b>(<i>iput, key, size</i>) +<p> + Public method to decrypt a 128 bit input block against the given key + of size specified. +</p> + +<dl> + +<dt><i>iput</i> (bytearray)</dt> +<dd> +input data +</dd> +<dt><i>key</i> (bytes or bytearray)</dt> +<dd> +key to be used +</dd> +<dt><i>size</i> (int)</dt> +<dd> +key size (16, 24 or 32) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decrypted data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +key size is invalid +</dd> +</dl> +<a NAME="AES.encrypt" ID="AES.encrypt"></a> +<h4>AES.encrypt</h4> +<b>encrypt</b>(<i>iput, key, size</i>) +<p> + Public method to encrypt a 128 bit input block against the given key + of size specified. +</p> + +<dl> + +<dt><i>iput</i> (bytearray)</dt> +<dd> +input data +</dd> +<dt><i>key</i> (bytes or bytearray)</dt> +<dd> +key to be used +</dd> +<dt><i>size</i> (int)</dt> +<dd> +key size (16, 24 or 32) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encrypted data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +key size is invalid +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="AESModeOfOperation" ID="AESModeOfOperation"></a> +<h2>AESModeOfOperation</h2> +<p> + Class implementing the different AES mode of operations. +</p> + +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> +<table> +<tr><td>ModeOfOperation</td></tr> +<tr><td>aes</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#AESModeOfOperation.__extractBytes">__extractBytes</a></td> +<td>Private method to extract a range of bytes from the input.</td> +</tr> +<tr> +<td><a href="#AESModeOfOperation.decrypt">decrypt</a></td> +<td>Public method to perform the decryption operation.</td> +</tr> +<tr> +<td><a href="#AESModeOfOperation.encrypt">encrypt</a></td> +<td>Public method to perform the encryption operation.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="AESModeOfOperation.__extractBytes" ID="AESModeOfOperation.__extractBytes"></a> +<h4>AESModeOfOperation.__extractBytes</h4> +<b>__extractBytes</b>(<i>inputData, start, end, mode</i>) +<p> + Private method to extract a range of bytes from the input. +</p> + +<dl> + +<dt><i>inputData</i> (bytes)</dt> +<dd> +input data +</dd> +<dt><i>start</i> (int)</dt> +<dd> +start index +</dd> +<dt><i>end</i> (int)</dt> +<dd> +end index +</dd> +<dt><i>mode</i> (int)</dt> +<dd> +mode of operation (0, 1, 2) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +extracted bytes +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytearray +</dd> +</dl> +<a NAME="AESModeOfOperation.decrypt" ID="AESModeOfOperation.decrypt"></a> +<h4>AESModeOfOperation.decrypt</h4> +<b>decrypt</b>(<i>cipherIn, originalsize, mode, key, size, IV</i>) +<p> + Public method to perform the decryption operation. +</p> + +<dl> + +<dt><i>cipherIn</i> (bytes)</dt> +<dd> +data to be decrypted +</dd> +<dt><i>originalsize</i> (int)</dt> +<dd> +unencrypted string length (required for CBC) +</dd> +<dt><i>mode</i> (int)</dt> +<dd> +mode of operation (0, 1 or 2) +</dd> +<dt><i>key</i> (bytes)</dt> +<dd> +key to be used +</dd> +<dt><i>size</i> (int)</dt> +<dd> +length of the key (16, 24 or 32) +</dd> +<dt><i>IV</i> (bytearray)</dt> +<dd> +initialisation vector +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decrypted data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +key size is invalid or decrypted data is invalid +</dd> +</dl> +<a NAME="AESModeOfOperation.encrypt" ID="AESModeOfOperation.encrypt"></a> +<h4>AESModeOfOperation.encrypt</h4> +<b>encrypt</b>(<i>inputData, mode, key, size, IV</i>) +<p> + Public method to perform the encryption operation. +</p> + +<dl> + +<dt><i>inputData</i> (bytes)</dt> +<dd> +data to be encrypted +</dd> +<dt><i>mode</i> (int)</dt> +<dd> +mode of operation (0, 1 or 2) +</dd> +<dt><i>key</i> (bytes)</dt> +<dd> +key to be used +</dd> +<dt><i>size</i> (int)</dt> +<dd> +length of the key (16, 24 or 32) +</dd> +<dt><i>IV</i> (bytearray)</dt> +<dd> +initialisation vector +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple with mode of operation, length of the input data and + the encrypted data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (int, int, bytes) +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +key size is invalid or decrypted data is invalid +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="append_PKCS7_padding" ID="append_PKCS7_padding"></a> +<h2>append_PKCS7_padding</h2> +<b>append_PKCS7_padding</b>(<i>b</i>) +<p> + Function to pad the given data to a multiple of 16-bytes by PKCS7 padding. +</p> + +<dl> + +<dt><i>b</i> (bytes)</dt> +<dd> +data to be padded +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +padded data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="decryptData" ID="decryptData"></a> +<h2>decryptData</h2> +<b>decryptData</b>(<i>key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]</i>) +<p> + Module function to decrypt the given data with the given key. +</p> + +<dl> + +<dt><i>key</i> (bytes)</dt> +<dd> +key to be used for decryption +</dd> +<dt><i>data</i> (bytes)</dt> +<dd> +data to be decrypted (with initialization vector prepended) +</dd> +<dt><i>mode</i> (int)</dt> +<dd> +mode of operations (0, 1 or 2) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +decrypted data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +raised to indicate an invalid key size +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="encryptData" ID="encryptData"></a> +<h2>encryptData</h2> +<b>encryptData</b>(<i>key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]</i>) +<p> + Module function to encrypt the given data with the given key. +</p> + +<dl> + +<dt><i>key</i> (bytes)</dt> +<dd> +key to be used for encryption +</dd> +<dt><i>data</i> (bytes)</dt> +<dd> +data to be encrypted +</dd> +<dt><i>mode</i> (int)</dt> +<dd> +mode of operations (0, 1 or 2) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +encrypted data prepended with the initialization vector +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +raised to indicate an invalid key size +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="strip_PKCS7_padding" ID="strip_PKCS7_padding"></a> +<h2>strip_PKCS7_padding</h2> +<b>strip_PKCS7_padding</b>(<i>b</i>) +<p> + Function to strip off PKCS7 padding. +</p> + +<dl> + +<dt><i>b</i> (bytes)</dt> +<dd> +data to be stripped +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +stripped data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +data padding is invalid +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.EricUtilities.crypto.py3PBKDF2.html Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,258 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricUtilities.crypto.py3PBKDF2</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.EricUtilities.crypto.py3PBKDF2</h1> +<p> +Module implementing PBKDF2 functions. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>Delimiter</td></tr> +<tr><td>Hashes</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#hashPassword">hashPassword</a></td> +<td>Module function to hash a password according to the PBKDF2 specification.</td> +</tr> +<tr> +<td><a href="#hashPasswordTuple">hashPasswordTuple</a></td> +<td>Module function to hash a password according to the PBKDF2 specification.</td> +</tr> +<tr> +<td><a href="#pbkdf2">pbkdf2</a></td> +<td>Module function to hash a password according to the PBKDF2 specification.</td> +</tr> +<tr> +<td><a href="#rehashPassword">rehashPassword</a></td> +<td>Module function to recreate a password hash given the hash parameters.</td> +</tr> +<tr> +<td><a href="#verifyPassword">verifyPassword</a></td> +<td>Module function to verify a password against a hash encoded password.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="hashPassword" ID="hashPassword"></a> +<h2>hashPassword</h2> +<b>hashPassword</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>) +<p> + Module function to hash a password according to the PBKDF2 specification. +</p> + +<dl> + +<dt><i>password</i> (str)</dt> +<dd> +clear text password +</dd> +<dt><i>digestMod</i> (function)</dt> +<dd> +hash function +</dd> +<dt><i>iterations</i> (int)</dt> +<dd> +number of times hash function should be applied +</dd> +<dt><i>saltSize</i> (int)</dt> +<dd> +size of the salt +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +hashed password entry according to PBKDF2 specification +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="hashPasswordTuple" ID="hashPasswordTuple"></a> +<h2>hashPasswordTuple</h2> +<b>hashPasswordTuple</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>) +<p> + Module function to hash a password according to the PBKDF2 specification. +</p> + +<dl> + +<dt><i>password</i> (str)</dt> +<dd> +clear text password +</dd> +<dt><i>digestMod</i> (function)</dt> +<dd> +hash function +</dd> +<dt><i>iterations</i> (int)</dt> +<dd> +number of times hash function should be applied +</dd> +<dt><i>saltSize</i> (int)</dt> +<dd> +size of the salt +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple of digestname, number of iterations, salt and hashed password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (str, int, bytes, bytes) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="pbkdf2" ID="pbkdf2"></a> +<h2>pbkdf2</h2> +<b>pbkdf2</b>(<i>password, salt, iterations, digestMod</i>) +<p> + Module function to hash a password according to the PBKDF2 specification. +</p> + +<dl> + +<dt><i>password</i> (bytes)</dt> +<dd> +clear text password +</dd> +<dt><i>salt</i> (bytes)</dt> +<dd> +salt value +</dd> +<dt><i>iterations</i> (int)</dt> +<dd> +number of times hash function should be applied +</dd> +<dt><i>digestMod</i> (function)</dt> +<dd> +hash function +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +hashed password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="rehashPassword" ID="rehashPassword"></a> +<h2>rehashPassword</h2> +<b>rehashPassword</b>(<i>password, hashParameters</i>) +<p> + Module function to recreate a password hash given the hash parameters. +</p> + +<dl> + +<dt><i>password</i> (str)</dt> +<dd> +clear text password +</dd> +<dt><i>hashParameters</i> (str)</dt> +<dd> +hash parameters in the form + 'digestmod$iterations$salt' +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +hashed password +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bytes +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +the hash parameters string is not of the expected + format or the digest is not one of the known ones +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="verifyPassword" ID="verifyPassword"></a> +<h2>verifyPassword</h2> +<b>verifyPassword</b>(<i>password, pwHash</i>) +<p> + Module function to verify a password against a hash encoded password. +</p> + +<dl> + +<dt><i>password</i> (str)</dt> +<dd> +clear text password +</dd> +<dt><i>pwHash</i> (str)</dt> +<dd> +hash encoded password in the form + 'digestmod$iterations$salt$hashed_password' as produced by the + hashPassword function +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating a successfull verification +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +the hash is not of the expected format or the + digest is not one of the known ones +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/eric7.Globals.__init__.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Globals.__init__.html Thu Sep 26 15:49:36 2024 +0200 @@ -13,7 +13,6 @@ <h3>Global Attributes</h3> <table> -<tr><td>configDir</td></tr> <tr><td>recentNameBreakpointConditions</td></tr> <tr><td>recentNameBreakpointFiles</td></tr> <tr><td>recentNameFiles</td></tr> @@ -40,10 +39,6 @@ <h3>Functions</h3> <table> <tr> -<td><a href="#getConfigDir">getConfigDir</a></td> -<td>Module function to get the name of the directory storing the config data.</td> -</tr> -<tr> <td><a href="#getInstallInfoFilePath">getInstallInfoFilePath</a></td> <td>Public method to get the path name of the install info file.</td> </tr> @@ -51,36 +46,10 @@ <td><a href="#getWebBrowserSupport">getWebBrowserSupport</a></td> <td>Module function to determine the supported web browser variant.</td> </tr> -<tr> -<td><a href="#setConfigDir">setConfigDir</a></td> -<td>Module function to set the name of the directory storing the config data.</td> -</tr> </table> <hr /> <hr /> -<a NAME="getConfigDir" ID="getConfigDir"></a> -<h2>getConfigDir</h2> -<b>getConfigDir</b>(<i></i>) -<p> - Module function to get the name of the directory storing the config data. -</p> - -<dl> -<dt>Return:</dt> -<dd> -directory name of the config dir -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="getInstallInfoFilePath" ID="getInstallInfoFilePath"></a> <h2>getInstallInfoFilePath</h2> <b>getInstallInfoFilePath</b>(<i></i>) @@ -125,21 +94,4 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /> -<hr /> -<a NAME="setConfigDir" ID="setConfigDir"></a> -<h2>setConfigDir</h2> -<b>setConfigDir</b>(<i>d</i>) -<p> - Module function to set the name of the directory storing the config data. -</p> - -<dl> - -<dt><i>d</i> (str)</dt> -<dd> -name of an existing directory -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> </body></html>
--- a/src/eric7/Documentation/Source/eric7.Preferences.ConfigurationPages.NetworkPage.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Preferences.ConfigurationPages.NetworkPage.html Thu Sep 26 15:49:36 2024 +0200 @@ -59,14 +59,6 @@ <td>Constructor</td> </tr> <tr> -<td><a href="#NetworkPage.on_clearProxyPasswordsButton_clicked">on_clearProxyPasswordsButton_clicked</a></td> -<td>Private slot to clear the saved HTTP(S) proxy passwords.</td> -</tr> -<tr> -<td><a href="#NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged">on_ftpProxyTypeCombo_currentIndexChanged</a></td> -<td>Private slot handling the selection of a proxy type.</td> -</tr> -<tr> <td><a href="#NetworkPage.save">save</a></td> <td>Public slot to save the Networj configuration.</td> </tr> @@ -96,27 +88,6 @@ reference to the configuration dialog </dd> </dl> -<a NAME="NetworkPage.on_clearProxyPasswordsButton_clicked" ID="NetworkPage.on_clearProxyPasswordsButton_clicked"></a> -<h4>NetworkPage.on_clearProxyPasswordsButton_clicked</h4> -<b>on_clearProxyPasswordsButton_clicked</b>(<i></i>) -<p> - Private slot to clear the saved HTTP(S) proxy passwords. -</p> - -<a NAME="NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged" ID="NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged"></a> -<h4>NetworkPage.on_ftpProxyTypeCombo_currentIndexChanged</h4> -<b>on_ftpProxyTypeCombo_currentIndexChanged</b>(<i>index</i>) -<p> - Private slot handling the selection of a proxy type. -</p> - -<dl> - -<dt><i>index</i> (int)</dt> -<dd> -index of the selected item -</dd> -</dl> <a NAME="NetworkPage.save" ID="NetworkPage.save"></a> <h4>NetworkPage.save</h4> <b>save</b>(<i></i>)
--- a/src/eric7/Documentation/Source/eric7.Utilities.__init__.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.Utilities.__init__.html Thu Sep 26 15:49:36 2024 +0200 @@ -13,11 +13,7 @@ <h3>Global Attributes</h3> <table> -<tr><td>_escape</td></tr> -<tr><td>_escape_map</td></tr> <tr><td>_slashmap</td></tr> -<tr><td>_uescape</td></tr> -<tr><td>_uunescape</td></tr> <tr><td>codingBytes_regexps</td></tr> <tr><td>coding_regexps</td></tr> <tr><td>supportedCodecs</td></tr> @@ -50,14 +46,6 @@ <td>Function to decode some byte text into a string.</td> </tr> <tr> -<td><a href="#decodeBytes">decodeBytes</a></td> -<td>Function to decode some byte text into a string.</td> -</tr> -<tr> -<td><a href="#decodeString">decodeString</a></td> -<td>Function to decode a string containing Unicode encoded characters.</td> -</tr> -<tr> <td><a href="#decodeWithEncoding">decodeWithEncoding</a></td> <td>Function to decode some byte text into a string.</td> </tr> @@ -66,14 +54,6 @@ <td>Function to encode text into a byte text.</td> </tr> <tr> -<td><a href="#escape_entities">escape_entities</a></td> -<td>Function to encode html entities.</td> -</tr> -<tr> -<td><a href="#escape_uentities">escape_uentities</a></td> -<td>Function to encode html entities.</td> -</tr> -<tr> <td><a href="#extractFlags">extractFlags</a></td> <td>Function to extract eric specific flags out of the given text.</td> </tr> @@ -142,18 +122,6 @@ <td>Function to get the coding of a bytes text.</td> </tr> <tr> -<td><a href="#html_encode">html_encode</a></td> -<td>Function to correctly encode a text for html.</td> -</tr> -<tr> -<td><a href="#html_udecode">html_udecode</a></td> -<td>Function to correctly decode a html text to a unicode text.</td> -</tr> -<tr> -<td><a href="#html_uencode">html_uencode</a></td> -<td>Function to correctly encode a unicode text for html.</td> -</tr> -<tr> <td><a href="#linesep">linesep</a></td> <td>Function to return the line separator used by the editor.</td> </tr> @@ -178,10 +146,6 @@ <td>Function to read a file, calculate a hash value and decode its contents into proper text.</td> </tr> <tr> -<td><a href="#readStringFromStream">readStringFromStream</a></td> -<td>Module function to read a string from the given stream.</td> -</tr> -<tr> <td><a href="#rxIndex">rxIndex</a></td> <td>Function to get the index (start position) of a regular expression match within some text.</td> </tr> @@ -190,10 +154,6 @@ <td>Function to convert an escaped string to a string containing escape codes.</td> </tr> <tr> -<td><a href="#unescape_uentities">unescape_uentities</a></td> -<td>Function to decode html entities.</td> -</tr> -<tr> <td><a href="#unslash">unslash</a></td> <td>Function to convert a string containing escape codes to an escaped string.</td> </tr> @@ -436,64 +396,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> -<a NAME="decodeBytes" ID="decodeBytes"></a> -<h2>decodeBytes</h2> -<b>decodeBytes</b>(<i>buffer</i>) -<p> - Function to decode some byte text into a string. -</p> - -<dl> - -<dt><i>buffer</i> (bytes)</dt> -<dd> -byte buffer to decode -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decoded text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="decodeString" ID="decodeString"></a> -<h2>decodeString</h2> -<b>decodeString</b>(<i>text</i>) -<p> - Function to decode a string containing Unicode encoded characters. -</p> - -<dl> - -<dt><i>text</i> (str)</dt> -<dd> -text containing encoded chars -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decoded text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="decodeWithEncoding" ID="decodeWithEncoding"></a> <h2>decodeWithEncoding</h2> <b>decodeWithEncoding</b>(<i>text, encoding</i>) @@ -572,68 +474,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> -<a NAME="escape_entities" ID="escape_entities"></a> -<h2>escape_entities</h2> -<b>escape_entities</b>(<i>m, escmap=_escape_map</i>) -<p> - Function to encode html entities. -</p> - -<dl> - -<dt><i>m</i> (re.Match)</dt> -<dd> -the match object -</dd> -<dt><i>escmap</i> (dict)</dt> -<dd> -the map of entities to encode -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the converted text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="escape_uentities" ID="escape_uentities"></a> -<h2>escape_uentities</h2> -<b>escape_uentities</b>(<i>m</i>) -<p> - Function to encode html entities. -</p> - -<dl> - -<dt><i>m</i> (re.Match)</dt> -<dd> -the match object -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the converted text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="extractFlags" ID="extractFlags"></a> <h2>extractFlags</h2> <b>extractFlags</b>(<i>text</i>) @@ -1159,105 +999,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> -<a NAME="html_encode" ID="html_encode"></a> -<h2>html_encode</h2> -<b>html_encode</b>(<i>text, pattern=_escape</i>) -<p> - Function to correctly encode a text for html. -</p> - -<dl> - -<dt><i>text</i> (str)</dt> -<dd> -text to be encoded -</dd> -<dt><i>pattern</i> (str)</dt> -<dd> -search pattern for text to be encoded -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the encoded text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="html_udecode" ID="html_udecode"></a> -<h2>html_udecode</h2> -<b>html_udecode</b>(<i>text, pattern=_uunescape</i>) -<p> - Function to correctly decode a html text to a unicode text. -</p> - -<dl> - -<dt><i>text</i> (str)</dt> -<dd> -text to be decoded -</dd> -<dt><i>pattern</i> (str)</dt> -<dd> -search pattern for text to be decoded -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the decoded text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="html_uencode" ID="html_uencode"></a> -<h2>html_uencode</h2> -<b>html_uencode</b>(<i>text, pattern=_uescape</i>) -<p> - Function to correctly encode a unicode text for html. -</p> - -<dl> - -<dt><i>text</i> (str)</dt> -<dd> -text to be encoded -</dd> -<dt><i>pattern</i> (str)</dt> -<dd> -search pattern for text to be encoded -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the encoded text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="linesep" ID="linesep"></a> <h2>linesep</h2> <b>linesep</b>(<i></i>) @@ -1430,35 +1171,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> -<a NAME="readStringFromStream" ID="readStringFromStream"></a> -<h2>readStringFromStream</h2> -<b>readStringFromStream</b>(<i>stream</i>) -<p> - Module function to read a string from the given stream. -</p> - -<dl> - -<dt><i>stream</i> (QDataStream)</dt> -<dd> -data stream opened for reading -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -string read from the stream -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="rxIndex" ID="rxIndex"></a> <h2>rxIndex</h2> <b>rxIndex</b>(<i>rx, txt</i>) @@ -1525,35 +1237,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> -<a NAME="unescape_uentities" ID="unescape_uentities"></a> -<h2>unescape_uentities</h2> -<b>unescape_uentities</b>(<i>m</i>) -<p> - Function to decode html entities. -</p> - -<dl> - -<dt><i>m</i> (re.Match)</dt> -<dd> -the match object -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -the converted text -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> <a NAME="unslash" ID="unslash"></a> <h2>unslash</h2> <b>unslash</b>(<i>txt</i>)
--- a/src/eric7/Documentation/Source/eric7.Utilities.crypto.__init__.html Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,421 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric7.Utilities.crypto.__init__</title> -<meta charset="UTF-8"> -<link rel="stylesheet" href="styles.css"> -</head> -<body> -<a NAME="top" ID="top"></a> -<h1>eric7.Utilities.crypto.__init__</h1> -<p> -Package implementing cryptography related functionality. -</p> - -<h3>Global Attributes</h3> -<table> -<tr><td>CryptoMarker</td></tr> -<tr><td>Delimiter</td></tr> -<tr><td>EncodeMarker</td></tr> -<tr><td>MainPassword</td></tr> -</table> - -<h3>Classes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Functions</h3> -<table> -<tr> -<td><a href="#__getMainPassword">__getMainPassword</a></td> -<td>Private module function to get the password from the user.</td> -</tr> -<tr> -<td><a href="#changeRememberedMain">changeRememberedMain</a></td> -<td>Module function to change the remembered main password.</td> -</tr> -<tr> -<td><a href="#dataDecrypt">dataDecrypt</a></td> -<td>Module function to decrypt a password.</td> -</tr> -<tr> -<td><a href="#dataEncrypt">dataEncrypt</a></td> -<td>Module function to encrypt a password.</td> -</tr> -<tr> -<td><a href="#pwConvert">pwConvert</a></td> -<td>Module function to convert a plaintext password to the encoded form or vice versa.</td> -</tr> -<tr> -<td><a href="#pwDecode">pwDecode</a></td> -<td>Module function to decode a password.</td> -</tr> -<tr> -<td><a href="#pwDecrypt">pwDecrypt</a></td> -<td>Module function to decrypt a password.</td> -</tr> -<tr> -<td><a href="#pwEncode">pwEncode</a></td> -<td>Module function to encode a password.</td> -</tr> -<tr> -<td><a href="#pwEncrypt">pwEncrypt</a></td> -<td>Module function to encrypt a password.</td> -</tr> -<tr> -<td><a href="#pwRecode">pwRecode</a></td> -<td>Module function to re-encode a password.</td> -</tr> -<tr> -<td><a href="#pwReencrypt">pwReencrypt</a></td> -<td>Module function to re-encrypt a password.</td> -</tr> -</table> - -<hr /> -<hr /> -<a NAME="__getMainPassword" ID="__getMainPassword"></a> -<h2>__getMainPassword</h2> -<b>__getMainPassword</b>(<i></i>) -<p> - Private module function to get the password from the user. -</p> - -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="changeRememberedMain" ID="changeRememberedMain"></a> -<h2>changeRememberedMain</h2> -<b>changeRememberedMain</b>(<i>newPassword</i>) -<p> - Module function to change the remembered main password. -</p> - -<dl> - -<dt><i>newPassword</i> (str)</dt> -<dd> -new password to be used -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="dataDecrypt" ID="dataDecrypt"></a> -<h2>dataDecrypt</h2> -<b>dataDecrypt</b>(<i>edata, password, keyLength=32</i>) -<p> - Module function to decrypt a password. -</p> - -<dl> - -<dt><i>edata</i> (str)</dt> -<dd> -hashed data to decrypt -</dd> -<dt><i>password</i> (str)</dt> -<dd> -password to be used for decryption -</dd> -<dt><i>keyLength</i> (int)</dt> -<dd> -length of the key to be generated for decryption (16, 24 or 32) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decrypted data (bytes) and flag indicating success -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="dataEncrypt" ID="dataEncrypt"></a> -<h2>dataEncrypt</h2> -<b>dataEncrypt</b>(<i>data, password, keyLength=32, hashIterations=10000</i>) -<p> - Module function to encrypt a password. -</p> - -<dl> - -<dt><i>data</i> (bytes)</dt> -<dd> -data to encrypt -</dd> -<dt><i>password</i> (str)</dt> -<dd> -password to be used for encryption -</dd> -<dt><i>keyLength</i> (int)</dt> -<dd> -length of the key to be generated for encryption (16, 24 or 32) -</dd> -<dt><i>hashIterations</i> (int)</dt> -<dd> -number of hashes to be applied to the password for - generating the encryption key -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encrypted data (bytes) and flag indicating success -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwConvert" ID="pwConvert"></a> -<h2>pwConvert</h2> -<b>pwConvert</b>(<i>pw, encode=True</i>) -<p> - Module function to convert a plaintext password to the encoded form or - vice versa. -</p> -<p> - If there is an error, an empty code is returned for the encode function - or the given encoded password for the decode function. -</p> - -<dl> - -<dt><i>pw</i> (str)</dt> -<dd> -password to encode -</dd> -<dt><i>encode</i> (bool)</dt> -<dd> -flag indicating an encode or decode function -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encoded or decoded password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwDecode" ID="pwDecode"></a> -<h2>pwDecode</h2> -<b>pwDecode</b>(<i>epw</i>) -<p> - Module function to decode a password. -</p> - -<dl> - -<dt><i>epw</i> (str)</dt> -<dd> -encoded password to decode -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decoded password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwDecrypt" ID="pwDecrypt"></a> -<h2>pwDecrypt</h2> -<b>pwDecrypt</b>(<i>epw, mainPW=None</i>) -<p> - Module function to decrypt a password. -</p> - -<dl> - -<dt><i>epw</i> (str)</dt> -<dd> -hashed password to decrypt -</dd> -<dt><i>mainPW</i> (str)</dt> -<dd> -password to be used for decryption -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decrypted password (string) and flag indicating success -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwEncode" ID="pwEncode"></a> -<h2>pwEncode</h2> -<b>pwEncode</b>(<i>pw</i>) -<p> - Module function to encode a password. -</p> - -<dl> - -<dt><i>pw</i> (str)</dt> -<dd> -password to encode -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encoded password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwEncrypt" ID="pwEncrypt"></a> -<h2>pwEncrypt</h2> -<b>pwEncrypt</b>(<i>pw, mainPW=None</i>) -<p> - Module function to encrypt a password. -</p> - -<dl> - -<dt><i>pw</i> (str)</dt> -<dd> -password to encrypt -</dd> -<dt><i>mainPW</i> (str)</dt> -<dd> -password to be used for encryption -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encrypted password (string) and flag indicating success -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwRecode" ID="pwRecode"></a> -<h2>pwRecode</h2> -<b>pwRecode</b>(<i>epw, oldPassword, newPassword</i>) -<p> - Module function to re-encode a password. -</p> -<p> - In case of an error the encoded password is returned unchanged. -</p> - -<dl> - -<dt><i>epw</i> (str)</dt> -<dd> -encoded password to re-encode -</dd> -<dt><i>oldPassword</i> (str)</dt> -<dd> -password used to encode -</dd> -<dt><i>newPassword</i> (str)</dt> -<dd> -new password to be used -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encoded password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pwReencrypt" ID="pwReencrypt"></a> -<h2>pwReencrypt</h2> -<b>pwReencrypt</b>(<i>epw, oldPassword, newPassword</i>) -<p> - Module function to re-encrypt a password. -</p> - -<dl> - -<dt><i>epw</i> (str)</dt> -<dd> -hashed password to re-encrypt -</dd> -<dt><i>oldPassword</i> (str)</dt> -<dd> -password used to encrypt -</dd> -<dt><i>newPassword</i> (str)</dt> -<dd> -new password to be used -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encrypted password (string) and flag indicating success -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html>
--- a/src/eric7/Documentation/Source/eric7.Utilities.crypto.py3AES.html Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1156 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric7.Utilities.crypto.py3AES</title> -<meta charset="UTF-8"> -<link rel="stylesheet" href="styles.css"> -</head> -<body> -<a NAME="top" ID="top"></a> -<h1>eric7.Utilities.crypto.py3AES</h1> -<p> -Module implementing classes for encryption according -Advanced Encryption Standard. -</p> - -<h3>Global Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Classes</h3> -<table> -<tr> -<td><a href="#AES">AES</a></td> -<td>Class implementing the Advanced Encryption Standard algorithm.</td> -</tr> -<tr> -<td><a href="#AESModeOfOperation">AESModeOfOperation</a></td> -<td>Class implementing the different AES mode of operations.</td> -</tr> -</table> - -<h3>Functions</h3> -<table> -<tr> -<td><a href="#append_PKCS7_padding">append_PKCS7_padding</a></td> -<td>Function to pad the given data to a multiple of 16-bytes by PKCS7 padding.</td> -</tr> -<tr> -<td><a href="#decryptData">decryptData</a></td> -<td>Module function to decrypt the given data with the given key.</td> -</tr> -<tr> -<td><a href="#encryptData">encryptData</a></td> -<td>Module function to encrypt the given data with the given key.</td> -</tr> -<tr> -<td><a href="#strip_PKCS7_padding">strip_PKCS7_padding</a></td> -<td>Function to strip off PKCS7 padding.</td> -</tr> -</table> - -<hr /> -<hr /> -<a NAME="AES" ID="AES"></a> -<h2>AES</h2> -<p> - Class implementing the Advanced Encryption Standard algorithm. -</p> - -<h3>Derived from</h3> -None -<h3>Class Attributes</h3> -<table> -<tr><td>KeySize</td></tr> -<tr><td>Rcon</td></tr> -<tr><td>rsbox</td></tr> -<tr><td>sbox</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#AES.__addRoundKey">__addRoundKey</a></td> -<td>Private method to add (XORs) the round key to the state.</td> -</tr> -<tr> -<td><a href="#AES.__aes_invMain">__aes_invMain</a></td> -<td>Private method to do the inverse AES encryption for one round.</td> -</tr> -<tr> -<td><a href="#AES.__aes_invRound">__aes_invRound</a></td> -<td>Private method to apply the 4 operations of the inverse round in sequence.</td> -</tr> -<tr> -<td><a href="#AES.__aes_main">__aes_main</a></td> -<td>Private method to do the AES encryption for one round.</td> -</tr> -<tr> -<td><a href="#AES.__aes_round">__aes_round</a></td> -<td>Private method to apply the 4 operations of the forward round in sequence.</td> -</tr> -<tr> -<td><a href="#AES.__core">__core</a></td> -<td>Private method performing the key schedule core operation.</td> -</tr> -<tr> -<td><a href="#AES.__createRoundKey">__createRoundKey</a></td> -<td>Private method to create a round key.</td> -</tr> -<tr> -<td><a href="#AES.__expandKey">__expandKey</a></td> -<td>Private method performing Rijndael's key expansion.</td> -</tr> -<tr> -<td><a href="#AES.__galois_multiplication">__galois_multiplication</a></td> -<td>Private method to perform a Galois multiplication of 8 bit characters a and b.</td> -</tr> -<tr> -<td><a href="#AES.__getRconValue">__getRconValue</a></td> -<td>Private method to retrieve a given Rcon value.</td> -</tr> -<tr> -<td><a href="#AES.__getSBoxInvert">__getSBoxInvert</a></td> -<td>Private method to retrieve a given Inverted S-Box value.</td> -</tr> -<tr> -<td><a href="#AES.__getSBoxValue">__getSBoxValue</a></td> -<td>Private method to retrieve a given S-Box value.</td> -</tr> -<tr> -<td><a href="#AES.__mixColumn">__mixColumn</a></td> -<td>Private method to perform a galois multiplication of 1 column the 4x4 matrix.</td> -</tr> -<tr> -<td><a href="#AES.__mixColumns">__mixColumns</a></td> -<td>Private method to perform a galois multiplication of the 4x4 matrix.</td> -</tr> -<tr> -<td><a href="#AES.__rotate">__rotate</a></td> -<td>Private method performing Rijndael's key schedule rotate operation.</td> -</tr> -<tr> -<td><a href="#AES.__shiftRow">__shiftRow</a></td> -<td>Private method to shift the bytes of a row to the left.</td> -</tr> -<tr> -<td><a href="#AES.__shiftRows">__shiftRows</a></td> -<td>Private method to iterate over the 4 rows and call __shiftRow() with that row.</td> -</tr> -<tr> -<td><a href="#AES.__subBytes">__subBytes</a></td> -<td>Private method to substitute all the values from the state with the value in the SBox using the state value as index for the SBox.</td> -</tr> -<tr> -<td><a href="#AES.decrypt">decrypt</a></td> -<td>Public method to decrypt a 128 bit input block against the given key of size specified.</td> -</tr> -<tr> -<td><a href="#AES.encrypt">encrypt</a></td> -<td>Public method to encrypt a 128 bit input block against the given key of size specified.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="AES.__addRoundKey" ID="AES.__addRoundKey"></a> -<h4>AES.__addRoundKey</h4> -<b>__addRoundKey</b>(<i>state, roundKey</i>) -<p> - Private method to add (XORs) the round key to the state. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be changed -</dd> -<dt><i>roundKey</i> (bytearray)</dt> -<dd> -key to be used for the modification -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__aes_invMain" ID="AES.__aes_invMain"></a> -<h4>AES.__aes_invMain</h4> -<b>__aes_invMain</b>(<i>state, expandedKey, nbrRounds</i>) -<p> - Private method to do the inverse AES encryption for one round. -</p> -<p> - Perform the initial operations, the standard round, and the - final operations of the inverse AES, creating a round key for - each round. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>expandedKey</i> (bytearray)</dt> -<dd> -expanded key to be used -</dd> -<dt><i>nbrRounds</i> (int)</dt> -<dd> -number of rounds to be done -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__aes_invRound" ID="AES.__aes_invRound"></a> -<h4>AES.__aes_invRound</h4> -<b>__aes_invRound</b>(<i>state, roundKey</i>) -<p> - Private method to apply the 4 operations of the inverse round in - sequence. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>roundKey</i> (bytearray)</dt> -<dd> -round key to be used -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__aes_main" ID="AES.__aes_main"></a> -<h4>AES.__aes_main</h4> -<b>__aes_main</b>(<i>state, expandedKey, nbrRounds</i>) -<p> - Private method to do the AES encryption for one round. -</p> -<p> - Perform the initial operations, the standard round, and the - final operations of the forward AES, creating a round key for - each round. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>expandedKey</i> (bytearray)</dt> -<dd> -expanded key to be used -</dd> -<dt><i>nbrRounds</i> (int)</dt> -<dd> -number of rounds to be done -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__aes_round" ID="AES.__aes_round"></a> -<h4>AES.__aes_round</h4> -<b>__aes_round</b>(<i>state, roundKey</i>) -<p> - Private method to apply the 4 operations of the forward round in - sequence. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>roundKey</i> (bytearray)</dt> -<dd> -round key to be used -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__core" ID="AES.__core"></a> -<h4>AES.__core</h4> -<b>__core</b>(<i>data, iteration</i>) -<p> - Private method performing the key schedule core operation. -</p> - -<dl> - -<dt><i>data</i> (bytearray)</dt> -<dd> -data to operate on -</dd> -<dt><i>iteration</i> (int)</dt> -<dd> -iteration counter -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__createRoundKey" ID="AES.__createRoundKey"></a> -<h4>AES.__createRoundKey</h4> -<b>__createRoundKey</b>(<i>expandedKey, roundKeyPointer</i>) -<p> - Private method to create a round key. -</p> - -<dl> - -<dt><i>expandedKey</i> (bytearray)</dt> -<dd> -expanded key to be used -</dd> -<dt><i>roundKeyPointer</i> (int)</dt> -<dd> -position within the expanded key -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -round key -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__expandKey" ID="AES.__expandKey"></a> -<h4>AES.__expandKey</h4> -<b>__expandKey</b>(<i>key, size, expandedKeySize</i>) -<p> - Private method performing Rijndael's key expansion. -</p> -<p> - Expands a 128, 192 or 256 bit key into a 176, 208 or 240 bit key. -</p> - -<dl> - -<dt><i>key</i> (bytes or bytearray)</dt> -<dd> -key to be expanded -</dd> -<dt><i>size</i> (int)</dt> -<dd> -size of the key in bytes (16, 24 or 32) -</dd> -<dt><i>expandedKeySize</i> (int)</dt> -<dd> -size of the expanded key -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -expanded key -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__galois_multiplication" ID="AES.__galois_multiplication"></a> -<h4>AES.__galois_multiplication</h4> -<b>__galois_multiplication</b>(<i>a, b</i>) -<p> - Private method to perform a Galois multiplication of 8 bit characters - a and b. -</p> - -<dl> - -<dt><i>a</i> (bytes)</dt> -<dd> -first factor -</dd> -<dt><i>b</i> (bytes)</dt> -<dd> -second factor -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -result -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<a NAME="AES.__getRconValue" ID="AES.__getRconValue"></a> -<h4>AES.__getRconValue</h4> -<b>__getRconValue</b>(<i>num</i>) -<p> - Private method to retrieve a given Rcon value. -</p> - -<dl> - -<dt><i>num</i> (int)</dt> -<dd> -position of the value -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -Rcon value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl> -<a NAME="AES.__getSBoxInvert" ID="AES.__getSBoxInvert"></a> -<h4>AES.__getSBoxInvert</h4> -<b>__getSBoxInvert</b>(<i>num</i>) -<p> - Private method to retrieve a given Inverted S-Box value. -</p> - -<dl> - -<dt><i>num</i> (int)</dt> -<dd> -position of the value -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -value of the Inverted S-Box -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl> -<a NAME="AES.__getSBoxValue" ID="AES.__getSBoxValue"></a> -<h4>AES.__getSBoxValue</h4> -<b>__getSBoxValue</b>(<i>num</i>) -<p> - Private method to retrieve a given S-Box value. -</p> - -<dl> - -<dt><i>num</i> (int)</dt> -<dd> -position of the value -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -value of the S-Box -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl> -<a NAME="AES.__mixColumn" ID="AES.__mixColumn"></a> -<h4>AES.__mixColumn</h4> -<b>__mixColumn</b>(<i>column, isInv</i>) -<p> - Private method to perform a galois multiplication of 1 column the - 4x4 matrix. -</p> - -<dl> - -<dt><i>column</i> (bytearray)</dt> -<dd> -column to be worked on -</dd> -<dt><i>isInv</i> (bool)</dt> -<dd> -flag indicating an inverse operation -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified column -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__mixColumns" ID="AES.__mixColumns"></a> -<h4>AES.__mixColumns</h4> -<b>__mixColumns</b>(<i>state, isInv</i>) -<p> - Private method to perform a galois multiplication of the 4x4 matrix. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>isInv</i> (bool)</dt> -<dd> -flag indicating an inverse operation -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__rotate" ID="AES.__rotate"></a> -<h4>AES.__rotate</h4> -<b>__rotate</b>(<i>data</i>) -<p> - Private method performing Rijndael's key schedule rotate operation. -</p> -<p> - Rotate the data word eight bits to the left: eg, - rotate(1d2c3a4f) == 2c3a4f1d. -</p> - -<dl> - -<dt><i>data</i> (bytearray)</dt> -<dd> -data of size 4 -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -rotated data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__shiftRow" ID="AES.__shiftRow"></a> -<h4>AES.__shiftRow</h4> -<b>__shiftRow</b>(<i>state, statePointer, nbr, isInv</i>) -<p> - Private method to shift the bytes of a row to the left. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>statePointer</i> (int)</dt> -<dd> -index into the state -</dd> -<dt><i>nbr</i> (int)</dt> -<dd> -number of positions to shift -</dd> -<dt><i>isInv</i> (bool)</dt> -<dd> -flag indicating an inverse operation -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__shiftRows" ID="AES.__shiftRows"></a> -<h4>AES.__shiftRows</h4> -<b>__shiftRows</b>(<i>state, isInv</i>) -<p> - Private method to iterate over the 4 rows and call __shiftRow() with - that row. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>isInv</i> (bool)</dt> -<dd> -flag indicating an inverse operation -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.__subBytes" ID="AES.__subBytes"></a> -<h4>AES.__subBytes</h4> -<b>__subBytes</b>(<i>state, isInv</i>) -<p> - Private method to substitute all the values from the state with the - value in the SBox using the state value as index for the SBox. -</p> - -<dl> - -<dt><i>state</i> (bytearray)</dt> -<dd> -state to be worked on -</dd> -<dt><i>isInv</i> (bool)</dt> -<dd> -flag indicating an inverse operation -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -modified state -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AES.decrypt" ID="AES.decrypt"></a> -<h4>AES.decrypt</h4> -<b>decrypt</b>(<i>iput, key, size</i>) -<p> - Public method to decrypt a 128 bit input block against the given key - of size specified. -</p> - -<dl> - -<dt><i>iput</i> (bytearray)</dt> -<dd> -input data -</dd> -<dt><i>key</i> (bytes or bytearray)</dt> -<dd> -key to be used -</dd> -<dt><i>size</i> (int)</dt> -<dd> -key size (16, 24 or 32) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decrypted data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -key size is invalid -</dd> -</dl> -<a NAME="AES.encrypt" ID="AES.encrypt"></a> -<h4>AES.encrypt</h4> -<b>encrypt</b>(<i>iput, key, size</i>) -<p> - Public method to encrypt a 128 bit input block against the given key - of size specified. -</p> - -<dl> - -<dt><i>iput</i> (bytearray)</dt> -<dd> -input data -</dd> -<dt><i>key</i> (bytes or bytearray)</dt> -<dd> -key to be used -</dd> -<dt><i>size</i> (int)</dt> -<dd> -key size (16, 24 or 32) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encrypted data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -key size is invalid -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="AESModeOfOperation" ID="AESModeOfOperation"></a> -<h2>AESModeOfOperation</h2> -<p> - Class implementing the different AES mode of operations. -</p> - -<h3>Derived from</h3> -None -<h3>Class Attributes</h3> -<table> -<tr><td>ModeOfOperation</td></tr> -<tr><td>aes</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#AESModeOfOperation.__extractBytes">__extractBytes</a></td> -<td>Private method to extract a range of bytes from the input.</td> -</tr> -<tr> -<td><a href="#AESModeOfOperation.decrypt">decrypt</a></td> -<td>Public method to perform the decryption operation.</td> -</tr> -<tr> -<td><a href="#AESModeOfOperation.encrypt">encrypt</a></td> -<td>Public method to perform the encryption operation.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="AESModeOfOperation.__extractBytes" ID="AESModeOfOperation.__extractBytes"></a> -<h4>AESModeOfOperation.__extractBytes</h4> -<b>__extractBytes</b>(<i>inputData, start, end, mode</i>) -<p> - Private method to extract a range of bytes from the input. -</p> - -<dl> - -<dt><i>inputData</i> (bytes)</dt> -<dd> -input data -</dd> -<dt><i>start</i> (int)</dt> -<dd> -start index -</dd> -<dt><i>end</i> (int)</dt> -<dd> -end index -</dd> -<dt><i>mode</i> (int)</dt> -<dd> -mode of operation (0, 1, 2) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -extracted bytes -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytearray -</dd> -</dl> -<a NAME="AESModeOfOperation.decrypt" ID="AESModeOfOperation.decrypt"></a> -<h4>AESModeOfOperation.decrypt</h4> -<b>decrypt</b>(<i>cipherIn, originalsize, mode, key, size, IV</i>) -<p> - Public method to perform the decryption operation. -</p> - -<dl> - -<dt><i>cipherIn</i> (bytes)</dt> -<dd> -data to be decrypted -</dd> -<dt><i>originalsize</i> (int)</dt> -<dd> -unencrypted string length (required for CBC) -</dd> -<dt><i>mode</i> (int)</dt> -<dd> -mode of operation (0, 1 or 2) -</dd> -<dt><i>key</i> (bytes)</dt> -<dd> -key to be used -</dd> -<dt><i>size</i> (int)</dt> -<dd> -length of the key (16, 24 or 32) -</dd> -<dt><i>IV</i> (bytearray)</dt> -<dd> -initialisation vector -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decrypted data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -key size is invalid or decrypted data is invalid -</dd> -</dl> -<a NAME="AESModeOfOperation.encrypt" ID="AESModeOfOperation.encrypt"></a> -<h4>AESModeOfOperation.encrypt</h4> -<b>encrypt</b>(<i>inputData, mode, key, size, IV</i>) -<p> - Public method to perform the encryption operation. -</p> - -<dl> - -<dt><i>inputData</i> (bytes)</dt> -<dd> -data to be encrypted -</dd> -<dt><i>mode</i> (int)</dt> -<dd> -mode of operation (0, 1 or 2) -</dd> -<dt><i>key</i> (bytes)</dt> -<dd> -key to be used -</dd> -<dt><i>size</i> (int)</dt> -<dd> -length of the key (16, 24 or 32) -</dd> -<dt><i>IV</i> (bytearray)</dt> -<dd> -initialisation vector -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple with mode of operation, length of the input data and - the encrypted data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (int, int, bytes) -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -key size is invalid or decrypted data is invalid -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="append_PKCS7_padding" ID="append_PKCS7_padding"></a> -<h2>append_PKCS7_padding</h2> -<b>append_PKCS7_padding</b>(<i>b</i>) -<p> - Function to pad the given data to a multiple of 16-bytes by PKCS7 padding. -</p> - -<dl> - -<dt><i>b</i> (bytes)</dt> -<dd> -data to be padded -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -padded data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="decryptData" ID="decryptData"></a> -<h2>decryptData</h2> -<b>decryptData</b>(<i>key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]</i>) -<p> - Module function to decrypt the given data with the given key. -</p> - -<dl> - -<dt><i>key</i> (bytes)</dt> -<dd> -key to be used for decryption -</dd> -<dt><i>data</i> (bytes)</dt> -<dd> -data to be decrypted (with initialization vector prepended) -</dd> -<dt><i>mode</i> (int)</dt> -<dd> -mode of operations (0, 1 or 2) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -decrypted data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -raised to indicate an invalid key size -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="encryptData" ID="encryptData"></a> -<h2>encryptData</h2> -<b>encryptData</b>(<i>key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]</i>) -<p> - Module function to encrypt the given data with the given key. -</p> - -<dl> - -<dt><i>key</i> (bytes)</dt> -<dd> -key to be used for encryption -</dd> -<dt><i>data</i> (bytes)</dt> -<dd> -data to be encrypted -</dd> -<dt><i>mode</i> (int)</dt> -<dd> -mode of operations (0, 1 or 2) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -encrypted data prepended with the initialization vector -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -raised to indicate an invalid key size -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="strip_PKCS7_padding" ID="strip_PKCS7_padding"></a> -<h2>strip_PKCS7_padding</h2> -<b>strip_PKCS7_padding</b>(<i>b</i>) -<p> - Function to strip off PKCS7 padding. -</p> - -<dl> - -<dt><i>b</i> (bytes)</dt> -<dd> -data to be stripped -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -stripped data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -data padding is invalid -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html>
--- a/src/eric7/Documentation/Source/eric7.Utilities.crypto.py3PBKDF2.html Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric7.Utilities.crypto.py3PBKDF2</title> -<meta charset="UTF-8"> -<link rel="stylesheet" href="styles.css"> -</head> -<body> -<a NAME="top" ID="top"></a> -<h1>eric7.Utilities.crypto.py3PBKDF2</h1> -<p> -Module implementing PBKDF2 functions. -</p> - -<h3>Global Attributes</h3> -<table> -<tr><td>Delimiter</td></tr> -<tr><td>Hashes</td></tr> -</table> - -<h3>Classes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Functions</h3> -<table> -<tr> -<td><a href="#hashPassword">hashPassword</a></td> -<td>Module function to hash a password according to the PBKDF2 specification.</td> -</tr> -<tr> -<td><a href="#hashPasswordTuple">hashPasswordTuple</a></td> -<td>Module function to hash a password according to the PBKDF2 specification.</td> -</tr> -<tr> -<td><a href="#pbkdf2">pbkdf2</a></td> -<td>Module function to hash a password according to the PBKDF2 specification.</td> -</tr> -<tr> -<td><a href="#rehashPassword">rehashPassword</a></td> -<td>Module function to recreate a password hash given the hash parameters.</td> -</tr> -<tr> -<td><a href="#verifyPassword">verifyPassword</a></td> -<td>Module function to verify a password against a hash encoded password.</td> -</tr> -</table> - -<hr /> -<hr /> -<a NAME="hashPassword" ID="hashPassword"></a> -<h2>hashPassword</h2> -<b>hashPassword</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>) -<p> - Module function to hash a password according to the PBKDF2 specification. -</p> - -<dl> - -<dt><i>password</i> (str)</dt> -<dd> -clear text password -</dd> -<dt><i>digestMod</i> (function)</dt> -<dd> -hash function -</dd> -<dt><i>iterations</i> (int)</dt> -<dd> -number of times hash function should be applied -</dd> -<dt><i>saltSize</i> (int)</dt> -<dd> -size of the salt -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -hashed password entry according to PBKDF2 specification -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="hashPasswordTuple" ID="hashPasswordTuple"></a> -<h2>hashPasswordTuple</h2> -<b>hashPasswordTuple</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>) -<p> - Module function to hash a password according to the PBKDF2 specification. -</p> - -<dl> - -<dt><i>password</i> (str)</dt> -<dd> -clear text password -</dd> -<dt><i>digestMod</i> (function)</dt> -<dd> -hash function -</dd> -<dt><i>iterations</i> (int)</dt> -<dd> -number of times hash function should be applied -</dd> -<dt><i>saltSize</i> (int)</dt> -<dd> -size of the salt -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple of digestname, number of iterations, salt and hashed password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (str, int, bytes, bytes) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="pbkdf2" ID="pbkdf2"></a> -<h2>pbkdf2</h2> -<b>pbkdf2</b>(<i>password, salt, iterations, digestMod</i>) -<p> - Module function to hash a password according to the PBKDF2 specification. -</p> - -<dl> - -<dt><i>password</i> (bytes)</dt> -<dd> -clear text password -</dd> -<dt><i>salt</i> (bytes)</dt> -<dd> -salt value -</dd> -<dt><i>iterations</i> (int)</dt> -<dd> -number of times hash function should be applied -</dd> -<dt><i>digestMod</i> (function)</dt> -<dd> -hash function -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -hashed password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="rehashPassword" ID="rehashPassword"></a> -<h2>rehashPassword</h2> -<b>rehashPassword</b>(<i>password, hashParameters</i>) -<p> - Module function to recreate a password hash given the hash parameters. -</p> - -<dl> - -<dt><i>password</i> (str)</dt> -<dd> -clear text password -</dd> -<dt><i>hashParameters</i> (str)</dt> -<dd> -hash parameters in the form - 'digestmod$iterations$salt' -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -hashed password -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bytes -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -the hash parameters string is not of the expected - format or the digest is not one of the known ones -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="verifyPassword" ID="verifyPassword"></a> -<h2>verifyPassword</h2> -<b>verifyPassword</b>(<i>password, pwHash</i>) -<p> - Module function to verify a password against a hash encoded password. -</p> - -<dl> - -<dt><i>password</i> (str)</dt> -<dd> -clear text password -</dd> -<dt><i>pwHash</i> (str)</dt> -<dd> -hash encoded password in the form - 'digestmod$iterations$salt$hashed_password' as produced by the - hashPassword function -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -flag indicating a successfull verification -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -the hash is not of the expected format or the - digest is not one of the known ones -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html>
--- a/src/eric7/Documentation/Source/index-eric7.EricCore.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/index-eric7.EricCore.html Thu Sep 26 15:49:36 2024 +0200 @@ -23,6 +23,10 @@ <td>Module implementing a QFileSystemWatcher replacement based on the 'watchdog' package.</td> </tr> <tr> +<td><a href="eric7.EricCore.EricPreferences.html">EricPreferences</a></td> +<td>Module implementing the preferences for the eric library.</td> +</tr> +<tr> <td><a href="eric7.EricCore.EricProcess.html">EricProcess</a></td> <td>Module implementing a QProcess derived class with a timeout and convenience signals.</td> </tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/index-eric7.EricUtilities.crypto.html Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.EricUtilities.crypto</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<h1>eric7.EricUtilities.crypto</h1> +<p> +Package implementing cryptography related functionality. +</p> + + + +<h3>Modules</h3> +<table> + +<tr> +<td><a href="eric7.EricUtilities.crypto.__init__.html">crypto</a></td> +<td>Package implementing cryptography related functionality.</td> +</tr> +<tr> +<td><a href="eric7.EricUtilities.crypto.py3AES.html">py3AES</a></td> +<td>Module implementing classes for encryption according Advanced Encryption Standard.</td> +</tr> +<tr> +<td><a href="eric7.EricUtilities.crypto.py3PBKDF2.html">py3PBKDF2</a></td> +<td>Module implementing PBKDF2 functions.</td> +</tr> +</table> +</body></html>
--- a/src/eric7/Documentation/Source/index-eric7.EricUtilities.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/index-eric7.EricUtilities.html Thu Sep 26 15:49:36 2024 +0200 @@ -11,6 +11,14 @@ </p> +<h3>Packages</h3> +<table> + +<tr> +<td><a href="index-eric7.EricUtilities.crypto.html">crypto</a></td> +<td>Package implementing cryptography related functionality.</td> +</tr> +</table> <h3>Modules</h3> <table>
--- a/src/eric7/Documentation/Source/index-eric7.Utilities.crypto.html Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric7.Utilities.crypto</title> -<meta charset="UTF-8"> -<link rel="stylesheet" href="styles.css"> -</head> -<body> -<h1>eric7.Utilities.crypto</h1> -<p> -Package implementing cryptography related functionality. -</p> - - - -<h3>Modules</h3> -<table> - -<tr> -<td><a href="eric7.Utilities.crypto.__init__.html">crypto</a></td> -<td>Package implementing cryptography related functionality.</td> -</tr> -<tr> -<td><a href="eric7.Utilities.crypto.py3AES.html">py3AES</a></td> -<td>Module implementing classes for encryption according Advanced Encryption Standard.</td> -</tr> -<tr> -<td><a href="eric7.Utilities.crypto.py3PBKDF2.html">py3PBKDF2</a></td> -<td>Module implementing PBKDF2 functions.</td> -</tr> -</table> -</body></html>
--- a/src/eric7/Documentation/Source/index-eric7.Utilities.html Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Documentation/Source/index-eric7.Utilities.html Thu Sep 26 15:49:36 2024 +0200 @@ -18,10 +18,6 @@ <td><a href="index-eric7.Utilities.ClassBrowsers.html">ClassBrowsers</a></td> <td>Package implementing class browsers for various languages.</td> </tr> -<tr> -<td><a href="index-eric7.Utilities.crypto.html">crypto</a></td> -<td>Package implementing cryptography related functionality.</td> -</tr> </table> <h3>Modules</h3>
--- a/src/eric7/DocumentationTools/ModuleDocumentor.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/DocumentationTools/ModuleDocumentor.py Thu Sep 26 15:49:36 2024 +0200 @@ -15,7 +15,7 @@ import re import sys -from eric7.Utilities import html_uencode +from eric7.EricUtilities import html_uencode from eric7.Utilities.ModuleParser import RB_SOURCE, Function from . import TemplatesListsStyleCSS
--- a/src/eric7/DocumentationTools/QtHelpGenerator.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/DocumentationTools/QtHelpGenerator.py Thu Sep 26 15:49:36 2024 +0200 @@ -14,8 +14,8 @@ import sys from eric7 import Preferences +from eric7.EricUtilities import html_encode from eric7.SystemUtilities import FileSystemUtilities, QtUtilities -from eric7.Utilities import html_encode HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?> <QHelpCollectionProject version="1.0">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/EricCore/EricPreferences.py Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,202 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the preferences for the eric library. +""" + +import sys + +from PyQt6.QtCore import QCoreApplication, QDir, QSettings + +from eric7 import EricUtilities +from eric7.EricNetwork.EricFtp import EricFtpProxyType +from eric7.EricUtilities.crypto import pwConvert + +# names of the various settings objects +_settingsNameOrganization = "Eric7" +_settingsNameGlobal = "eric7-lib" + + +class EricPreferences: + """ + A class to hold all configuration items. + """ + + # defaults for network proxy settings + proxyDefaults = { + "UseProxy": False, + "UseSystemProxy": True, + "UseHttpProxyForAll": False, + "ProxyHost/Http": "", + "ProxyHost/Https": "", + "ProxyHost/Ftp": "", + "ProxyPort/Http": 80, + "ProxyPort/Https": 443, + "ProxyPort/Ftp": 21, + "ProxyUser/Http": "", + "ProxyUser/Https": "", + "ProxyUser/Ftp": "", + "ProxyPassword/Http": "", + "ProxyPassword/Https": "", + "ProxyPassword/Ftp": "", + "ProxyType/Ftp": EricFtpProxyType.NO_PROXY, + "ProxyAccount/Ftp": "", + "ProxyExceptions": "localhost,127.0.0.,::1", + } + + +################################################################################ +## Functions dealing with the preferences class. +################################################################################ + + +def initPreferences(): + """ + Function to initialize the central configuration store. + """ + EricPreferences.settings = QSettings( + QSettings.Format.IniFormat, + QSettings.Scope.UserScope, + _settingsNameOrganization, + _settingsNameGlobal, + QCoreApplication.instance(), + ) + if not sys.platform.startswith(("win", "cygwin")): + hp = QDir.homePath() + dn = QDir(hp) + dn.mkdir(".eric7") + + EricPreferences.settings.value("NetworkProxy/ProxyExceptions") + + +def syncPreferences(): + """ + Module function to sync the preferences to disk. + + In addition to syncing, the central configuration store is reinitialized + as well. + """ + EricPreferences.settings.sync() + + +################################################################################ +## Functions dealing with the preferences categories. +################################################################################ + + +def getNetworkProxy(key): + """ + Function to retrieve the various Network Proxy related settings. + + @param key the key of the value to get + @type str + @return the requested network proxy setting + @rtype Any + """ + if key in ( + "UseProxy", + "UseSystemProxy", + "UseHttpProxyForAll", + ): + return EricUtilities.toBool( + EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key] + ) + ) + + elif key in ( + "ProxyPort/Http", + "ProxyPort/Https", + "ProxyPort/Ftp", + ): + return int( + EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key] + ) + ) + + elif key in ("ProxyType/Ftp",): + return EricFtpProxyType( + int( + EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key].value + ) + ) + ) + + elif key in ( + "ProxyPassword/Http", + "ProxyPassword/Https", + "ProxyPassword/Ftp", + ): + return pwConvert( + EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key] + ), + encode=False, + ) + + else: + return EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key] + ) + + +def setNetworkProxy(key, value): + """ + Function to store the various Network Proxy settings. + + @param key the key of the setting to be set + @type str + @param value the value to be set + @type Any + """ + if key in ( + "ProxyPassword/Http", + "ProxyPassword/Https", + "ProxyPassword/Ftp", + ): + EricPreferences.settings.setValue( + "NetworkProxy/" + key, pwConvert(value, encode=True) + ) + elif key in ("ProxyType/Ftp",): + # value is an enum.Enum derived item + EricPreferences.settings.setValue("NetworkProxy/" + key, value.value) + else: + EricPreferences.settings.setValue("NetworkProxy/" + key, value) + + +################################################################################ +## Functions dealing with passwords. +################################################################################ + + +def convertPasswords(oldPassword, newPassword): + """ + Module function to convert all passwords. + + @param oldPassword current password + @type str + @param newPassword new password + @type str + """ + from eric7.EricUtilities.crypto import pwRecode + + for key in [ + "ProxyPassword/Http", + "ProxyPassword/Https", + "ProxyPassword/Ftp", + ]: + EricPreferences.settings.setValue( + "NetworkProxy/" + key, + pwRecode( + EricPreferences.settings.value( + "NetworkProxy/" + key, EricPreferences.proxyDefaults[key] + ), + oldPassword, + newPassword, + ), + )
--- a/src/eric7/EricNetwork/EricGoogleMailHelpers.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricGoogleMailHelpers.py Thu Sep 26 15:49:36 2024 +0200 @@ -7,12 +7,9 @@ Module implementing some helpers for Google mail. """ +import contextlib import os -from eric7 import EricUtilities -from eric7.EricWidgets.EricApplication import ericApp -from eric7.SystemUtilities import PythonUtilities - SCOPES = ["https://www.googleapis.com/auth/gmail.send"] CLIENT_SECRET_FILE = "eric_client_secret.json" # secok TOKEN_FILE = "eric_python_email_send_token.json" # secok @@ -32,6 +29,8 @@ @return flag indicating, that the credentials file is there @rtype bool """ + from eric7 import EricUtilities + return os.path.exists( os.path.join(EricUtilities.getConfigDir(), CLIENT_SECRET_FILE) ) @@ -41,10 +40,14 @@ """ Module function to install the required packages to support Google mail. """ - pip = ericApp().getObject("Pip") - pip.installPackages( - RequiredPackages, interpreter=PythonUtilities.getPythonExecutable() - ) + with contextlib.suppress(ImportError, KeyError): + from eric7.EricWidgets.EricApplication import ericApp # noqa: I101 + from eric7.SystemUtilities import PythonUtilities # noqa: I101 + + pip = ericApp().getObject("Pip") + pip.installPackages( + RequiredPackages, interpreter=PythonUtilities.getPythonExecutable() + ) #
--- a/src/eric7/EricNetwork/EricJsonServer.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricJsonServer.py Thu Sep 26 15:49:36 2024 +0200 @@ -9,6 +9,7 @@ import contextlib import json +import shutil import struct import time import zlib @@ -24,9 +25,8 @@ ) from PyQt6.QtNetwork import QHostAddress, QTcpServer -from eric7 import Preferences, Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox -from eric7.SystemUtilities import FileSystemUtilities class EricJsonServer(QTcpServer): @@ -34,16 +34,19 @@ Class implementing a JSON based server base class. """ - def __init__(self, name="", multiplex=False, parent=None): + def __init__(self, name="", interface="127.0.0.1", multiplex=False, parent=None): """ Constructor - @param name name of the server (used for output only) - @type str - @param multiplex flag indicating a multiplexing server - @type bool - @param parent parent object - @type QObject + @param name name of the server (used for output only) (defaults to "") + @type str (optional) + @param interface network interface to be used (IP address or one of "all", + "allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1") + @type str (optional) + @param multiplex flag indicating a multiplexing server (defaults to False) + @type bool (optional) + @param parent reference to the parent object (defaults to None) + @type QObject (optional) """ super().__init__(parent) @@ -57,15 +60,14 @@ self.__connection = None # setup the network interface - networkInterface = Preferences.getDebugger("NetworkInterface") - if networkInterface in ("allv4", "localv4") or "." in networkInterface: + if interface in ("allv4", "localv4") or "." in interface: # IPv4 self.__hostAddress = "127.0.0.1" - elif networkInterface in ("all", "allv6", "localv6"): + elif interface in ("all", "allv6", "localv6"): # IPv6 self.__hostAddress = "::1" else: - self.__hostAddress = networkInterface + self.__hostAddress = interface self.listen(QHostAddress(self.__hostAddress)) self.newConnection.connect(self.handleNewConnection) @@ -204,7 +206,7 @@ """ eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(jsonString.strip())), + ).format(str(err), EricUtilities.html_encode(jsonString.strip())), EricMessageBox.Ok, ) return @@ -267,7 +269,7 @@ in case of an issue @rtype bool, int """ - if interpreter == "" or not FileSystemUtilities.isinpath(interpreter): + if interpreter == "" or not bool(shutil.which(interpreter)): return False, -1 exitCode = None
--- a/src/eric7/EricNetwork/EricJsonStreamReader.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricJsonStreamReader.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import pyqtSignal, pyqtSlot from PyQt6.QtNetwork import QHostAddress, QTcpServer -from eric7 import Preferences, Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox @@ -28,16 +28,17 @@ dataReceived = pyqtSignal(object) - def __init__(self, name="", ip=None, parent=None): + def __init__(self, name="", interface="127.0.0.1", parent=None): """ Constructor - @param name name of the server (used for output only) - @type str - @param ip IP address to listen at - @type str - @param parent parent object - @type QObject + @param name name of the server (used for output only) (defaults to "") + @type str (optional) + @param interface network interface to be used (IP address or one of "all", + "allv4", "allv6", "localv4" or "localv6") (defaults to "127.0.0.1") + @type str (optional) + @param parent reference to the parent object (defaults to None) + @type QObject (optional) """ super().__init__(parent) @@ -45,18 +46,14 @@ self.__connection = None # setup the network interface - if ip is None: - networkInterface = Preferences.getDebugger("NetworkInterface") - if networkInterface in ("allv4", "localv4") or "." in networkInterface: - # IPv4 - self.__hostAddress = "127.0.0.1" - elif networkInterface in ("all", "allv6", "localv6"): - # IPv6 - self.__hostAddress = "::1" - else: - self.__hostAddress = networkInterface + if interface in ("allv4", "localv4") or "." in interface: + # IPv4 + self.__hostAddress = "127.0.0.1" + elif interface in ("all", "allv6", "localv6"): + # IPv6 + self.__hostAddress = "::1" else: - self.__hostAddress = ip + self.__hostAddress = interface self.listen(QHostAddress(self.__hostAddress)) self.newConnection.connect(self.handleNewConnection) @@ -144,7 +141,7 @@ """ eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(jsonLine.strip())), + ).format(str(err), EricUtilities.html_encode(jsonLine.strip())), EricMessageBox.Ok, ) return
--- a/src/eric7/EricNetwork/EricNetworkProxyFactory.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricNetworkProxyFactory.py Thu Sep 26 15:49:36 2024 +0200 @@ -14,7 +14,8 @@ from PyQt6.QtNetwork import QNetworkProxy, QNetworkProxyFactory, QNetworkProxyQuery from PyQt6.QtWidgets import QDialog -from eric7 import Preferences, Utilities +from eric7 import EricUtilities +from eric7.EricCore import EricPreferences from eric7.EricWidgets import EricMessageBox from eric7.SystemUtilities import OSUtilities @@ -53,7 +54,7 @@ info = QCoreApplication.translate( "EricNetworkProxyFactory", "<b>Connect to proxy '{0}' using:</b>" - ).format(Utilities.html_encode(proxy.hostName())) + ).format(EricUtilities.html_encode(proxy.hostName())) dlg = EricAuthenticationDialog(info, proxy.user(), True) dlg.setData(proxy.user(), proxy.password()) @@ -64,8 +65,12 @@ if dlg.shallSave(): scheme = schemeFromProxyType(proxy.type()) if scheme and scheme != "NoProxy": - Preferences.setUI("ProxyUser/{0}".format(scheme), username) - Preferences.setUI("ProxyPassword/{0}".format(scheme), password) + EricPreferences.setNetworkProxy( + "ProxyUser/{0}".format(scheme), username + ) + EricPreferences.setNetworkProxy( + "ProxyPassword/{0}".format(scheme), password + ) proxy.setUser(username) proxy.setPassword(password) @@ -163,12 +168,12 @@ query.queryType() == QNetworkProxyQuery.QueryType.UrlRequest and query.protocolTag() in ["http", "https", "ftp"] ): - # use proxy at all ? - if not Preferences.getUI("UseProxy"): + # use proxy at all? + if not EricPreferences.getNetworkProxy("UseProxy"): return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] # test for exceptions - exceptions = Preferences.getUI("ProxyExceptions") + exceptions = EricPreferences.getNetworkProxy("ProxyExceptions") if exceptions != self.__exceptions: self.__setExceptions(exceptions) urlHost = query.url().host() @@ -177,7 +182,7 @@ return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] # determine proxy - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): proxyList = QNetworkProxyFactory.systemProxyForQuery(query) if ( not OSUtilities.isWindowsPlatform() @@ -216,20 +221,26 @@ scheme = "Http" if scheme != "NoProxy": proxyList[0].setUser( - Preferences.getUI("ProxyUser/{0}".format(scheme)) + EricPreferences.getNetworkProxy( + "ProxyUser/{0}".format(scheme) + ) ) proxyList[0].setPassword( - Preferences.getUI("ProxyPassword/{0}".format(scheme)) + EricPreferences.getNetworkProxy( + "ProxyPassword/{0}".format(scheme) + ) ) return proxyList else: return [QNetworkProxy(QNetworkProxy.ProxyType.NoProxy)] else: - if Preferences.getUI("UseHttpProxyForAll"): + if EricPreferences.getNetworkProxy("UseHttpProxyForAll"): protocolKey = "Http" else: protocolKey = query.protocolTag().capitalize() - host = Preferences.getUI("ProxyHost/{0}".format(protocolKey)) + host = EricPreferences.getNetworkProxy( + "ProxyHost/{0}".format(protocolKey) + ) if not host: EricMessageBox.critical( None, @@ -253,9 +264,11 @@ proxy = QNetworkProxy( proxyType, host, - Preferences.getUI("ProxyPort/" + protocolKey), - Preferences.getUI("ProxyUser/" + protocolKey), - Preferences.getUI("ProxyPassword/" + protocolKey), + EricPreferences.getNetworkProxy("ProxyPort/" + protocolKey), + EricPreferences.getNetworkProxy("ProxyUser/" + protocolKey), + EricPreferences.getNetworkProxy( + "ProxyPassword/" + protocolKey + ), ) else: proxy = QNetworkProxy(QNetworkProxy.ProxyType.DefaultProxy)
--- a/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -15,7 +15,7 @@ with contextlib.suppress(ImportError): from PyQt6.QtNetwork import QSslCertificate -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricGui import EricPixmapCache from .Ui_EricSslCertificateSelectionDialog import Ui_EricSslCertificateSelectionDialog @@ -70,10 +70,10 @@ @type QSslCertificate """ # step 1: extract the info to be shown - organisation = Utilities.decodeString( + organisation = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.Organization)) ) - commonName = Utilities.decodeString( + commonName = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.CommonName)) ) if organisation is None or organisation == "":
--- a/src/eric7/EricNetwork/EricSslCertificatesDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslCertificatesDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -16,7 +16,7 @@ with contextlib.suppress(ImportError): from PyQt6.QtNetwork import QSslCertificate, QSslConfiguration, QSsl -from eric7 import EricUtilities, Preferences, Utilities +from eric7 import EricUtilities from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox @@ -30,16 +30,20 @@ CertRole = Qt.ItemDataRole.UserRole + 1 - def __init__(self, parent=None): + def __init__(self, settings, parent=None): """ Constructor + @param settings reference to the settings object + @type QSettings @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) + self.__settings = settings + self.serversViewButton.setIcon(EricPixmapCache.getIcon("certificates")) self.serversDeleteButton.setIcon(EricPixmapCache.getIcon("certificateDelete")) self.serversExportButton.setIcon(EricPixmapCache.getIcon("certificateExport")) @@ -58,7 +62,7 @@ Private slot to populate the server certificates tree. """ certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) for server in certificateDict: for cert in QSslCertificate.fromData(certificateDict[server]): @@ -78,10 +82,10 @@ @type QSslCertificate """ # step 1: extract the info to be shown - organisation = Utilities.decodeString( + organisation = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.Organization)) ) - commonName = Utilities.decodeString( + commonName = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.CommonName)) ) if organisation is None or organisation == "": @@ -169,7 +173,7 @@ # delete the certificate from the user certificate store certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) if server in certificateDict: certs = [ @@ -184,9 +188,7 @@ certificateDict[server] = pems else: del certificateDict[server] - Preferences.getSettings().setValue( - "Ssl/CaCertificatesDict", certificateDict - ) + self.__settings.setValue("Ssl/CaCertificatesDict", certificateDict) # delete the certificate from the default certificates self.__updateDefaultConfiguration() @@ -200,7 +202,7 @@ if certs: server = "*" certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) if server in certificateDict: sCerts = QSslCertificate.fromData(certificateDict[server]) @@ -219,16 +221,14 @@ self.tr( """<p>The certificate <b>{0}</b> already exists.""" """ Skipping.</p>""" - ).format(Utilities.decodeString(commonStr)), + ).format(EricUtilities.decodeString(commonStr)), ) else: pems.append(cert.toPem() + b"\n") if server not in certificateDict: certificateDict[server] = QByteArray() certificateDict[server].append(pems) - Preferences.getSettings().setValue( - "Ssl/CaCertificatesDict", certificateDict - ) + self.__settings.setValue("Ssl/CaCertificatesDict", certificateDict) self.serversCertificatesTree.clear() self.__populateServerCertificatesTree() @@ -255,7 +255,7 @@ """ caList = self.__getSystemCaCertificates() certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) for server in certificateDict: for cert in QSslCertificate.fromData(certificateDict[server]): @@ -273,9 +273,7 @@ @rtype list of QSslCertificate """ caList = QSslCertificate.fromData( - EricUtilities.toByteArray( - Preferences.getSettings().value("Help/SystemCertificates") - ) + EricUtilities.toByteArray(self.__settings.value("Help/SystemCertificates")) ) if not caList: caList = QSslConfiguration.systemCaCertificates() @@ -301,10 +299,10 @@ @type QSslCertificate """ # step 1: extract the info to be shown - organisation = Utilities.decodeString( + organisation = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.Organization)) ) - commonName = Utilities.decodeString( + commonName = EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.CommonName)) ) if organisation is None or organisation == "": @@ -394,7 +392,7 @@ pems = QByteArray() for cert in caCerts: pems.append(cert.toPem() + b"\n") - Preferences.getSettings().setValue("Help/SystemCertificates", pems) + self.__settings.setValue("Help/SystemCertificates", pems) # delete the certificate from the default certificates self.__updateDefaultConfiguration() @@ -418,7 +416,7 @@ self.tr( """<p>The certificate <b>{0}</b> already exists.""" """ Skipping.</p>""" - ).format(Utilities.decodeString(commonStr)), + ).format(EricUtilities.decodeString(commonStr)), ) else: caCerts.append(cert) @@ -426,7 +424,7 @@ pems = QByteArray() for cert in caCerts: pems.append(cert.toPem() + b"\n") - Preferences.getSettings().setValue("Help/SystemCertificates", pems) + self.__settings.setValue("Help/SystemCertificates", pems) self.caCertificatesTree.clear() self.__populateCaCertificatesTree()
--- a/src/eric7/EricNetwork/EricSslCertificatesInfoWidget.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslCertificatesInfoWidget.py Thu Sep 26 15:49:36 2024 +0200 @@ -15,7 +15,7 @@ except ImportError: QSslCertificate = None -from eric7 import Utilities +from eric7 import EricUtilities from .Ui_EricSslCertificatesInfoWidget import Ui_EricSslCertificatesInfoWidget @@ -189,7 +189,7 @@ if txt is None or txt == "": return self.tr("<not part of the certificate>") - return Utilities.decodeString(txt) + return EricUtilities.decodeString(txt) def __serialNumber(self, cert): """
--- a/src/eric7/EricNetwork/EricSslErrorHandler.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslErrorHandler.py Thu Sep 26 15:49:36 2024 +0200 @@ -14,7 +14,7 @@ from PyQt6.QtCore import QByteArray, QObject from PyQt6.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslError -from eric7 import EricUtilities, Preferences, Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox from eric7.SystemUtilities import OSUtilities @@ -37,18 +37,22 @@ permanently accepted by the user already. """ - def __init__(self, parent=None): + def __init__(self, settings, parent=None): """ Constructor - @param parent reference to the parent object - @type QObject + @param settings reference to the settings object + @type QSettings + @param parent reference to the parent object (defaults to None) + @type QObject (optional) """ super().__init__(parent) + self.__settings = settings + caList = self.__getSystemCaCertificates() certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) for server in certificateDict: for cert in QSslCertificate.fromData(certificateDict[server]): @@ -117,7 +121,7 @@ """ caMerge = {} certificateDict = EricUtilities.toDict( - Preferences.getSettings().value("Ssl/CaCertificatesDict") + self.__settings.value("Ssl/CaCertificatesDict") ) for caServer in certificateDict: caMerge[caServer] = QSslCertificate.fromData(certificateDict[caServer]) @@ -194,9 +198,7 @@ for cert in caMerge[server]: pems.append(cert.toPem() + b"\n") certificateDict[server] = pems - Preferences.getSettings().setValue( - "Ssl/CaCertificatesDict", certificateDict - ) + self.__settings.setValue("Ssl/CaCertificatesDict", certificateDict) return EricSslErrorState.USER_IGNORED, caRet @@ -215,16 +217,16 @@ result = "<p>" result += self.tr("Name: {0}").format( - Utilities.html_encode( - Utilities.decodeString( + EricUtilities.html_encode( + EricUtilities.decodeString( ", ".join(cert.subjectInfo(QSslCertificate.SubjectInfo.CommonName)) ) ) ) result += self.tr("<br/>Organization: {0}").format( - Utilities.html_encode( - Utilities.decodeString( + EricUtilities.html_encode( + EricUtilities.decodeString( ", ".join( cert.subjectInfo(QSslCertificate.SubjectInfo.Organization) ) @@ -233,15 +235,15 @@ ) result += self.tr("<br/>Issuer: {0}").format( - Utilities.html_encode( - Utilities.decodeString( + EricUtilities.html_encode( + EricUtilities.decodeString( ", ".join(cert.issuerInfo(QSslCertificate.SubjectInfo.CommonName)) ) ) ) result += self.tr("<br/>Not valid before: {0}<br/>Valid Until: {1}").format( - Utilities.html_encode(cert.effectiveDate().toString("yyyy-MM-dd")), - Utilities.html_encode(cert.expiryDate().toString("yyyy-MM-dd")), + EricUtilities.html_encode(cert.effectiveDate().toString("yyyy-MM-dd")), + EricUtilities.html_encode(cert.expiryDate().toString("yyyy-MM-dd")), ) result += "</p>" @@ -256,9 +258,7 @@ @rtype list of QSslCertificate """ caList = QSslCertificate.fromData( - EricUtilities.toByteArray( - Preferences.getSettings().value("Ssl/SystemCertificates") - ) + EricUtilities.toByteArray(self.__settings.value("Ssl/SystemCertificates")) ) if not caList: caList = QSslConfiguration.systemCaCertificates()
--- a/src/eric7/EricNetwork/EricSslInfoWidget.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslInfoWidget.py Thu Sep 26 15:49:36 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtNetwork import QSsl, QSslCertificate, QSslConfiguration from PyQt6.QtWidgets import QGridLayout, QLabel, QMenu, QSizePolicy -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricGui import EricPixmapCache @@ -73,7 +73,7 @@ self.tr( "The certificate for this site is valid" " and has been verified by:\n{0}" - ).format(Utilities.decodeString(txt)) + ).format(EricUtilities.decodeString(txt)) ) imageLabel.setPixmap(EricPixmapCache.getPixmap("securityHigh32")) else:
--- a/src/eric7/EricUtilities/__init__.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricUtilities/__init__.py Thu Sep 26 15:49:36 2024 +0200 @@ -7,8 +7,12 @@ Package containing utility modules and functions. """ +import codecs +import contextlib import os +import re +import chardet import semver from PyQt6.QtCore import QByteArray, QCoreApplication @@ -280,3 +284,199 @@ return QCoreApplication.translate("EricUtilities", "{0} TiB").format( loc.toString(size, "f", 2) ) + + +def decodeString(text): + """ + Function to decode a string containing Unicode encoded characters. + + @param text text containing encoded chars + @type str + @return decoded text + @rtype str + """ + buf = b"" + index = 0 + while index < len(text): + if text[index] == "\\": + qb = QByteArray.fromHex(text[index : index + 4].encode()) + buf += bytes(qb) + index += 4 + else: + buf += codecs.encode(text[index], "utf-8") + index += 1 + buf = buf.replace(b"\x00", b"") + return decodeBytes(buf) + + +def decodeBytes(buffer): + """ + Function to decode some byte text into a string. + + @param buffer byte buffer to decode + @type bytes + @return decoded text + @rtype str + """ + # try UTF with BOM + with contextlib.suppress(UnicodeError, LookupError): + if buffer.startswith(codecs.BOM_UTF8): + # UTF-8 with BOM + return str(buffer[len(codecs.BOM_UTF8) :], encoding="utf-8") + elif buffer.startswith(codecs.BOM_UTF16): + # UTF-16 with BOM + return str(buffer[len(codecs.BOM_UTF16) :], encoding="utf-16") + elif buffer.startswith(codecs.BOM_UTF32): + # UTF-32 with BOM + return str(buffer[len(codecs.BOM_UTF32) :], encoding="utf-32") + + # try UTF-8 + with contextlib.suppress(UnicodeError): + return str(buffer, encoding="utf-8") + + # try codec detection + try: + guess = chardet.detect(buffer) + if guess and guess["encoding"] is not None: + codec = guess["encoding"].lower() + return str(buffer, encoding=codec) + except (LookupError, UnicodeError): + pass + except ImportError: + pass + + return str(buffer, encoding="utf-8", errors="ignore") + + +def readStringFromStream(stream): + """ + Module function to read a string from the given stream. + + @param stream data stream opened for reading + @type QDataStream + @return string read from the stream + @rtype str + """ + data = stream.readString() + if data is None: + data = b"" + return data.decode("utf-8") + + +############################################################################### +## Functions for HTML string handling. +############################################################################### + + +_escape = re.compile("[&<>\"'\u0080-\uffff]") + +_escape_map = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", +} + + +def escape_entities(m, escmap=_escape_map): + """ + Function to encode html entities. + + @param m the match object + @type re.Match + @param escmap the map of entities to encode + @type dict + @return the converted text + @rtype str + """ + char = m.group() + text = escmap.get(char) + if text is None: + text = "&#{0:d};".format(ord(char)) + return text + + +def html_encode(text, pattern=_escape): + """ + Function to correctly encode a text for html. + + @param text text to be encoded + @type str + @param pattern search pattern for text to be encoded + @type str + @return the encoded text + @rtype str + """ + if not text: + return "" + text = pattern.sub(escape_entities, text) + return text + + +_uescape = re.compile("[\u0080-\uffff]") + + +def escape_uentities(m): + """ + Function to encode html entities. + + @param m the match object + @type re.Match + @return the converted text + @rtype str + """ + char = m.group() + text = "&#{0:d};".format(ord(char)) + return text + + +def html_uencode(text, pattern=_uescape): + """ + Function to correctly encode a unicode text for html. + + @param text text to be encoded + @type str + @param pattern search pattern for text to be encoded + @type str + @return the encoded text + @rtype str + """ + if not text: + return "" + text = pattern.sub(escape_uentities, text) + return text + + +_uunescape = re.compile(r"&#\d+;") + + +def unescape_uentities(m): + """ + Function to decode html entities. + + @param m the match object + @type re.Match + @return the converted text + @rtype str + """ + char = m.group() + ordinal = int(char[2:-1]) + return chr(ordinal) + + +def html_udecode(text, pattern=_uunescape): + """ + Function to correctly decode a html text to a unicode text. + + @param text text to be decoded + @type str + @param pattern search pattern for text to be decoded + @type str + @return the decoded text + @rtype str + """ + if not text: + return "" + text = pattern.sub(unescape_uentities, text) + return text
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/EricUtilities/crypto/__init__.py Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,350 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2011 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Package implementing cryptography related functionality. +""" + +import base64 +import random + +from PyQt6.QtCore import QCoreApplication +from PyQt6.QtWidgets import QInputDialog, QLineEdit + +from eric7 import Preferences +from eric7.EricWidgets import EricMessageBox + +############################################################################### +## password handling functions below +############################################################################### + + +EncodeMarker = "CE4" +CryptoMarker = "CR5" + +Delimiter = "$" + +MainPassword = None + + +def pwEncode(pw): + """ + Module function to encode a password. + + @param pw password to encode + @type str + @return encoded password + @rtype str + """ + pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,;:-_!$?*+#" + rpw = "".join(random.sample(pop, 32)) + pw + "".join(random.sample(pop, 32)) + return EncodeMarker + base64.b64encode(rpw.encode("utf-8")).decode("ascii") + + +def pwDecode(epw): + """ + Module function to decode a password. + + @param epw encoded password to decode + @type str + @return decoded password + @rtype str + """ + if not epw.startswith(EncodeMarker): + return epw # it was not encoded using pwEncode + + return base64.b64decode(epw[3:].encode("ascii"))[32:-32].decode("utf-8") + + +def __getMainPassword(): + """ + Private module function to get the password from the user. + """ + from .py3PBKDF2 import verifyPassword + + global MainPassword + + pw, ok = QInputDialog.getText( + None, + QCoreApplication.translate("Crypto", "Main Password"), + QCoreApplication.translate("Crypto", "Enter the main password:"), + QLineEdit.EchoMode.Password, + ) + if ok: + mainPassword = Preferences.getUser("MainPassword") + try: + if mainPassword: + if verifyPassword(pw, mainPassword): + MainPassword = pwEncode(pw) + else: + EricMessageBox.warning( + None, + QCoreApplication.translate("Crypto", "Main Password"), + QCoreApplication.translate( + "Crypto", """The given password is incorrect.""" + ), + ) + else: + EricMessageBox.critical( + None, + QCoreApplication.translate("Crypto", "Main Password"), + QCoreApplication.translate( + "Crypto", """There is no main password registered.""" + ), + ) + except ValueError as why: + EricMessageBox.warning( + None, + QCoreApplication.translate("Crypto", "Main Password"), + QCoreApplication.translate( + "Crypto", + """<p>The given password cannot be verified.</p>""" + """<p>Reason: {0}""".format(str(why)), + ), + ) + + +def pwEncrypt(pw, mainPW=None): + """ + Module function to encrypt a password. + + @param pw password to encrypt + @type str + @param mainPW password to be used for encryption + @type str + @return encrypted password (string) and flag indicating success + @rtype bool + """ + from .py3AES import encryptData + from .py3PBKDF2 import hashPasswordTuple + + if mainPW is None: + if MainPassword is None: + __getMainPassword() + if MainPassword is None: + return "", False + + mainPW = pwDecode(MainPassword) + + digestname, iterations, salt, pwHash = hashPasswordTuple(mainPW) + key = pwHash[:32] + try: + cipher = encryptData(key, pw.encode("utf-8")) + except ValueError: + return "", False + return ( + CryptoMarker + + Delimiter.join( + [ + digestname, + str(iterations), + base64.b64encode(salt).decode("ascii"), + base64.b64encode(cipher).decode("ascii"), + ] + ), + True, + ) + + +def pwDecrypt(epw, mainPW=None): + """ + Module function to decrypt a password. + + @param epw hashed password to decrypt + @type str + @param mainPW password to be used for decryption + @type str + @return decrypted password (string) and flag indicating success + @rtype bool + """ + from .py3AES import decryptData + from .py3PBKDF2 import rehashPassword + + if not epw.startswith(CryptoMarker): + return epw, False # it was not encoded using pwEncrypt + + if mainPW is None: + if MainPassword is None: + __getMainPassword() + if MainPassword is None: + return "", False + + mainPW = pwDecode(MainPassword) + + hashParameters, epw = epw[3:].rsplit(Delimiter, 1) + try: + # recreate the key used to encrypt + key = rehashPassword(mainPW, hashParameters)[:32] + plaintext = decryptData(key, base64.b64decode(epw.encode("ascii"))) + except ValueError: + return "", False + return plaintext.decode("utf-8"), True + + +def pwReencrypt(epw, oldPassword, newPassword): + """ + Module function to re-encrypt a password. + + @param epw hashed password to re-encrypt + @type str + @param oldPassword password used to encrypt + @type str + @param newPassword new password to be used + @type str + @return encrypted password (string) and flag indicating success + @rtype bool + """ + plaintext, ok = pwDecrypt(epw, oldPassword) + if ok: + return pwEncrypt(plaintext, newPassword) + else: + return "", False + + +def pwRecode(epw, oldPassword, newPassword): + """ + Module function to re-encode a password. + + In case of an error the encoded password is returned unchanged. + + @param epw encoded password to re-encode + @type str + @param oldPassword password used to encode + @type str + @param newPassword new password to be used + @type str + @return encoded password + @rtype str + """ + if epw == "": + return epw + + if newPassword == "": + plaintext, ok = pwDecrypt(epw) + return pwEncode(plaintext) if ok else epw + else: + if oldPassword == "": + plaintext = pwDecode(epw) + cipher, ok = pwEncrypt(plaintext, newPassword) + return cipher if ok else epw + else: + npw, ok = pwReencrypt(epw, oldPassword, newPassword) + return npw if ok else epw + + +def pwConvert(pw, encode=True): + """ + Module function to convert a plaintext password to the encoded form or + vice versa. + + If there is an error, an empty code is returned for the encode function + or the given encoded password for the decode function. + + @param pw password to encode + @type str + @param encode flag indicating an encode or decode function + @type bool + @return encoded or decoded password + @rtype str + """ + if pw == "": + return pw + + if encode: + # plain text -> encoded + if Preferences.getUser("UseMainPassword"): + epw = pwEncrypt(pw)[0] + else: + epw = pwEncode(pw) + return epw + else: + # encoded -> plain text + if Preferences.getUser("UseMainPassword"): + plain, ok = pwDecrypt(pw) + else: + plain, ok = pwDecode(pw), True + return plain if ok else pw + + +def changeRememberedMain(newPassword): + """ + Module function to change the remembered main password. + + @param newPassword new password to be used + @type str + """ + global MainPassword + MainPassword = pwEncode(newPassword) if newPassword else None + + +def dataEncrypt(data, password, keyLength=32, hashIterations=10000): + """ + Module function to encrypt a password. + + @param data data to encrypt + @type bytes + @param password password to be used for encryption + @type str + @param keyLength length of the key to be generated for encryption (16, 24 or 32) + @type int + @param hashIterations number of hashes to be applied to the password for + generating the encryption key + @type int + @return encrypted data (bytes) and flag indicating success + @rtype bool + """ + from .py3AES import encryptData + from .py3PBKDF2 import hashPasswordTuple + + digestname, iterations, salt, pwHash = hashPasswordTuple( + password, iterations=hashIterations + ) + key = pwHash[:keyLength] + try: + cipher = encryptData(key, data) + except ValueError: + return b"", False + return ( + CryptoMarker.encode("utf-8") + + Delimiter.encode("utf-8").join( + [ + digestname.encode("utf-8"), + str(iterations).encode("utf-8"), + base64.b64encode(salt), + base64.b64encode(cipher), + ] + ), + True, + ) + + +def dataDecrypt(edata, password, keyLength=32): + """ + Module function to decrypt a password. + + @param edata hashed data to decrypt + @type str + @param password password to be used for decryption + @type str + @param keyLength length of the key to be generated for decryption (16, 24 or 32) + @type int + @return decrypted data (bytes) and flag indicating success + @rtype bool + """ + from .py3AES import decryptData + from .py3PBKDF2 import rehashPassword + + if not edata.startswith(CryptoMarker.encode("utf-8")): + return edata, False # it was not encoded using dataEncrypt + + hashParametersBytes, edata = edata[3:].rsplit(Delimiter.encode("utf-8"), 1) + hashParameters = hashParametersBytes.decode() + try: + # recreate the key used to encrypt + key = rehashPassword(password, hashParameters)[:keyLength] + plaintext = decryptData(key, base64.b64decode(edata)) + except ValueError: + return "", False + return plaintext, True
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/EricUtilities/crypto/py3AES.py Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,1662 @@ +# -*- coding: utf-8 -*- + +# +# aes.py: implements AES - Advanced Encryption Standard +# from the SlowAES project, http://code.google.com/p/slowaes/ +# +# Copyright (c) 2008 Josh Davis ( http://www.josh-davis.org ), +# Alex Martelli ( http://www.aleax.it ) +# +# Ported from C code written by Laurent Haan +# ( http://www.progressive-coding.com ) +# +# Licensed under the Apache License, Version 2.0 +# http://www.apache.org/licenses/ +# + +# +# Ported to Python3 +# +# Copyright (c) 2011 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing classes for encryption according +Advanced Encryption Standard. +""" + +import math +import os + + +def append_PKCS7_padding(b): + """ + Function to pad the given data to a multiple of 16-bytes by PKCS7 padding. + + @param b data to be padded + @type bytes + @return padded data + @rtype bytes + """ + numpads = 16 - (len(b) % 16) + return b + numpads * bytes(chr(numpads), encoding="ascii") + + +def strip_PKCS7_padding(b): + """ + Function to strip off PKCS7 padding. + + @param b data to be stripped + @type bytes + @return stripped data + @rtype bytes + @exception ValueError data padding is invalid + """ + if len(b) % 16 or not b: + raise ValueError("Data of len {0} can't be PCKS7-padded".format(len(b))) + numpads = b[-1] + if numpads > 16: + raise ValueError("Data ending with {0} can't be PCKS7-padded".format(b[-1])) + return b[:-numpads] + + +class AES: + """ + Class implementing the Advanced Encryption Standard algorithm. + """ + + # valid key sizes + KeySize = { + "SIZE_128": 16, + "SIZE_192": 24, + "SIZE_256": 32, + } + + # Rijndael S-box + sbox = [ + 0x63, + 0x7C, + 0x77, + 0x7B, + 0xF2, + 0x6B, + 0x6F, + 0xC5, + 0x30, + 0x01, + 0x67, + 0x2B, + 0xFE, + 0xD7, + 0xAB, + 0x76, + 0xCA, + 0x82, + 0xC9, + 0x7D, + 0xFA, + 0x59, + 0x47, + 0xF0, + 0xAD, + 0xD4, + 0xA2, + 0xAF, + 0x9C, + 0xA4, + 0x72, + 0xC0, + 0xB7, + 0xFD, + 0x93, + 0x26, + 0x36, + 0x3F, + 0xF7, + 0xCC, + 0x34, + 0xA5, + 0xE5, + 0xF1, + 0x71, + 0xD8, + 0x31, + 0x15, + 0x04, + 0xC7, + 0x23, + 0xC3, + 0x18, + 0x96, + 0x05, + 0x9A, + 0x07, + 0x12, + 0x80, + 0xE2, + 0xEB, + 0x27, + 0xB2, + 0x75, + 0x09, + 0x83, + 0x2C, + 0x1A, + 0x1B, + 0x6E, + 0x5A, + 0xA0, + 0x52, + 0x3B, + 0xD6, + 0xB3, + 0x29, + 0xE3, + 0x2F, + 0x84, + 0x53, + 0xD1, + 0x00, + 0xED, + 0x20, + 0xFC, + 0xB1, + 0x5B, + 0x6A, + 0xCB, + 0xBE, + 0x39, + 0x4A, + 0x4C, + 0x58, + 0xCF, + 0xD0, + 0xEF, + 0xAA, + 0xFB, + 0x43, + 0x4D, + 0x33, + 0x85, + 0x45, + 0xF9, + 0x02, + 0x7F, + 0x50, + 0x3C, + 0x9F, + 0xA8, + 0x51, + 0xA3, + 0x40, + 0x8F, + 0x92, + 0x9D, + 0x38, + 0xF5, + 0xBC, + 0xB6, + 0xDA, + 0x21, + 0x10, + 0xFF, + 0xF3, + 0xD2, + 0xCD, + 0x0C, + 0x13, + 0xEC, + 0x5F, + 0x97, + 0x44, + 0x17, + 0xC4, + 0xA7, + 0x7E, + 0x3D, + 0x64, + 0x5D, + 0x19, + 0x73, + 0x60, + 0x81, + 0x4F, + 0xDC, + 0x22, + 0x2A, + 0x90, + 0x88, + 0x46, + 0xEE, + 0xB8, + 0x14, + 0xDE, + 0x5E, + 0x0B, + 0xDB, + 0xE0, + 0x32, + 0x3A, + 0x0A, + 0x49, + 0x06, + 0x24, + 0x5C, + 0xC2, + 0xD3, + 0xAC, + 0x62, + 0x91, + 0x95, + 0xE4, + 0x79, + 0xE7, + 0xC8, + 0x37, + 0x6D, + 0x8D, + 0xD5, + 0x4E, + 0xA9, + 0x6C, + 0x56, + 0xF4, + 0xEA, + 0x65, + 0x7A, + 0xAE, + 0x08, + 0xBA, + 0x78, + 0x25, + 0x2E, + 0x1C, + 0xA6, + 0xB4, + 0xC6, + 0xE8, + 0xDD, + 0x74, + 0x1F, + 0x4B, + 0xBD, + 0x8B, + 0x8A, + 0x70, + 0x3E, + 0xB5, + 0x66, + 0x48, + 0x03, + 0xF6, + 0x0E, + 0x61, + 0x35, + 0x57, + 0xB9, + 0x86, + 0xC1, + 0x1D, + 0x9E, + 0xE1, + 0xF8, + 0x98, + 0x11, + 0x69, + 0xD9, + 0x8E, + 0x94, + 0x9B, + 0x1E, + 0x87, + 0xE9, + 0xCE, + 0x55, + 0x28, + 0xDF, + 0x8C, + 0xA1, + 0x89, + 0x0D, + 0xBF, + 0xE6, + 0x42, + 0x68, + 0x41, + 0x99, + 0x2D, + 0x0F, + 0xB0, + 0x54, + 0xBB, + 0x16, + ] + + # Rijndael Inverted S-box + rsbox = [ + 0x52, + 0x09, + 0x6A, + 0xD5, + 0x30, + 0x36, + 0xA5, + 0x38, + 0xBF, + 0x40, + 0xA3, + 0x9E, + 0x81, + 0xF3, + 0xD7, + 0xFB, + 0x7C, + 0xE3, + 0x39, + 0x82, + 0x9B, + 0x2F, + 0xFF, + 0x87, + 0x34, + 0x8E, + 0x43, + 0x44, + 0xC4, + 0xDE, + 0xE9, + 0xCB, + 0x54, + 0x7B, + 0x94, + 0x32, + 0xA6, + 0xC2, + 0x23, + 0x3D, + 0xEE, + 0x4C, + 0x95, + 0x0B, + 0x42, + 0xFA, + 0xC3, + 0x4E, + 0x08, + 0x2E, + 0xA1, + 0x66, + 0x28, + 0xD9, + 0x24, + 0xB2, + 0x76, + 0x5B, + 0xA2, + 0x49, + 0x6D, + 0x8B, + 0xD1, + 0x25, + 0x72, + 0xF8, + 0xF6, + 0x64, + 0x86, + 0x68, + 0x98, + 0x16, + 0xD4, + 0xA4, + 0x5C, + 0xCC, + 0x5D, + 0x65, + 0xB6, + 0x92, + 0x6C, + 0x70, + 0x48, + 0x50, + 0xFD, + 0xED, + 0xB9, + 0xDA, + 0x5E, + 0x15, + 0x46, + 0x57, + 0xA7, + 0x8D, + 0x9D, + 0x84, + 0x90, + 0xD8, + 0xAB, + 0x00, + 0x8C, + 0xBC, + 0xD3, + 0x0A, + 0xF7, + 0xE4, + 0x58, + 0x05, + 0xB8, + 0xB3, + 0x45, + 0x06, + 0xD0, + 0x2C, + 0x1E, + 0x8F, + 0xCA, + 0x3F, + 0x0F, + 0x02, + 0xC1, + 0xAF, + 0xBD, + 0x03, + 0x01, + 0x13, + 0x8A, + 0x6B, + 0x3A, + 0x91, + 0x11, + 0x41, + 0x4F, + 0x67, + 0xDC, + 0xEA, + 0x97, + 0xF2, + 0xCF, + 0xCE, + 0xF0, + 0xB4, + 0xE6, + 0x73, + 0x96, + 0xAC, + 0x74, + 0x22, + 0xE7, + 0xAD, + 0x35, + 0x85, + 0xE2, + 0xF9, + 0x37, + 0xE8, + 0x1C, + 0x75, + 0xDF, + 0x6E, + 0x47, + 0xF1, + 0x1A, + 0x71, + 0x1D, + 0x29, + 0xC5, + 0x89, + 0x6F, + 0xB7, + 0x62, + 0x0E, + 0xAA, + 0x18, + 0xBE, + 0x1B, + 0xFC, + 0x56, + 0x3E, + 0x4B, + 0xC6, + 0xD2, + 0x79, + 0x20, + 0x9A, + 0xDB, + 0xC0, + 0xFE, + 0x78, + 0xCD, + 0x5A, + 0xF4, + 0x1F, + 0xDD, + 0xA8, + 0x33, + 0x88, + 0x07, + 0xC7, + 0x31, + 0xB1, + 0x12, + 0x10, + 0x59, + 0x27, + 0x80, + 0xEC, + 0x5F, + 0x60, + 0x51, + 0x7F, + 0xA9, + 0x19, + 0xB5, + 0x4A, + 0x0D, + 0x2D, + 0xE5, + 0x7A, + 0x9F, + 0x93, + 0xC9, + 0x9C, + 0xEF, + 0xA0, + 0xE0, + 0x3B, + 0x4D, + 0xAE, + 0x2A, + 0xF5, + 0xB0, + 0xC8, + 0xEB, + 0xBB, + 0x3C, + 0x83, + 0x53, + 0x99, + 0x61, + 0x17, + 0x2B, + 0x04, + 0x7E, + 0xBA, + 0x77, + 0xD6, + 0x26, + 0xE1, + 0x69, + 0x14, + 0x63, + 0x55, + 0x21, + 0x0C, + 0x7D, + ] + + # Rijndael Rcon + Rcon = [ + 0x8D, + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1B, + 0x36, + 0x6C, + 0xD8, + 0xAB, + 0x4D, + 0x9A, + 0x2F, + 0x5E, + 0xBC, + 0x63, + 0xC6, + 0x97, + 0x35, + 0x6A, + 0xD4, + 0xB3, + 0x7D, + 0xFA, + 0xEF, + 0xC5, + 0x91, + 0x39, + 0x72, + 0xE4, + 0xD3, + 0xBD, + 0x61, + 0xC2, + 0x9F, + 0x25, + 0x4A, + 0x94, + 0x33, + 0x66, + 0xCC, + 0x83, + 0x1D, + 0x3A, + 0x74, + 0xE8, + 0xCB, + 0x8D, + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1B, + 0x36, + 0x6C, + 0xD8, + 0xAB, + 0x4D, + 0x9A, + 0x2F, + 0x5E, + 0xBC, + 0x63, + 0xC6, + 0x97, + 0x35, + 0x6A, + 0xD4, + 0xB3, + 0x7D, + 0xFA, + 0xEF, + 0xC5, + 0x91, + 0x39, + 0x72, + 0xE4, + 0xD3, + 0xBD, + 0x61, + 0xC2, + 0x9F, + 0x25, + 0x4A, + 0x94, + 0x33, + 0x66, + 0xCC, + 0x83, + 0x1D, + 0x3A, + 0x74, + 0xE8, + 0xCB, + 0x8D, + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1B, + 0x36, + 0x6C, + 0xD8, + 0xAB, + 0x4D, + 0x9A, + 0x2F, + 0x5E, + 0xBC, + 0x63, + 0xC6, + 0x97, + 0x35, + 0x6A, + 0xD4, + 0xB3, + 0x7D, + 0xFA, + 0xEF, + 0xC5, + 0x91, + 0x39, + 0x72, + 0xE4, + 0xD3, + 0xBD, + 0x61, + 0xC2, + 0x9F, + 0x25, + 0x4A, + 0x94, + 0x33, + 0x66, + 0xCC, + 0x83, + 0x1D, + 0x3A, + 0x74, + 0xE8, + 0xCB, + 0x8D, + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1B, + 0x36, + 0x6C, + 0xD8, + 0xAB, + 0x4D, + 0x9A, + 0x2F, + 0x5E, + 0xBC, + 0x63, + 0xC6, + 0x97, + 0x35, + 0x6A, + 0xD4, + 0xB3, + 0x7D, + 0xFA, + 0xEF, + 0xC5, + 0x91, + 0x39, + 0x72, + 0xE4, + 0xD3, + 0xBD, + 0x61, + 0xC2, + 0x9F, + 0x25, + 0x4A, + 0x94, + 0x33, + 0x66, + 0xCC, + 0x83, + 0x1D, + 0x3A, + 0x74, + 0xE8, + 0xCB, + 0x8D, + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, + 0x1B, + 0x36, + 0x6C, + 0xD8, + 0xAB, + 0x4D, + 0x9A, + 0x2F, + 0x5E, + 0xBC, + 0x63, + 0xC6, + 0x97, + 0x35, + 0x6A, + 0xD4, + 0xB3, + 0x7D, + 0xFA, + 0xEF, + 0xC5, + 0x91, + 0x39, + 0x72, + 0xE4, + 0xD3, + 0xBD, + 0x61, + 0xC2, + 0x9F, + 0x25, + 0x4A, + 0x94, + 0x33, + 0x66, + 0xCC, + 0x83, + 0x1D, + 0x3A, + 0x74, + 0xE8, + 0xCB, + ] + + def __getSBoxValue(self, num): + """ + Private method to retrieve a given S-Box value. + + @param num position of the value + @type int + @return value of the S-Box + @rtype int + """ + return self.sbox[num] + + def __getSBoxInvert(self, num): + """ + Private method to retrieve a given Inverted S-Box value. + + @param num position of the value + @type int + @return value of the Inverted S-Box + @rtype int + """ + return self.rsbox[num] + + def __rotate(self, data): + """ + Private method performing Rijndael's key schedule rotate operation. + + Rotate the data word eight bits to the left: eg, + rotate(1d2c3a4f) == 2c3a4f1d. + + @param data data of size 4 + @type bytearray + @return rotated data + @rtype bytearray + """ + return data[1:] + data[:1] + + def __getRconValue(self, num): + """ + Private method to retrieve a given Rcon value. + + @param num position of the value + @type int + @return Rcon value + @rtype int + """ + return self.Rcon[num] + + def __core(self, data, iteration): + """ + Private method performing the key schedule core operation. + + @param data data to operate on + @type bytearray + @param iteration iteration counter + @type int + @return modified data + @rtype bytearray + """ + # rotate the 32-bit word 8 bits to the left + data = self.__rotate(data) + # apply S-Box substitution on all 4 parts of the 32-bit word + for i in range(4): + data[i] = self.__getSBoxValue(data[i]) + # XOR the output of the rcon operation with i to the first part + # (leftmost) only + data[0] = data[0] ^ self.__getRconValue(iteration) + return data + + def __expandKey(self, key, size, expandedKeySize): + """ + Private method performing Rijndael's key expansion. + + Expands a 128, 192 or 256 bit key into a 176, 208 or 240 bit key. + + @param key key to be expanded + @type bytes or bytearray + @param size size of the key in bytes (16, 24 or 32) + @type int + @param expandedKeySize size of the expanded key + @type int + @return expanded key + @rtype bytearray + """ + # current expanded keySize, in bytes + currentSize = 0 + rconIteration = 1 + expandedKey = bytearray(expandedKeySize) + + # set the 16, 24, 32 bytes of the expanded key to the input key + for j in range(size): + expandedKey[j] = key[j] + currentSize += size + + while currentSize < expandedKeySize: + # assign the previous 4 bytes to the temporary value t + t = expandedKey[currentSize - 4 : currentSize] + + # every 16, 24, 32 bytes we apply the core schedule to t + # and increment rconIteration afterwards + if currentSize % size == 0: + t = self.__core(t, rconIteration) + rconIteration += 1 + # For 256-bit keys, we add an extra sbox to the calculation + if size == self.KeySize["SIZE_256"] and ((currentSize % size) == 16): + for ll in range(4): + t[ll] = self.__getSBoxValue(t[ll]) + + # We XOR t with the four-byte block 16, 24, 32 bytes before the new + # expanded key. This becomes the next four bytes in the expanded + # key. + for m in range(4): + expandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m] + currentSize += 1 # noqa: Y113 + + return expandedKey + + def __addRoundKey(self, state, roundKey): + """ + Private method to add (XORs) the round key to the state. + + @param state state to be changed + @type bytearray + @param roundKey key to be used for the modification + @type bytearray + @return modified state + @rtype bytearray + """ + buf = state[:] + for i in range(16): + buf[i] ^= roundKey[i] + return buf + + def __createRoundKey(self, expandedKey, roundKeyPointer): + """ + Private method to create a round key. + + @param expandedKey expanded key to be used + @type bytearray + @param roundKeyPointer position within the expanded key + @type int + @return round key + @rtype bytearray + """ + roundKey = bytearray(16) + for i in range(4): + for j in range(4): + roundKey[j * 4 + i] = expandedKey[roundKeyPointer + i * 4 + j] + return roundKey + + def __galois_multiplication(self, a, b): + """ + Private method to perform a Galois multiplication of 8 bit characters + a and b. + + @param a first factor + @type bytes + @param b second factor + @type bytes + @return result + @rtype bytes + """ + p = 0 + for _counter in range(8): + if b & 1: + p ^= a + hi_bit_set = a & 0x80 + a <<= 1 + # keep a 8 bit + a &= 0xFF + if hi_bit_set: + a ^= 0x1B + b >>= 1 + return p + + def __subBytes(self, state, isInv): + """ + Private method to substitute all the values from the state with the + value in the SBox using the state value as index for the SBox. + + @param state state to be worked on + @type bytearray + @param isInv flag indicating an inverse operation + @type bool + @return modified state + @rtype bytearray + """ + state = state[:] + getter = self.__getSBoxInvert if isInv else self.__getSBoxValue + for i in range(16): + state[i] = getter(state[i]) + return state + + def __shiftRows(self, state, isInv): + """ + Private method to iterate over the 4 rows and call __shiftRow() with + that row. + + @param state state to be worked on + @type bytearray + @param isInv flag indicating an inverse operation + @type bool + @return modified state + @rtype bytearray + """ + state = state[:] + for i in range(4): + state = self.__shiftRow(state, i * 4, i, isInv) + return state + + def __shiftRow(self, state, statePointer, nbr, isInv): + """ + Private method to shift the bytes of a row to the left. + + @param state state to be worked on + @type bytearray + @param statePointer index into the state + @type int + @param nbr number of positions to shift + @type int + @param isInv flag indicating an inverse operation + @type bool + @return modified state + @rtype bytearray + """ + state = state[:] + for _ in range(nbr): + if isInv: + state[statePointer : statePointer + 4] = ( + state[statePointer + 3 : statePointer + 4] + + state[statePointer : statePointer + 3] + ) + else: + state[statePointer : statePointer + 4] = ( + state[statePointer + 1 : statePointer + 4] + + state[statePointer : statePointer + 1] + ) + return state + + def __mixColumns(self, state, isInv): + """ + Private method to perform a galois multiplication of the 4x4 matrix. + + @param state state to be worked on + @type bytearray + @param isInv flag indicating an inverse operation + @type bool + @return modified state + @rtype bytearray + """ + state = state[:] + # iterate over the 4 columns + for i in range(4): + # construct one column by slicing over the 4 rows + column = state[i : i + 16 : 4] + # apply the __mixColumn on one column + column = self.__mixColumn(column, isInv) + # put the values back into the state + state[i : i + 16 : 4] = column + + return state + + # galois multiplication of 1 column of the 4x4 matrix + def __mixColumn(self, column, isInv): + """ + Private method to perform a galois multiplication of 1 column the + 4x4 matrix. + + @param column column to be worked on + @type bytearray + @param isInv flag indicating an inverse operation + @type bool + @return modified column + @rtype bytearray + """ + column = column[:] + mult = [14, 9, 13, 11] if isInv else [2, 1, 1, 3] + cpy = column[:] + g = self.__galois_multiplication + + column[0] = ( + g(cpy[0], mult[0]) + ^ g(cpy[3], mult[1]) + ^ g(cpy[2], mult[2]) + ^ g(cpy[1], mult[3]) + ) + column[1] = ( + g(cpy[1], mult[0]) + ^ g(cpy[0], mult[1]) + ^ g(cpy[3], mult[2]) + ^ g(cpy[2], mult[3]) + ) + column[2] = ( + g(cpy[2], mult[0]) + ^ g(cpy[1], mult[1]) + ^ g(cpy[0], mult[2]) + ^ g(cpy[3], mult[3]) + ) + column[3] = ( + g(cpy[3], mult[0]) + ^ g(cpy[2], mult[1]) + ^ g(cpy[1], mult[2]) + ^ g(cpy[0], mult[3]) + ) + return column + + def __aes_round(self, state, roundKey): + """ + Private method to apply the 4 operations of the forward round in + sequence. + + @param state state to be worked on + @type bytearray + @param roundKey round key to be used + @type bytearray + @return modified state + @rtype bytearray + """ + state = self.__subBytes(state, False) + state = self.__shiftRows(state, False) + state = self.__mixColumns(state, False) + state = self.__addRoundKey(state, roundKey) + return state + + def __aes_invRound(self, state, roundKey): + """ + Private method to apply the 4 operations of the inverse round in + sequence. + + @param state state to be worked on + @type bytearray + @param roundKey round key to be used + @type bytearray + @return modified state + @rtype bytearray + """ + state = self.__shiftRows(state, True) + state = self.__subBytes(state, True) + state = self.__addRoundKey(state, roundKey) + state = self.__mixColumns(state, True) + return state + + def __aes_main(self, state, expandedKey, nbrRounds): + """ + Private method to do the AES encryption for one round. + + Perform the initial operations, the standard round, and the + final operations of the forward AES, creating a round key for + each round. + + @param state state to be worked on + @type bytearray + @param expandedKey expanded key to be used + @type bytearray + @param nbrRounds number of rounds to be done + @type int + @return modified state + @rtype bytearray + """ + state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) + i = 1 + while i < nbrRounds: + state = self.__aes_round(state, self.__createRoundKey(expandedKey, 16 * i)) + i += 1 + state = self.__subBytes(state, False) + state = self.__shiftRows(state, False) + state = self.__addRoundKey( + state, self.__createRoundKey(expandedKey, 16 * nbrRounds) + ) + return state + + def __aes_invMain(self, state, expandedKey, nbrRounds): + """ + Private method to do the inverse AES encryption for one round. + + Perform the initial operations, the standard round, and the + final operations of the inverse AES, creating a round key for + each round. + + @param state state to be worked on + @type bytearray + @param expandedKey expanded key to be used + @type bytearray + @param nbrRounds number of rounds to be done + @type int + @return modified state + @rtype bytearray + """ + state = self.__addRoundKey( + state, self.__createRoundKey(expandedKey, 16 * nbrRounds) + ) + i = nbrRounds - 1 + while i > 0: + state = self.__aes_invRound( + state, self.__createRoundKey(expandedKey, 16 * i) + ) + i -= 1 + state = self.__shiftRows(state, True) + state = self.__subBytes(state, True) + state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) + return state + + def encrypt(self, iput, key, size): + """ + Public method to encrypt a 128 bit input block against the given key + of size specified. + + @param iput input data + @type bytearray + @param key key to be used + @type bytes or bytearray + @param size key size (16, 24 or 32) + @type int + @return encrypted data + @rtype bytes + @exception ValueError key size is invalid + """ + if size not in self.KeySize.values(): + raise ValueError("Wrong key size given ({0}).".format(size)) + + output = bytearray(16) + # the number of rounds + nbrRounds = 0 + # the 128 bit block to encode + block = bytearray(16) + # set the number of rounds + if size == self.KeySize["SIZE_128"]: + nbrRounds = 10 + elif size == self.KeySize["SIZE_192"]: + nbrRounds = 12 + else: + nbrRounds = 14 + + # the expanded keySize + expandedKeySize = 16 * (nbrRounds + 1) + + # Set the block values, for the block: + # a0,0 a0,1 a0,2 a0,3 + # a1,0 a1,1 a1,2 a1,3 + # a2,0 a2,1 a2,2 a2,3 + # a3,0 a3,1 a3,2 a3,3 + # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3 + # + # iterate over the columns + for i in range(4): + # iterate over the rows + for j in range(4): + block[i + j * 4] = iput[i * 4 + j] + + # expand the key into an 176, 208, 240 bytes key + # the expanded key + expandedKey = self.__expandKey(key, size, expandedKeySize) + + # encrypt the block using the expandedKey + block = self.__aes_main(block, expandedKey, nbrRounds) + + # unmap the block again into the output + for kk in range(4): + # iterate over the rows + for ll in range(4): + output[kk * 4 + ll] = block[kk + ll * 4] + return bytes(output) + + # decrypts a 128 bit input block against the given key of size specified + def decrypt(self, iput, key, size): + """ + Public method to decrypt a 128 bit input block against the given key + of size specified. + + @param iput input data + @type bytearray + @param key key to be used + @type bytes or bytearray + @param size key size (16, 24 or 32) + @type int + @return decrypted data + @rtype bytes + @exception ValueError key size is invalid + """ + if size not in self.KeySize.values(): + raise ValueError("Wrong key size given ({0}).".format(size)) + + output = bytearray(16) + # the number of rounds + nbrRounds = 0 + # the 128 bit block to decode + block = bytearray(16) + # set the number of rounds + + if size == self.KeySize["SIZE_128"]: + nbrRounds = 10 + elif size == self.KeySize["SIZE_192"]: + nbrRounds = 12 + else: + nbrRounds = 14 + + # the expanded keySize + expandedKeySize = 16 * (nbrRounds + 1) + + # Set the block values, for the block: + # a0,0 a0,1 a0,2 a0,3 + # a1,0 a1,1 a1,2 a1,3 + # a2,0 a2,1 a2,2 a2,3 + # a3,0 a3,1 a3,2 a3,3 + # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3 + + # iterate over the columns + for i in range(4): + # iterate over the rows + for j in range(4): + block[i + j * 4] = iput[i * 4 + j] + # expand the key into an 176, 208, 240 bytes key + expandedKey = self.__expandKey(key, size, expandedKeySize) + # decrypt the block using the expandedKey + block = self.__aes_invMain(block, expandedKey, nbrRounds) + # unmap the block again into the output + for kk in range(4): + # iterate over the rows + for ll in range(4): + output[kk * 4 + ll] = block[kk + ll * 4] + return output + + +class AESModeOfOperation: + """ + Class implementing the different AES mode of operations. + """ + + aes = AES() + + # structure of supported modes of operation + ModeOfOperation = { + "OFB": 0, + "CFB": 1, + "CBC": 2, + } + + def __extractBytes(self, inputData, start, end, mode): + """ + Private method to extract a range of bytes from the input. + + @param inputData input data + @type bytes + @param start start index + @type int + @param end end index + @type int + @param mode mode of operation (0, 1, 2) + @type int + @return extracted bytes + @rtype bytearray + """ + if end - start > 16: + end = start + 16 + ar = bytearray(16) if mode == self.ModeOfOperation["CBC"] else bytearray() + + i = start + j = 0 + while len(ar) < end - start: + ar.append(0) + while i < end: + ar[j] = inputData[i] + j += 1 + i += 1 + return ar + + def encrypt(self, inputData, mode, key, size, IV): + """ + Public method to perform the encryption operation. + + @param inputData data to be encrypted + @type bytes + @param mode mode of operation (0, 1 or 2) + @type int + @param key key to be used + @type bytes + @param size length of the key (16, 24 or 32) + @type int + @param IV initialisation vector + @type bytearray + @return tuple with mode of operation, length of the input data and + the encrypted data + @rtype tuple of (int, int, bytes) + @exception ValueError key size is invalid or decrypted data is invalid + """ + if len(key) % size: + raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key)) + if len(IV) % 16: + raise ValueError("IV is not a multiple of 16.") + # the AES input/output + iput = bytearray(16) + output = bytearray() + ciphertext = bytearray(16) + # the output cipher string + cipherOut = bytearray() + # char firstRound + firstRound = True + if inputData: + for j in range(int(math.ceil(float(len(inputData)) / 16))): + start = j * 16 + end = j * 16 + 16 + if end > len(inputData): + end = len(inputData) + plaintext = self.__extractBytes(inputData, start, end, mode) + if mode == self.ModeOfOperation["CFB"]: + if firstRound: + output = self.aes.encrypt(IV, key, size) + firstRound = False + else: + output = self.aes.encrypt(iput, key, size) + for i in range(16): + if len(plaintext) - 1 < i: + ciphertext[i] = 0 ^ output[i] + elif len(output) - 1 < i: + ciphertext[i] = plaintext[i] ^ 0 + elif len(plaintext) - 1 < i and len(output) < i: + ciphertext[i] = 0 ^ 0 + else: + ciphertext[i] = plaintext[i] ^ output[i] + for k in range(end - start): + cipherOut.append(ciphertext[k]) + iput = ciphertext + elif mode == self.ModeOfOperation["OFB"]: + if firstRound: + output = self.aes.encrypt(IV, key, size) + firstRound = False + else: + output = self.aes.encrypt(iput, key, size) + for i in range(16): + if len(plaintext) - 1 < i: + ciphertext[i] = 0 ^ output[i] + elif len(output) - 1 < i: + ciphertext[i] = plaintext[i] ^ 0 + elif len(plaintext) - 1 < i and len(output) < i: + ciphertext[i] = 0 ^ 0 + else: + ciphertext[i] = plaintext[i] ^ output[i] + for k in range(end - start): + cipherOut.append(ciphertext[k]) + iput = output + elif mode == self.ModeOfOperation["CBC"]: + for i in range(16): + if firstRound: + iput[i] = plaintext[i] ^ IV[i] + else: + iput[i] = plaintext[i] ^ ciphertext[i] + firstRound = False + ciphertext = self.aes.encrypt(iput, key, size) + # always 16 bytes because of the padding for CBC + for k in range(16): + cipherOut.append(ciphertext[k]) + return mode, len(inputData), bytes(cipherOut) + + # Mode of Operation Decryption + # cipherIn - Encrypted String + # originalsize - The unencrypted string length - required for CBC + # mode - mode of type modeOfOperation + # key - a number array of the bit length size + # size - the bit length of the key + # IV - the 128 bit number array Initilization Vector + def decrypt(self, cipherIn, originalsize, mode, key, size, IV): + """ + Public method to perform the decryption operation. + + @param cipherIn data to be decrypted + @type bytes + @param originalsize unencrypted string length (required for CBC) + @type int + @param mode mode of operation (0, 1 or 2) + @type int + @param key key to be used + @type bytes + @param size length of the key (16, 24 or 32) + @type int + @param IV initialisation vector + @type bytearray + @return decrypted data + @rtype bytes + @exception ValueError key size is invalid or decrypted data is invalid + """ + if len(key) % size: + raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key)) + if len(IV) % 16: + raise ValueError("IV is not a multiple of 16.") + # the AES input/output + ciphertext = bytearray() + iput = bytearray() + output = bytearray() + plaintext = bytearray(16) + # the output bytes + bytesOut = bytearray() + # char firstRound + firstRound = True + if cipherIn is not None: + for j in range(int(math.ceil(float(len(cipherIn)) / 16))): + start = j * 16 + end = j * 16 + 16 + if j * 16 + 16 > len(cipherIn): + end = len(cipherIn) + ciphertext = cipherIn[start:end] + if mode == self.ModeOfOperation["CFB"]: + if firstRound: + output = self.aes.encrypt(IV, key, size) + firstRound = False + else: + output = self.aes.encrypt(iput, key, size) + for i in range(16): + if len(output) - 1 < i: + plaintext[i] = 0 ^ ciphertext[i] + elif len(ciphertext) - 1 < i: + plaintext[i] = output[i] ^ 0 + elif len(output) - 1 < i and len(ciphertext) < i: + plaintext[i] = 0 ^ 0 + else: + plaintext[i] = output[i] ^ ciphertext[i] + for k in range(end - start): + bytesOut.append(plaintext[k]) + iput = ciphertext + elif mode == self.ModeOfOperation["OFB"]: + if firstRound: + output = self.aes.encrypt(IV, key, size) + firstRound = False + else: + output = self.aes.encrypt(iput, key, size) + for i in range(16): + if len(output) - 1 < i: + plaintext[i] = 0 ^ ciphertext[i] + elif len(ciphertext) - 1 < i: + plaintext[i] = output[i] ^ 0 + elif len(output) - 1 < i and len(ciphertext) < i: + plaintext[i] = 0 ^ 0 + else: + plaintext[i] = output[i] ^ ciphertext[i] + for k in range(end - start): + bytesOut.append(plaintext[k]) + iput = output + elif mode == self.ModeOfOperation["CBC"]: + output = self.aes.decrypt(ciphertext, key, size) + for i in range(16): + if firstRound: + plaintext[i] = IV[i] ^ output[i] + else: + plaintext[i] = iput[i] ^ output[i] + firstRound = False + if originalsize is not None and originalsize < end: + for k in range(originalsize - start): + bytesOut.append(plaintext[k]) + else: + for k in range(end - start): + bytesOut.append(plaintext[k]) + iput = ciphertext + return bytes(bytesOut) + + +def encryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]): + """ + Module function to encrypt the given data with the given key. + + @param key key to be used for encryption + @type bytes + @param data data to be encrypted + @type bytes + @param mode mode of operations (0, 1 or 2) + @type int + @return encrypted data prepended with the initialization vector + @rtype bytes + @exception ValueError raised to indicate an invalid key size + """ + key = bytearray(key) + if mode == AESModeOfOperation.ModeOfOperation["CBC"]: + data = append_PKCS7_padding(data) + keysize = len(key) + if keysize not in AES.KeySize.values(): + raise ValueError("invalid key size: {0}".format(keysize)) + # create a new iv using random data + iv = bytearray(list(os.urandom(16))) + moo = AESModeOfOperation() + _mode, _length, ciph = moo.encrypt(data, mode, key, keysize, iv) + # With padding, the original length does not need to be known. It's a bad + # idea to store the original message length. + # prepend the iv. + return bytes(iv) + bytes(ciph) + + +def decryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]): + """ + Module function to decrypt the given data with the given key. + + @param key key to be used for decryption + @type bytes + @param data data to be decrypted (with initialization vector prepended) + @type bytes + @param mode mode of operations (0, 1 or 2) + @type int + @return decrypted data + @rtype bytes + @exception ValueError raised to indicate an invalid key size + """ + key = bytearray(key) + keysize = len(key) + if keysize not in AES.KeySize.values(): + raise ValueError("invalid key size: {0}".format(keysize)) + # iv is first 16 bytes + iv = bytearray(data[:16]) + data = bytearray(data[16:]) + moo = AESModeOfOperation() + decr = moo.decrypt(data, None, mode, key, keysize, iv) + if mode == AESModeOfOperation.ModeOfOperation["CBC"]: + decr = strip_PKCS7_padding(decr) + return bytes(decr)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/EricUtilities/crypto/py3PBKDF2.py Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing PBKDF2 functions. +""" + +import base64 +import hashlib +import hmac +import os + +Hashes = { + "sha1": hashlib.sha1, + "sha224": hashlib.sha224, + "sha256": hashlib.sha256, + "sha384": hashlib.sha384, + "sha512": hashlib.sha512, + "md5": hashlib.md5, +} + +Delimiter = "$" + + +def pbkdf2(password, salt, iterations, digestMod): + """ + Module function to hash a password according to the PBKDF2 specification. + + @param password clear text password + @type bytes + @param salt salt value + @type bytes + @param iterations number of times hash function should be applied + @type int + @param digestMod hash function + @type function + @return hashed password + @rtype bytes + """ + pwHash = password + for _ in range(iterations): + pwHash = hmac.new(salt, pwHash, digestMod).digest() + return pwHash + + +def hashPasswordTuple( + password, digestMod=hashlib.sha512, iterations=10000, saltSize=32 +): + """ + Module function to hash a password according to the PBKDF2 specification. + + @param password clear text password + @type str + @param digestMod hash function + @type function + @param iterations number of times hash function should be applied + @type int + @param saltSize size of the salt + @type int + @return tuple of digestname, number of iterations, salt and hashed password + @rtype tuple of (str, int, bytes, bytes) + """ + salt = os.urandom(saltSize) + password = password.encode("utf-8") + pwHash = pbkdf2(password, salt, iterations, digestMod) + digestname = digestMod.__name__.replace("openssl_", "") + return digestname, iterations, salt, pwHash + + +def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): + """ + Module function to hash a password according to the PBKDF2 specification. + + @param password clear text password + @type str + @param digestMod hash function + @type function + @param iterations number of times hash function should be applied + @type int + @param saltSize size of the salt + @type int + @return hashed password entry according to PBKDF2 specification + @rtype str + """ + digestname, iterations, salt, pwHash = hashPasswordTuple( + password, digestMod, iterations, saltSize + ) + return Delimiter.join( + [ + digestname, + str(iterations), + base64.b64encode(salt).decode("ascii"), + base64.b64encode(pwHash).decode("ascii"), + ] + ) + + +def verifyPassword(password, pwHash): + """ + Module function to verify a password against a hash encoded password. + + @param password clear text password + @type str + @param pwHash hash encoded password in the form + 'digestmod$iterations$salt$hashed_password' as produced by the + hashPassword function + @type str + @return flag indicating a successfull verification + @rtype bool + @exception ValueError the hash is not of the expected format or the + digest is not one of the known ones + """ + try: + digestname, iterations, salt, pwHash = pwHash.split(Delimiter) + except ValueError: + raise ValueError( + "Expected hash encoded password in format " + "'digestmod{0}iterations{0}salt{0}hashed_password".format(Delimiter) + ) + + if digestname not in Hashes: + raise ValueError( + "Unsupported hash algorithm '{0}' for hash encoded password '{1}'.".format( + digestname, pwHash + ) + ) + + iterations = int(iterations) + salt = base64.b64decode(salt.encode("ascii")) + pwHash = base64.b64decode(pwHash.encode("ascii")) + password = password.encode("utf-8") + return pwHash == pbkdf2(password, salt, iterations, Hashes[digestname]) + + +def rehashPassword(password, hashParameters): + """ + Module function to recreate a password hash given the hash parameters. + + @param password clear text password + @type str + @param hashParameters hash parameters in the form + 'digestmod$iterations$salt' + @type str + @return hashed password + @rtype bytes + @exception ValueError the hash parameters string is not of the expected + format or the digest is not one of the known ones + """ + try: + digestname, iterations, salt = hashParameters.split(Delimiter) + except ValueError: + raise ValueError( + "Expected hash parameters string in format " + "'digestmod{0}iterations{0}salt".format(Delimiter) + ) + + if digestname not in Hashes: + raise ValueError( + "Unsupported hash algorithm '{0}' for hash parameters '{1}'.".format( + digestname, hashParameters + ) + ) + + iterations = int(iterations) + salt = base64.b64decode(salt.encode("ascii")) + password = password.encode("utf-8") + return pbkdf2(password, salt, iterations, Hashes[digestname])
--- a/src/eric7/EricWidgets/EricErrorMessage.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/EricWidgets/EricErrorMessage.py Thu Sep 26 15:49:36 2024 +0200 @@ -152,14 +152,14 @@ "<p>Line: {3}</p><p>Function: {4}</p>" ).format( messageType, - Utilities.html_uencode(message), + EricUtilities.html_uencode(message), context.file, context.line, context.function, ) if context.file is not None else "<p><b>{0}</b></p><p>{1}</p>".format( - messageType, Utilities.html_uencode(message) + messageType, EricUtilities.html_uencode(message) ) ) if QThread.currentThread() == ericApp().thread():
--- a/src/eric7/JediInterface/JediServer.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/JediInterface/JediServer.py Thu Sep 26 15:49:36 2024 +0200 @@ -65,7 +65,12 @@ @param ui reference to the user interface @type UserInterface """ - super().__init__("JediServer", multiplex=True, parent=ui) + super().__init__( + name="JediServer", + interface=Preferences.getDebugger("NetworkInterface"), + multiplex=True, + parent=ui, + ) self.__ui = ui self.__vm = viewManager
--- a/src/eric7/MicroPython/MicroPythonWindow.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/MicroPython/MicroPythonWindow.py Thu Sep 26 15:49:36 2024 +0200 @@ -15,6 +15,7 @@ from PyQt6.QtWidgets import QDialog, QSplitter, QWidget from eric7 import Preferences +from eric7.EricCore import EricPreferences from eric7.EricNetwork.EricNetworkProxyFactory import ( EricNetworkProxyFactory, proxyAuthenticationRequired, @@ -102,7 +103,7 @@ ericApp().focusChanged.connect(self.__appFocusChanged) # network related setup - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getUI("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: self.__proxyFactory = EricNetworkProxyFactory() @@ -114,7 +115,9 @@ proxyAuthenticationRequired ) if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = [] @@ -268,7 +271,7 @@ self.__bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) self.__bottomSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: self.__proxyFactory = EricNetworkProxyFactory()
--- a/src/eric7/Network/IRC/IrcChannelWidget.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Network/IRC/IrcChannelWidget.py Thu Sep 26 15:49:36 2024 +0200 @@ -31,7 +31,7 @@ QWidget, ) -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.__version__ import Version from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox @@ -438,7 +438,7 @@ Preferences.getIrc("OwnNickColour"), ircTimestamp(), self.__userName, - Utilities.html_encode(msg), + EricUtilities.html_encode(msg), ) )
--- a/src/eric7/Network/IRC/IrcNetworkManager.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Network/IRC/IrcNetworkManager.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,9 +12,9 @@ from PyQt6.QtCore import QCoreApplication, QObject, pyqtSignal from eric7 import EricUtilities, Preferences +from eric7.EricUtilities.crypto import pwConvert from eric7.SystemUtilities import OSUtilities from eric7.Utilities.AutoSaver import AutoSaver -from eric7.Utilities.crypto import pwConvert class IrcIdentity:
--- a/src/eric7/Network/IRC/IrcUtilities.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Network/IRC/IrcUtilities.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import QCoreApplication, QTime from PyQt6.QtWidgets import QApplication -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences __UrlRe = re.compile( r"""((?:http|ftp|https):\/\/[\w\-_]+(?:\.[\w\-_]+)+""" @@ -60,7 +60,7 @@ @rtype str """ # step 1: cleanup message - msg = Utilities.html_encode(msg) + msg = EricUtilities.html_encode(msg) # step 2: replace IRC formatting characters openTags = []
--- a/src/eric7/Network/IRC/IrcWidget.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Network/IRC/IrcWidget.py Thu Sep 26 15:49:36 2024 +0200 @@ -102,7 +102,9 @@ self.__socket = None if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) else: self.__sslErrorHandler = None
--- a/src/eric7/PipInterface/Pip.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/PipInterface/Pip.py Thu Sep 26 15:49:36 2024 +0200 @@ -26,6 +26,7 @@ from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit from eric7 import Preferences +from eric7.EricCore import EricPreferences from eric7.EricCore.EricProcess import EricProcess from eric7.EricNetwork.EricNetworkProxyFactory import ( EricNetworkProxyFactory, @@ -69,7 +70,7 @@ self.__ui = parent # attributes for the network objects - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: self.__proxyFactory = EricNetworkProxyFactory() @@ -81,7 +82,9 @@ proxyAuthenticationRequired ) if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.__networkManager.sslErrors.connect( self.__sslErrorHandler.sslErrorsReply )
--- a/src/eric7/PipInterface/PipPackageDetailsDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/PipInterface/PipPackageDetailsDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -17,7 +17,7 @@ QTreeWidgetItem, ) -from eric7 import Utilities +from eric7 import EricUtilities from .Ui_PipPackageDetailsDialog import Ui_PipPackageDetailsDialog @@ -274,11 +274,11 @@ "<tr><td>Advisory:</td><td>{3}</td></tr>" "</table>" ).format( - Utilities.html_encode(title), - Utilities.html_encode(vulnerability.version), - Utilities.html_encode(vulnerability.spec), + EricUtilities.html_encode(title), + EricUtilities.html_encode(vulnerability.version), + EricUtilities.html_encode(vulnerability.spec), "<p>{0}</p>".format( - Utilities.html_encode(vulnerability.advisory).replace( + EricUtilities.html_encode(vulnerability.advisory).replace( "\r\n", "<br/>" ) ),
--- a/src/eric7/PluginManager/PluginManager.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/PluginManager/PluginManager.py Thu Sep 26 15:49:36 2024 +0200 @@ -173,7 +173,9 @@ proxyAuthenticationRequired ) if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = []
--- a/src/eric7/PluginManager/PluginRepositoryDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/PluginManager/PluginRepositoryDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -238,7 +238,9 @@ proxyAuthenticationRequired ) if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = []
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import QByteArray, QTimer, QUrl -from eric7 import Utilities +from eric7 import EricUtilities from .TranslationEngine import TranslationEngine @@ -139,7 +139,7 @@ ).encode("utf-8") ) encodedText = QByteArray( - Utilities.html_encode(text).encode("utf-8") + EricUtilities.html_encode(text).encode("utf-8") ).toPercentEncoding() request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request)
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV2Engine.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV2Engine.py Thu Sep 26 15:49:36 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtCore import QByteArray, QTimer, QUrl -from eric7 import Utilities +from eric7 import EricUtilities from .TranslationEngine import TranslationEngine @@ -134,7 +134,7 @@ ).encode("utf-8") ) encodedText = QByteArray( - Utilities.html_encode(text).encode("utf-8") + EricUtilities.html_encode(text).encode("utf-8") ).toPercentEncoding() request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request)
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/LibreTranslateEngine.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/LibreTranslateEngine.py Thu Sep 26 15:49:36 2024 +0200 @@ -13,7 +13,7 @@ from PyQt6.QtCore import QByteArray, QTimer, QUrl from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkReply, QNetworkRequest -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired from eric7.EricWidgets import EricMessageBox @@ -135,7 +135,7 @@ paramsStr += "&q=" params = QByteArray(paramsStr.encode("utf-8")) encodedText = QByteArray( - Utilities.html_encode(text).encode("utf-8") + EricUtilities.html_encode(text).encode("utf-8") ).toPercentEncoding() request = params + encodedText response, ok = requestObject.post(QUrl(url), request) @@ -146,7 +146,7 @@ return self.tr("LibreTranslate: Invalid response received"), False try: - return Utilities.html_encode(responseDict["translatedText"]), True + return EricUtilities.html_encode(responseDict["translatedText"]), True except KeyError: return self.tr("LibreTranslate: No translation available."), False else:
--- a/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/YandexEngine.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/YandexEngine.py Thu Sep 26 15:49:36 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtCore import QByteArray, QTimer, QUrl -from eric7 import Utilities +from eric7 import EricUtilities from .TranslationEngine import TranslationEngine @@ -154,7 +154,7 @@ ).encode("utf-8") ) encodedText = QByteArray( - Utilities.html_encode(text).encode("utf-8") + EricUtilities.html_encode(text).encode("utf-8") ).toPercentEncoding() request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request)
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -36,7 +36,7 @@ QWidget, ) -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricFileDialog, EricMessageBox @@ -1842,7 +1842,7 @@ HgLogBrowserDialog.GraftedTemplate.format(match.group(1)) ) else: - messagesList.append(Utilities.html_encode(line.strip())) + messagesList.append(EricUtilities.html_encode(line.strip())) messageStr = "<br />\n".join(messagesList) html = self.__detailsTemplate.format(
--- a/src/eric7/Preferences/ConfigurationDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -267,6 +267,13 @@ None, None, ], + "networkProxyPage": [ + self.tr("Network Proxy"), + "preferences-network-proxy", + "NetworkProxyPage", + None, + None, + ], "notificationsPage": [ self.tr("Notifications"), "preferences-notifications", @@ -949,7 +956,7 @@ ], "networkProxyPage": [ self.tr("Network Proxy"), - "preferences-network", + "preferences-network-proxy", "NetworkProxyPage", None, None, @@ -1102,7 +1109,7 @@ ], "networkProxyPage": [ self.tr("Network Proxy"), - "preferences-network", + "preferences-network-proxy", "NetworkProxyPage", None, None,
--- a/src/eric7/Preferences/ConfigurationPages/MainPasswordEntryDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/MainPasswordEntryDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -10,7 +10,7 @@ from PyQt6.QtCore import pyqtSlot from PyQt6.QtWidgets import QDialog, QDialogButtonBox -from eric7.Utilities.crypto.py3PBKDF2 import verifyPassword +from eric7.EricUtilities.crypto.py3PBKDF2 import verifyPassword from .Ui_MainPasswordEntryDialog import Ui_MainPasswordEntryDialog
--- a/src/eric7/Preferences/ConfigurationPages/NetworkPage.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/NetworkPage.py Thu Sep 26 15:49:36 2024 +0200 @@ -7,10 +7,7 @@ Module implementing the Network configuration page. """ -from PyQt6.QtCore import pyqtSlot - from eric7 import Preferences -from eric7.EricNetwork.EricFtp import EricFtpProxyType from eric7.EricWidgets.EricPathPicker import EricPathPickerModes from .ConfigurationPageBase import ConfigurationPageBase @@ -39,32 +36,6 @@ self.downloadDirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) - self.ftpProxyTypeCombo.addItem( - self.tr("No FTP Proxy"), EricFtpProxyType.NO_PROXY.value - ) - self.ftpProxyTypeCombo.addItem( - self.tr("No Proxy Authentication required"), - EricFtpProxyType.NON_AUTHORIZING.value, - ) - self.ftpProxyTypeCombo.addItem( - self.tr("User@Server"), EricFtpProxyType.USER_SERVER.value - ) - self.ftpProxyTypeCombo.addItem(self.tr("SITE"), EricFtpProxyType.SITE.value) - self.ftpProxyTypeCombo.addItem(self.tr("OPEN"), EricFtpProxyType.OPEN.value) - self.ftpProxyTypeCombo.addItem( - self.tr("User@Proxyuser@Server"), - EricFtpProxyType.USER_PROXYUSER_SERVER.value, - ) - self.ftpProxyTypeCombo.addItem( - self.tr("Proxyuser@Server"), EricFtpProxyType.PROXYUSER_SERVER.value - ) - self.ftpProxyTypeCombo.addItem( - self.tr("AUTH and RESP"), EricFtpProxyType.AUTH_RESP.value - ) - self.ftpProxyTypeCombo.addItem( - self.tr("Bluecoat Proxy"), EricFtpProxyType.BLUECOAT.value - ) - # set initial values self.dynamicOnlineCheckBox.setChecked(Preferences.getUI("DynamicOnlineCheck")) @@ -73,36 +44,6 @@ Preferences.getUI("RequestDownloadFilename") ) - # HTTP proxy - self.httpProxyHostEdit.setText(Preferences.getUI("ProxyHost/Http")) - self.httpProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Http")) - - # HTTPS proxy - self.httpsProxyHostEdit.setText(Preferences.getUI("ProxyHost/Https")) - self.httpsProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Https")) - - # FTP proxy - self.ftpProxyHostEdit.setText(Preferences.getUI("ProxyHost/Ftp")) - self.ftpProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Ftp")) - self.ftpProxyTypeCombo.setCurrentIndex( - self.ftpProxyTypeCombo.findData(Preferences.getUI("ProxyType/Ftp").value) - ) - self.ftpProxyUserEdit.setText(Preferences.getUI("ProxyUser/Ftp")) - self.ftpProxyPasswordEdit.setText(Preferences.getUI("ProxyPassword/Ftp")) - self.ftpProxyAccountEdit.setText(Preferences.getUI("ProxyAccount/Ftp")) - - self.httpProxyForAllCheckBox.setChecked(Preferences.getUI("UseHttpProxyForAll")) - if not Preferences.getUI("UseProxy"): - self.noProxyButton.setChecked(True) - elif Preferences.getUI("UseSystemProxy"): - self.systemProxyButton.setChecked(True) - else: - self.manualProxyButton.setChecked(True) - - self.exceptionsEdit.setText( - ", ".join(Preferences.getUI("ProxyExceptions").split(",")) - ) - def setMode(self, displayMode): """ Public method to perform mode dependent setups. @@ -176,67 +117,6 @@ "DownloadManagerAutoClose", self.closeOnFinishedCheckBox.isChecked() ) - Preferences.setUI("UseProxy", not self.noProxyButton.isChecked()) - Preferences.setUI("UseSystemProxy", self.systemProxyButton.isChecked()) - Preferences.setUI( - "UseHttpProxyForAll", self.httpProxyForAllCheckBox.isChecked() - ) - - Preferences.setUI( - "ProxyExceptions", - ",".join([h.strip() for h in self.exceptionsEdit.text().split(",")]), - ) - - # HTTP proxy - Preferences.setUI("ProxyHost/Http", self.httpProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Http", self.httpProxyPortSpin.value()) - - # HTTPS proxy - Preferences.setUI("ProxyHost/Https", self.httpsProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Https", self.httpsProxyPortSpin.value()) - - # FTP proxy - Preferences.setUI("ProxyHost/Ftp", self.ftpProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Ftp", self.ftpProxyPortSpin.value()) - Preferences.setUI( - "ProxyType/Ftp", EricFtpProxyType(self.ftpProxyTypeCombo.currentData()) - ) - Preferences.setUI("ProxyUser/Ftp", self.ftpProxyUserEdit.text()) - Preferences.setUI("ProxyPassword/Ftp", self.ftpProxyPasswordEdit.text()) - Preferences.setUI("ProxyAccount/Ftp", self.ftpProxyAccountEdit.text()) - - @pyqtSlot() - def on_clearProxyPasswordsButton_clicked(self): - """ - Private slot to clear the saved HTTP(S) proxy passwords. - """ - Preferences.setUI("ProxyPassword/Http", "") - Preferences.setUI("ProxyPassword/Https", "") - - @pyqtSlot(int) - def on_ftpProxyTypeCombo_currentIndexChanged(self, index): - """ - Private slot handling the selection of a proxy type. - - @param index index of the selected item - @type int - """ - proxyType = EricFtpProxyType(self.ftpProxyTypeCombo.itemData(index)) - self.ftpProxyHostEdit.setEnabled(proxyType != EricFtpProxyType.NO_PROXY) - self.ftpProxyPortSpin.setEnabled(proxyType != EricFtpProxyType.NO_PROXY) - self.ftpProxyUserEdit.setEnabled( - proxyType - not in [EricFtpProxyType.NO_PROXY, EricFtpProxyType.NON_AUTHORIZING] - ) - self.ftpProxyPasswordEdit.setEnabled( - proxyType - not in [EricFtpProxyType.NO_PROXY, EricFtpProxyType.NON_AUTHORIZING] - ) - self.ftpProxyAccountEdit.setEnabled( - proxyType - not in [EricFtpProxyType.NO_PROXY, EricFtpProxyType.NON_AUTHORIZING] - ) - def create(dlg): """
--- a/src/eric7/Preferences/ConfigurationPages/NetworkPage.ui Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/NetworkPage.ui Thu Sep 26 15:49:36 2024 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>589</width> - <height>1129</height> + <height>524</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_7"> @@ -165,319 +165,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="proxyGroup"> - <property name="toolTip"> - <string>Select to use a web proxy</string> - </property> - <property name="title"> - <string>Network Proxy</string> - </property> - <property name="checkable"> - <bool>false</bool> - </property> - <property name="checked"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QRadioButton" name="noProxyButton"> - <property name="toolTip"> - <string>Select to not use a network proxy</string> - </property> - <property name="text"> - <string>Do not use proxy</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="systemProxyButton"> - <property name="toolTip"> - <string>Select to use the system proxy configuration</string> - </property> - <property name="text"> - <string>Use system proxy configuration</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="manualProxyButton"> - <property name="toolTip"> - <string>Select to use an application specific proxy configuration</string> - </property> - <property name="text"> - <string>Manual proxy configuration:</string> - </property> - <property name="checked"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="title"> - <string>Manual proxy settings</string> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_6"> - <property name="title"> - <string>HTTP-Proxy</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>Hostname:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="httpProxyHostEdit"> - <property name="toolTip"> - <string>Enter the name of the HTTP proxy host</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Port:</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QSpinBox" name="httpProxyPortSpin"> - <property name="toolTip"> - <string>Enter the HTTP proxy port</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight</set> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - <property name="value"> - <number>80</number> - </property> - </widget> - </item> - <item row="1" column="0" colspan="4"> - <widget class="QCheckBox" name="httpProxyForAllCheckBox"> - <property name="toolTip"> - <string>Select to use the HTTP proxy for all</string> - </property> - <property name="text"> - <string>Use this proxy for all protocols</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>HTTPS-Proxy</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Hostname:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="httpsProxyHostEdit"> - <property name="toolTip"> - <string>Enter the name of the HTTPS proxy host</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Port:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="httpsProxyPortSpin"> - <property name="toolTip"> - <string>Enter the HTTPS proxy port</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight</set> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - <property name="value"> - <number>443</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>FTP-Proxy</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Proxy Type:</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="3"> - <widget class="QComboBox" name="ftpProxyTypeCombo"> - <property name="toolTip"> - <string>Select the type of the FTP proxy</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Hostname:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="ftpProxyHostEdit"> - <property name="toolTip"> - <string>Enter the name of the FTP proxy host</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Port:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QSpinBox" name="ftpProxyPortSpin"> - <property name="toolTip"> - <string>Enter the FTP proxy port</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight</set> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - <property name="value"> - <number>21</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>User Name:</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="3"> - <widget class="QLineEdit" name="ftpProxyUserEdit"> - <property name="toolTip"> - <string>Enter the user name for the proxy authentication</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string>Password:</string> - </property> - </widget> - </item> - <item row="3" column="1" colspan="3"> - <widget class="QLineEdit" name="ftpProxyPasswordEdit"> - <property name="toolTip"> - <string>Enter the password for the proxy authentication</string> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Account:</string> - </property> - </widget> - </item> - <item row="4" column="1" colspan="3"> - <widget class="QLineEdit" name="ftpProxyAccountEdit"> - <property name="toolTip"> - <string>Enter the account info for the proxy authentication</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Exceptions:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="exceptionsEdit"> - <property name="toolTip"> - <string>Enter host names or IP-addresses for which the proxy is to be circumvented separated by ',' (wildcards * or ? may be used)</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QPushButton" name="clearProxyPasswordsButton"> - <property name="toolTip"> - <string>Press to clear the saved passwords for the Http(s) proxy</string> - </property> - <property name="text"> - <string>Clear HTTP(S) Proxy Passwords</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -509,72 +196,7 @@ <tabstop>cleanupSuccessfulButton</tabstop> <tabstop>openOnStartCheckBox</tabstop> <tabstop>closeOnFinishedCheckBox</tabstop> - <tabstop>noProxyButton</tabstop> - <tabstop>systemProxyButton</tabstop> - <tabstop>manualProxyButton</tabstop> - <tabstop>httpProxyHostEdit</tabstop> - <tabstop>httpProxyPortSpin</tabstop> - <tabstop>httpProxyForAllCheckBox</tabstop> - <tabstop>httpsProxyHostEdit</tabstop> - <tabstop>httpsProxyPortSpin</tabstop> - <tabstop>ftpProxyTypeCombo</tabstop> - <tabstop>ftpProxyHostEdit</tabstop> - <tabstop>ftpProxyPortSpin</tabstop> - <tabstop>ftpProxyUserEdit</tabstop> - <tabstop>ftpProxyPasswordEdit</tabstop> - <tabstop>ftpProxyAccountEdit</tabstop> - <tabstop>exceptionsEdit</tabstop> - <tabstop>clearProxyPasswordsButton</tabstop> </tabstops> <resources/> - <connections> - <connection> - <sender>manualProxyButton</sender> - <signal>toggled(bool)</signal> - <receiver>groupBox</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>100</x> - <y>405</y> - </hint> - <hint type="destinationlabel"> - <x>83</x> - <y>507</y> - </hint> - </hints> - </connection> - <connection> - <sender>httpProxyForAllCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>groupBox_5</receiver> - <slot>setDisabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>152</x> - <y>515</y> - </hint> - <hint type="destinationlabel"> - <x>76</x> - <y>561</y> - </hint> - </hints> - </connection> - <connection> - <sender>httpProxyForAllCheckBox</sender> - <signal>toggled(bool)</signal> - <receiver>groupBox_4</receiver> - <slot>setDisabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>170</x> - <y>517</y> - </hint> - <hint type="destinationlabel"> - <x>116</x> - <y>631</y> - </hint> - </hints> - </connection> - </connections> + <connections/> </ui>
--- a/src/eric7/Preferences/ConfigurationPages/NetworkProxyPage.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/NetworkProxyPage.py Thu Sep 26 15:49:36 2024 +0200 @@ -9,7 +9,7 @@ from PyQt6.QtCore import pyqtSlot -from eric7 import Preferences +from eric7.EricCore import EricPreferences from eric7.EricNetwork.EricFtp import EricFtpProxyType from .ConfigurationPageBase import ConfigurationPageBase @@ -63,75 +63,103 @@ # set initial values # HTTP proxy - self.httpProxyHostEdit.setText(Preferences.getUI("ProxyHost/Http")) - self.httpProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Http")) + self.httpProxyHostEdit.setText( + EricPreferences.getNetworkProxy("ProxyHost/Http") + ) + self.httpProxyPortSpin.setValue( + EricPreferences.getNetworkProxy("ProxyPort/Http") + ) # HTTPS proxy - self.httpsProxyHostEdit.setText(Preferences.getUI("ProxyHost/Https")) - self.httpsProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Https")) + self.httpsProxyHostEdit.setText( + EricPreferences.getNetworkProxy("ProxyHost/Https") + ) + self.httpsProxyPortSpin.setValue( + EricPreferences.getNetworkProxy("ProxyPort/Https") + ) # FTP proxy - self.ftpProxyHostEdit.setText(Preferences.getUI("ProxyHost/Ftp")) - self.ftpProxyPortSpin.setValue(Preferences.getUI("ProxyPort/Ftp")) + self.ftpProxyHostEdit.setText(EricPreferences.getNetworkProxy("ProxyHost/Ftp")) + self.ftpProxyPortSpin.setValue(EricPreferences.getNetworkProxy("ProxyPort/Ftp")) self.ftpProxyTypeCombo.setCurrentIndex( - self.ftpProxyTypeCombo.findData(Preferences.getUI("ProxyType/Ftp").value) + self.ftpProxyTypeCombo.findData( + EricPreferences.getNetworkProxy("ProxyType/Ftp").value + ) + ) + self.ftpProxyUserEdit.setText(EricPreferences.getNetworkProxy("ProxyUser/Ftp")) + self.ftpProxyPasswordEdit.setText( + EricPreferences.getNetworkProxy("ProxyPassword/Ftp") ) - self.ftpProxyUserEdit.setText(Preferences.getUI("ProxyUser/Ftp")) - self.ftpProxyPasswordEdit.setText(Preferences.getUI("ProxyPassword/Ftp")) - self.ftpProxyAccountEdit.setText(Preferences.getUI("ProxyAccount/Ftp")) + self.ftpProxyAccountEdit.setText( + EricPreferences.getNetworkProxy("ProxyAccount/Ftp") + ) - self.httpProxyForAllCheckBox.setChecked(Preferences.getUI("UseHttpProxyForAll")) - if not Preferences.getUI("UseProxy"): + self.httpProxyForAllCheckBox.setChecked( + EricPreferences.getNetworkProxy("UseHttpProxyForAll") + ) + if not EricPreferences.getNetworkProxy("UseProxy"): self.noProxyButton.setChecked(True) - elif Preferences.getUI("UseSystemProxy"): + elif EricPreferences.getNetworkProxy("UseSystemProxy"): self.systemProxyButton.setChecked(True) else: self.manualProxyButton.setChecked(True) self.exceptionsEdit.setText( - ", ".join(Preferences.getUI("ProxyExceptions").split(",")) + ", ".join(EricPreferences.getNetworkProxy("ProxyExceptions").split(",")) ) def save(self): """ Public slot to save the Networj configuration. """ - Preferences.setUI("UseProxy", not self.noProxyButton.isChecked()) - Preferences.setUI("UseSystemProxy", self.systemProxyButton.isChecked()) - Preferences.setUI( + EricPreferences.setNetworkProxy("UseProxy", not self.noProxyButton.isChecked()) + EricPreferences.setNetworkProxy( + "UseSystemProxy", self.systemProxyButton.isChecked() + ) + EricPreferences.setNetworkProxy( "UseHttpProxyForAll", self.httpProxyForAllCheckBox.isChecked() ) - Preferences.setUI( + EricPreferences.setNetworkProxy( "ProxyExceptions", ",".join([h.strip() for h in self.exceptionsEdit.text().split(",")]), ) # HTTP proxy - Preferences.setUI("ProxyHost/Http", self.httpProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Http", self.httpProxyPortSpin.value()) + EricPreferences.setNetworkProxy("ProxyHost/Http", self.httpProxyHostEdit.text()) + EricPreferences.setNetworkProxy( + "ProxyPort/Http", self.httpProxyPortSpin.value() + ) # HTTPS proxy - Preferences.setUI("ProxyHost/Https", self.httpsProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Https", self.httpsProxyPortSpin.value()) + EricPreferences.setNetworkProxy( + "ProxyHost/Https", self.httpsProxyHostEdit.text() + ) + EricPreferences.setNetworkProxy( + "ProxyPort/Https", self.httpsProxyPortSpin.value() + ) # FTP proxy - Preferences.setUI("ProxyHost/Ftp", self.ftpProxyHostEdit.text()) - Preferences.setUI("ProxyPort/Ftp", self.ftpProxyPortSpin.value()) - Preferences.setUI( + EricPreferences.setNetworkProxy("ProxyHost/Ftp", self.ftpProxyHostEdit.text()) + EricPreferences.setNetworkProxy("ProxyPort/Ftp", self.ftpProxyPortSpin.value()) + EricPreferences.setNetworkProxy( "ProxyType/Ftp", EricFtpProxyType(self.ftpProxyTypeCombo.currentData()) ) - Preferences.setUI("ProxyUser/Ftp", self.ftpProxyUserEdit.text()) - Preferences.setUI("ProxyPassword/Ftp", self.ftpProxyPasswordEdit.text()) - Preferences.setUI("ProxyAccount/Ftp", self.ftpProxyAccountEdit.text()) + EricPreferences.setNetworkProxy("ProxyUser/Ftp", self.ftpProxyUserEdit.text()) + EricPreferences.setNetworkProxy( + "ProxyPassword/Ftp", self.ftpProxyPasswordEdit.text() + ) + EricPreferences.setNetworkProxy( + "ProxyAccount/Ftp", self.ftpProxyAccountEdit.text() + ) @pyqtSlot() def on_clearProxyPasswordsButton_clicked(self): """ Private slot to clear the saved HTTP(S) proxy passwords. """ - Preferences.setUI("ProxyPassword/Http", "") - Preferences.setUI("ProxyPassword/Https", "") + EricPreferences.setNetworkProxy("ProxyPassword/Http", "") + EricPreferences.setNetworkProxy("ProxyPassword/Https", "") @pyqtSlot(int) def on_ftpProxyTypeCombo_currentIndexChanged(self, index):
--- a/src/eric7/Preferences/ConfigurationPages/Ui_NetworkPage.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/Ui_NetworkPage.py Thu Sep 26 15:49:36 2024 +0200 @@ -1,6 +1,6 @@ # Form implementation generated from reading ui file 'src/eric7/Preferences/ConfigurationPages/NetworkPage.ui' # -# Created by: PyQt6 UI code generator 6.7.0 +# Created by: PyQt6 UI code generator 6.7.1 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. @@ -12,7 +12,7 @@ class Ui_NetworkPage(object): def setupUi(self, NetworkPage): NetworkPage.setObjectName("NetworkPage") - NetworkPage.resize(589, 1129) + NetworkPage.resize(589, 524) self.verticalLayout_7 = QtWidgets.QVBoxLayout(NetworkPage) self.verticalLayout_7.setObjectName("verticalLayout_7") self.headerLabel = QtWidgets.QLabel(parent=NetworkPage) @@ -80,141 +80,10 @@ self.verticalLayout_3.addWidget(self.closeOnFinishedCheckBox) self.verticalLayout_6.addWidget(self.displayGroup) self.verticalLayout_7.addWidget(self.groupBox_2) - self.proxyGroup = QtWidgets.QGroupBox(parent=NetworkPage) - self.proxyGroup.setCheckable(False) - self.proxyGroup.setChecked(False) - self.proxyGroup.setObjectName("proxyGroup") - self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.proxyGroup) - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.noProxyButton = QtWidgets.QRadioButton(parent=self.proxyGroup) - self.noProxyButton.setChecked(True) - self.noProxyButton.setObjectName("noProxyButton") - self.verticalLayout_4.addWidget(self.noProxyButton) - self.systemProxyButton = QtWidgets.QRadioButton(parent=self.proxyGroup) - self.systemProxyButton.setObjectName("systemProxyButton") - self.verticalLayout_4.addWidget(self.systemProxyButton) - self.manualProxyButton = QtWidgets.QRadioButton(parent=self.proxyGroup) - self.manualProxyButton.setChecked(False) - self.manualProxyButton.setObjectName("manualProxyButton") - self.verticalLayout_4.addWidget(self.manualProxyButton) - self.groupBox = QtWidgets.QGroupBox(parent=self.proxyGroup) - self.groupBox.setEnabled(False) - self.groupBox.setFlat(False) - self.groupBox.setObjectName("groupBox") - self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) - self.verticalLayout.setObjectName("verticalLayout") - self.groupBox_6 = QtWidgets.QGroupBox(parent=self.groupBox) - self.groupBox_6.setObjectName("groupBox_6") - self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_6) - self.gridLayout_2.setObjectName("gridLayout_2") - self.label_13 = QtWidgets.QLabel(parent=self.groupBox_6) - self.label_13.setObjectName("label_13") - self.gridLayout_2.addWidget(self.label_13, 0, 0, 1, 1) - self.httpProxyHostEdit = QtWidgets.QLineEdit(parent=self.groupBox_6) - self.httpProxyHostEdit.setObjectName("httpProxyHostEdit") - self.gridLayout_2.addWidget(self.httpProxyHostEdit, 0, 1, 1, 1) - self.label_2 = QtWidgets.QLabel(parent=self.groupBox_6) - self.label_2.setObjectName("label_2") - self.gridLayout_2.addWidget(self.label_2, 0, 2, 1, 1) - self.httpProxyPortSpin = QtWidgets.QSpinBox(parent=self.groupBox_6) - self.httpProxyPortSpin.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight) - self.httpProxyPortSpin.setMinimum(1) - self.httpProxyPortSpin.setMaximum(65535) - self.httpProxyPortSpin.setProperty("value", 80) - self.httpProxyPortSpin.setObjectName("httpProxyPortSpin") - self.gridLayout_2.addWidget(self.httpProxyPortSpin, 0, 3, 1, 1) - self.httpProxyForAllCheckBox = QtWidgets.QCheckBox(parent=self.groupBox_6) - self.httpProxyForAllCheckBox.setObjectName("httpProxyForAllCheckBox") - self.gridLayout_2.addWidget(self.httpProxyForAllCheckBox, 1, 0, 1, 4) - self.verticalLayout.addWidget(self.groupBox_6) - self.groupBox_5 = QtWidgets.QGroupBox(parent=self.groupBox) - self.groupBox_5.setObjectName("groupBox_5") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.groupBox_5) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label_12 = QtWidgets.QLabel(parent=self.groupBox_5) - self.label_12.setObjectName("label_12") - self.horizontalLayout_2.addWidget(self.label_12) - self.httpsProxyHostEdit = QtWidgets.QLineEdit(parent=self.groupBox_5) - self.httpsProxyHostEdit.setObjectName("httpsProxyHostEdit") - self.horizontalLayout_2.addWidget(self.httpsProxyHostEdit) - self.label_5 = QtWidgets.QLabel(parent=self.groupBox_5) - self.label_5.setObjectName("label_5") - self.horizontalLayout_2.addWidget(self.label_5) - self.httpsProxyPortSpin = QtWidgets.QSpinBox(parent=self.groupBox_5) - self.httpsProxyPortSpin.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight) - self.httpsProxyPortSpin.setMinimum(1) - self.httpsProxyPortSpin.setMaximum(65535) - self.httpsProxyPortSpin.setProperty("value", 443) - self.httpsProxyPortSpin.setObjectName("httpsProxyPortSpin") - self.horizontalLayout_2.addWidget(self.httpsProxyPortSpin) - self.verticalLayout.addWidget(self.groupBox_5) - self.groupBox_4 = QtWidgets.QGroupBox(parent=self.groupBox) - self.groupBox_4.setObjectName("groupBox_4") - self.gridLayout = QtWidgets.QGridLayout(self.groupBox_4) - self.gridLayout.setObjectName("gridLayout") - self.label_8 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_8.setObjectName("label_8") - self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1) - self.ftpProxyTypeCombo = QtWidgets.QComboBox(parent=self.groupBox_4) - self.ftpProxyTypeCombo.setObjectName("ftpProxyTypeCombo") - self.gridLayout.addWidget(self.ftpProxyTypeCombo, 0, 1, 1, 3) - self.label_3 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) - self.ftpProxyHostEdit = QtWidgets.QLineEdit(parent=self.groupBox_4) - self.ftpProxyHostEdit.setObjectName("ftpProxyHostEdit") - self.gridLayout.addWidget(self.ftpProxyHostEdit, 1, 1, 1, 1) - self.label_7 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_7.setObjectName("label_7") - self.gridLayout.addWidget(self.label_7, 1, 2, 1, 1) - self.ftpProxyPortSpin = QtWidgets.QSpinBox(parent=self.groupBox_4) - self.ftpProxyPortSpin.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight) - self.ftpProxyPortSpin.setMinimum(1) - self.ftpProxyPortSpin.setMaximum(65535) - self.ftpProxyPortSpin.setProperty("value", 21) - self.ftpProxyPortSpin.setObjectName("ftpProxyPortSpin") - self.gridLayout.addWidget(self.ftpProxyPortSpin, 1, 3, 1, 1) - self.label_9 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_9.setObjectName("label_9") - self.gridLayout.addWidget(self.label_9, 2, 0, 1, 1) - self.ftpProxyUserEdit = QtWidgets.QLineEdit(parent=self.groupBox_4) - self.ftpProxyUserEdit.setObjectName("ftpProxyUserEdit") - self.gridLayout.addWidget(self.ftpProxyUserEdit, 2, 1, 1, 3) - self.label_10 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_10.setObjectName("label_10") - self.gridLayout.addWidget(self.label_10, 3, 0, 1, 1) - self.ftpProxyPasswordEdit = QtWidgets.QLineEdit(parent=self.groupBox_4) - self.ftpProxyPasswordEdit.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password) - self.ftpProxyPasswordEdit.setObjectName("ftpProxyPasswordEdit") - self.gridLayout.addWidget(self.ftpProxyPasswordEdit, 3, 1, 1, 3) - self.label_11 = QtWidgets.QLabel(parent=self.groupBox_4) - self.label_11.setObjectName("label_11") - self.gridLayout.addWidget(self.label_11, 4, 0, 1, 1) - self.ftpProxyAccountEdit = QtWidgets.QLineEdit(parent=self.groupBox_4) - self.ftpProxyAccountEdit.setObjectName("ftpProxyAccountEdit") - self.gridLayout.addWidget(self.ftpProxyAccountEdit, 4, 1, 1, 3) - self.verticalLayout.addWidget(self.groupBox_4) - self.verticalLayout_4.addWidget(self.groupBox) - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.label = QtWidgets.QLabel(parent=self.proxyGroup) - self.label.setObjectName("label") - self.horizontalLayout_3.addWidget(self.label) - self.exceptionsEdit = QtWidgets.QLineEdit(parent=self.proxyGroup) - self.exceptionsEdit.setObjectName("exceptionsEdit") - self.horizontalLayout_3.addWidget(self.exceptionsEdit) - self.verticalLayout_4.addLayout(self.horizontalLayout_3) - self.clearProxyPasswordsButton = QtWidgets.QPushButton(parent=self.proxyGroup) - self.clearProxyPasswordsButton.setObjectName("clearProxyPasswordsButton") - self.verticalLayout_4.addWidget(self.clearProxyPasswordsButton) - self.verticalLayout_7.addWidget(self.proxyGroup) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) self.verticalLayout_7.addItem(spacerItem) self.retranslateUi(NetworkPage) - self.manualProxyButton.toggled['bool'].connect(self.groupBox.setEnabled) # type: ignore - self.httpProxyForAllCheckBox.toggled['bool'].connect(self.groupBox_5.setDisabled) # type: ignore - self.httpProxyForAllCheckBox.toggled['bool'].connect(self.groupBox_4.setDisabled) # type: ignore QtCore.QMetaObject.connectSlotsByName(NetworkPage) NetworkPage.setTabOrder(self.dynamicOnlineCheckBox, self.downloadDirPicker) NetworkPage.setTabOrder(self.downloadDirPicker, self.requestFilenameCheckBox) @@ -223,22 +92,6 @@ NetworkPage.setTabOrder(self.cleanupExitButton, self.cleanupSuccessfulButton) NetworkPage.setTabOrder(self.cleanupSuccessfulButton, self.openOnStartCheckBox) NetworkPage.setTabOrder(self.openOnStartCheckBox, self.closeOnFinishedCheckBox) - NetworkPage.setTabOrder(self.closeOnFinishedCheckBox, self.noProxyButton) - NetworkPage.setTabOrder(self.noProxyButton, self.systemProxyButton) - NetworkPage.setTabOrder(self.systemProxyButton, self.manualProxyButton) - NetworkPage.setTabOrder(self.manualProxyButton, self.httpProxyHostEdit) - NetworkPage.setTabOrder(self.httpProxyHostEdit, self.httpProxyPortSpin) - NetworkPage.setTabOrder(self.httpProxyPortSpin, self.httpProxyForAllCheckBox) - NetworkPage.setTabOrder(self.httpProxyForAllCheckBox, self.httpsProxyHostEdit) - NetworkPage.setTabOrder(self.httpsProxyHostEdit, self.httpsProxyPortSpin) - NetworkPage.setTabOrder(self.httpsProxyPortSpin, self.ftpProxyTypeCombo) - NetworkPage.setTabOrder(self.ftpProxyTypeCombo, self.ftpProxyHostEdit) - NetworkPage.setTabOrder(self.ftpProxyHostEdit, self.ftpProxyPortSpin) - NetworkPage.setTabOrder(self.ftpProxyPortSpin, self.ftpProxyUserEdit) - NetworkPage.setTabOrder(self.ftpProxyUserEdit, self.ftpProxyPasswordEdit) - NetworkPage.setTabOrder(self.ftpProxyPasswordEdit, self.ftpProxyAccountEdit) - NetworkPage.setTabOrder(self.ftpProxyAccountEdit, self.exceptionsEdit) - NetworkPage.setTabOrder(self.exceptionsEdit, self.clearProxyPasswordsButton) def retranslateUi(self, NetworkPage): _translate = QtCore.QCoreApplication.translate @@ -263,42 +116,4 @@ self.openOnStartCheckBox.setText(_translate("NetworkPage", "Open when starting download")) self.closeOnFinishedCheckBox.setToolTip(_translate("NetworkPage", "Select to close the download manager dialog when the last download is finished")) self.closeOnFinishedCheckBox.setText(_translate("NetworkPage", "Close when downloads finished")) - self.proxyGroup.setToolTip(_translate("NetworkPage", "Select to use a web proxy")) - self.proxyGroup.setTitle(_translate("NetworkPage", "Network Proxy")) - self.noProxyButton.setToolTip(_translate("NetworkPage", "Select to not use a network proxy")) - self.noProxyButton.setText(_translate("NetworkPage", "Do not use proxy")) - self.systemProxyButton.setToolTip(_translate("NetworkPage", "Select to use the system proxy configuration")) - self.systemProxyButton.setText(_translate("NetworkPage", "Use system proxy configuration")) - self.manualProxyButton.setToolTip(_translate("NetworkPage", "Select to use an application specific proxy configuration")) - self.manualProxyButton.setText(_translate("NetworkPage", "Manual proxy configuration:")) - self.groupBox.setTitle(_translate("NetworkPage", "Manual proxy settings")) - self.groupBox_6.setTitle(_translate("NetworkPage", "HTTP-Proxy")) - self.label_13.setText(_translate("NetworkPage", "Hostname:")) - self.httpProxyHostEdit.setToolTip(_translate("NetworkPage", "Enter the name of the HTTP proxy host")) - self.label_2.setText(_translate("NetworkPage", "Port:")) - self.httpProxyPortSpin.setToolTip(_translate("NetworkPage", "Enter the HTTP proxy port")) - self.httpProxyForAllCheckBox.setToolTip(_translate("NetworkPage", "Select to use the HTTP proxy for all")) - self.httpProxyForAllCheckBox.setText(_translate("NetworkPage", "Use this proxy for all protocols")) - self.groupBox_5.setTitle(_translate("NetworkPage", "HTTPS-Proxy")) - self.label_12.setText(_translate("NetworkPage", "Hostname:")) - self.httpsProxyHostEdit.setToolTip(_translate("NetworkPage", "Enter the name of the HTTPS proxy host")) - self.label_5.setText(_translate("NetworkPage", "Port:")) - self.httpsProxyPortSpin.setToolTip(_translate("NetworkPage", "Enter the HTTPS proxy port")) - self.groupBox_4.setTitle(_translate("NetworkPage", "FTP-Proxy")) - self.label_8.setText(_translate("NetworkPage", "Proxy Type:")) - self.ftpProxyTypeCombo.setToolTip(_translate("NetworkPage", "Select the type of the FTP proxy")) - self.label_3.setText(_translate("NetworkPage", "Hostname:")) - self.ftpProxyHostEdit.setToolTip(_translate("NetworkPage", "Enter the name of the FTP proxy host")) - self.label_7.setText(_translate("NetworkPage", "Port:")) - self.ftpProxyPortSpin.setToolTip(_translate("NetworkPage", "Enter the FTP proxy port")) - self.label_9.setText(_translate("NetworkPage", "User Name:")) - self.ftpProxyUserEdit.setToolTip(_translate("NetworkPage", "Enter the user name for the proxy authentication")) - self.label_10.setText(_translate("NetworkPage", "Password:")) - self.ftpProxyPasswordEdit.setToolTip(_translate("NetworkPage", "Enter the password for the proxy authentication")) - self.label_11.setText(_translate("NetworkPage", "Account:")) - self.ftpProxyAccountEdit.setToolTip(_translate("NetworkPage", "Enter the account info for the proxy authentication")) - self.label.setText(_translate("NetworkPage", "Exceptions:")) - self.exceptionsEdit.setToolTip(_translate("NetworkPage", "Enter host names or IP-addresses for which the proxy is to be circumvented separated by \',\' (wildcards * or ? may be used)")) - self.clearProxyPasswordsButton.setToolTip(_translate("NetworkPage", "Press to clear the saved passwords for the Http(s) proxy")) - self.clearProxyPasswordsButton.setText(_translate("NetworkPage", "Clear HTTP(S) Proxy Passwords")) from eric7.EricWidgets.EricPathPicker import EricPathPicker
--- a/src/eric7/Preferences/__init__.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Preferences/__init__.py Thu Sep 26 15:49:36 2024 +0200 @@ -48,16 +48,16 @@ QWebEngineSettings = None from eric7 import EricUtilities, Globals -from eric7.EricNetwork.EricFtp import EricFtpProxyType +from eric7.EricCore import EricPreferences from eric7.EricUtilities import toBool, toByteArray, toDict, toList # noqa +from eric7.EricUtilities.crypto import pwConvert +from eric7.EricUtilities.crypto.py3PBKDF2 import hashPassword from eric7.EricWidgets import EricFileDialog from eric7.EricWidgets.EricApplication import ericApp from eric7.EricWidgets.EricIconBar import EricIconBar from eric7.QScintilla.QsciScintillaCompat import QsciScintillaPrintColorMode from eric7.QScintilla.Shell import ShellHistoryStyle from eric7.SystemUtilities import OSUtilities, PythonUtilities, QtUtilities -from eric7.Utilities.crypto import pwConvert -from eric7.Utilities.crypto.py3PBKDF2 import hashPassword class Prefs: @@ -206,24 +206,6 @@ # 3 = weekly # 4 = monthly "DynamicOnlineCheck": True, - "UseProxy": False, - "UseSystemProxy": True, - "UseHttpProxyForAll": False, - "ProxyHost/Http": "", - "ProxyHost/Https": "", - "ProxyHost/Ftp": "", - "ProxyPort/Http": 80, - "ProxyPort/Https": 443, - "ProxyPort/Ftp": 21, - "ProxyUser/Http": "", - "ProxyUser/Https": "", - "ProxyUser/Ftp": "", - "ProxyPassword/Http": "", - "ProxyPassword/Https": "", - "ProxyPassword/Ftp": "", - "ProxyType/Ftp": EricFtpProxyType.NO_PROXY, - "ProxyAccount/Ftp": "", - "ProxyExceptions": "localhost,127.0.0.,::1", "PluginRepositoryUrl7": ( "https://eric-ide.python-projects.org/plugins7/repository.xml" ), @@ -1907,6 +1889,7 @@ as well. """ Prefs.settings.sync() + EricPreferences.syncPreferences() def exportPreferences(): @@ -2243,9 +2226,6 @@ "ShowSplash", "SplitOrientationVertical", "DynamicOnlineCheck", - "UseProxy", - "UseSystemProxy", - "UseHttpProxyForAll", "RequestDownloadFilename", "CheckErrorLog", "OpenCrashSessionOnStartup", @@ -2274,9 +2254,6 @@ elif key in [ "TabViewManagerFilenameLength", "CaptionFilenameLength", - "ProxyPort/Http", - "ProxyPort/Https", - "ProxyPort/Ftp", "OpenOnStartup", "PerformVersionCheck", "RecentNumber", @@ -2287,20 +2264,6 @@ "MinimumMessageTypeSeverity", ]: return int(Prefs.settings.value("UI/" + key, Prefs.uiDefaults[key])) - elif key in [ - "ProxyType/Ftp", - ]: - return EricFtpProxyType( - int(Prefs.settings.value("UI/" + key, Prefs.uiDefaults[key].value)) - ) - elif key in [ - "ProxyPassword/Http", - "ProxyPassword/Https", - "ProxyPassword/Ftp", - ]: - return pwConvert( - Prefs.settings.value("UI/" + key, Prefs.uiDefaults[key]), encode=False - ) elif key in ("LogStdErrColour", "IconBarColor"): col = Prefs.settings.value("UI/" + key) if col is not None: @@ -2374,17 +2337,6 @@ Prefs.settings.setValue("UI/" + key, json.dumps(profiles)) elif key in ("LogStdErrColour", "IconBarColor"): Prefs.settings.setValue("UI/" + key, value.name()) - elif key in [ - "ProxyPassword/Http", - "ProxyPassword/Https", - "ProxyPassword/Ftp", - ]: - Prefs.settings.setValue("UI/" + key, pwConvert(value, encode=True)) - elif key in [ - "ProxyType/Ftp", - ]: - # value is an enum.Enum derived item - Prefs.settings.setValue("UI/" + key, value.value) else: Prefs.settings.setValue("UI/" + key, value) @@ -4370,21 +4322,8 @@ @param newPassword new password @type str """ - from eric7.Utilities.crypto import pwRecode - - for key in [ - "ProxyPassword/Http", - "ProxyPassword/Https", - "ProxyPassword/Ftp", - ]: - Prefs.settings.setValue( - "UI/" + key, - pwRecode( - Prefs.settings.value("UI/" + key, Prefs.uiDefaults[key]), - oldPassword, - newPassword, - ), - ) + from eric7.EricUtilities.crypto import pwRecode + for key in ["MailServerPassword"]: Prefs.settings.setValue( "User/" + key, @@ -4406,9 +4345,12 @@ ), ) + EricPreferences.convertPasswords(oldPassword, newPassword) + initPreferences(withMigration=True) initRecentSettings() +EricPreferences.initPreferences() # # eflag: noqa = M201, M613
--- a/src/eric7/QScintilla/Exporters/ExporterHTML.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/QScintilla/Exporters/ExporterHTML.py Thu Sep 26 15:49:36 2024 +0200 @@ -19,7 +19,7 @@ from PyQt6.QtGui import QFontInfo from PyQt6.QtWidgets import QInputDialog -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.EricGui.EricOverrideCursor import EricOverrideCursor from eric7.EricWidgets import EricMessageBox from eric7.UI.Previewers import MarkdownExtensions, PreviewerHTMLStyles @@ -375,7 +375,7 @@ column -= 1 # will be incremented again later elif len(utf8Ch) == utf8Len: ch = utf8Ch.decode("utf8") - html += Utilities.html_encode(ch) + html += EricUtilities.html_encode(ch) utf8Ch = b"" utf8Len = 0 else:
--- a/src/eric7/QScintilla/SpellCheckingDialog.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/QScintilla/SpellCheckingDialog.py Thu Sep 26 15:49:36 2024 +0200 @@ -10,7 +10,7 @@ from PyQt6.QtCore import pyqtSlot from PyQt6.QtWidgets import QDialog -from eric7 import Utilities +from eric7 import EricUtilities from .Ui_SpellCheckingDialog import Ui_SpellCheckingDialog @@ -75,9 +75,9 @@ self.changeEdit.setText(self.word) self.contextLabel.setText( '{0}<font color="#FF0000">{1}</font>{2}'.format( - Utilities.html_encode(lcontext), + EricUtilities.html_encode(lcontext), self.word, - Utilities.html_encode(rcontext), + EricUtilities.html_encode(rcontext), ) ) suggestions = self.__spell.getSuggestions(self.word)
--- a/src/eric7/RemoteServerInterface/EricServerInterface.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/RemoteServerInterface/EricServerInterface.py Thu Sep 26 15:49:36 2024 +0200 @@ -20,7 +20,7 @@ from PyQt6.QtNetwork import QAbstractSocket, QTcpSocket from PyQt6.QtWidgets import QDialog, QMenu, QToolBar, QToolButton -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricAction import EricAction from eric7.EricWidgets import EricMessageBox @@ -351,7 +351,7 @@ """ eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(jsonString.strip())), + ).format(str(err), EricUtilities.html_encode(jsonString.strip())), EricMessageBox.Ok, ) return
--- a/src/eric7/Testing/Interfaces/PytestExecutor.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Testing/Interfaces/PytestExecutor.py Thu Sep 26 15:49:36 2024 +0200 @@ -13,6 +13,7 @@ from PyQt6.QtCore import QProcess, pyqtSlot +from eric7 import Preferences from eric7.EricNetwork.EricJsonStreamReader import EricJsonReader from .TestExecutorBase import TestExecutorBase, TestResult, TestResultCategory @@ -205,7 +206,11 @@ @param pythonpath list of directories to be added to the Python path @type list of str """ - self.reader = EricJsonReader(name="Pytest Reader", parent=self) + self.reader = EricJsonReader( + name="Pytest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) self.__config = config @@ -224,7 +229,11 @@ @param pythonpath list of directories to be added to the Python path @type list of str """ - self.reader = EricJsonReader(name="Pytest Reader", parent=self) + self.reader = EricJsonReader( + name="Pytest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) self.__config = config @@ -254,7 +263,11 @@ @param debugger refference to the debugger interface @type DebugUI """ - self.reader = EricJsonReader(name="Pytest Reader", parent=self) + self.reader = EricJsonReader( + name="Pytest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) self.__config = config
--- a/src/eric7/Testing/Interfaces/UnittestExecutor.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Testing/Interfaces/UnittestExecutor.py Thu Sep 26 15:49:36 2024 +0200 @@ -14,6 +14,7 @@ from PyQt6.QtCore import QProcess, pyqtSlot +from eric7 import Preferences from eric7.EricNetwork.EricJsonStreamReader import EricJsonReader from .TestExecutorBase import TestExecutorBase, TestResult, TestResultCategory @@ -171,7 +172,11 @@ @param pythonpath list of directories to be added to the Python path @type list of str """ - self.reader = EricJsonReader(name="Unittest Reader", parent=self) + self.reader = EricJsonReader( + name="Unittest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) super().discover(config, pythonpath) @@ -185,7 +190,11 @@ @param pythonpath list of directories to be added to the Python path @type list of str """ - self.reader = EricJsonReader(name="Unittest Reader", parent=self) + self.reader = EricJsonReader( + name="Unittest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) super().start(config, pythonpath) @@ -201,7 +210,11 @@ @param debugger refference to the debugger interface @type DebugUI """ - self.reader = EricJsonReader(name="Unittest Reader", parent=self) + self.reader = EricJsonReader( + name="Unittest Reader", + interface=Preferences.getDebugger("NetworkInterface"), + parent=self, + ) self.reader.dataReceived.connect(self.__processData) super().startDebug(config, pythonpath, debugger)
--- a/src/eric7/Toolbox/SingleApplication.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Toolbox/SingleApplication.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import QByteArray from PyQt6.QtNetwork import QLocalServer, QLocalSocket -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox @@ -78,7 +78,7 @@ """ data to the eric bugs email address.</p>""" """<p>Error: {0}</p>""" """<p>Data:<br/>{1}</p>""" - ).format(str(err), Utilities.html_encode(line.strip())), + ).format(str(err), EricUtilities.html_encode(line.strip())), EricMessageBox.Ok, ) return
--- a/src/eric7/UI/CodeDocumentationViewerTemplate.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/UI/CodeDocumentationViewerTemplate.py Thu Sep 26 15:49:36 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtCore import QCoreApplication -from eric7 import Utilities +from eric7 import EricUtilities from eric7.EricWidgets.EricApplication import ericApp _stylesheetsCache = { @@ -110,7 +110,7 @@ if name: title = titleTemplate.replace("@NAME@", name) if "argspec" in documentationInfo and documentationInfo["argspec"]: - argspec = Utilities.html_encode(documentationInfo["argspec"]) + argspec = EricUtilities.html_encode(documentationInfo["argspec"]) for char in ["=", ",", "(", ")", "*", "**"]: argspec = argspec.replace( char, '<span class="argspec-highlight">{0}</span>'.format(char)
--- a/src/eric7/UI/UserInterface.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/UI/UserInterface.py Thu Sep 26 15:49:36 2024 +0200 @@ -68,7 +68,7 @@ from eric7.CondaInterface.Conda import Conda from eric7.Debugger.DebugServer import DebugServer from eric7.Debugger.DebugUI import DebugUI -from eric7.EricCore import EricFileSystemWatcher +from eric7.EricCore import EricFileSystemWatcher, EricPreferences from eric7.EricCore.EricStdRedirector import EricStdRedirector from eric7.EricGui import EricPixmapCache from eric7.EricGui.EricAction import EricAction, createActionGroup @@ -239,7 +239,7 @@ self.restoreGeometry(g) self.__startup = True - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: self.__proxyFactory = EricNetworkProxyFactory() @@ -745,7 +745,9 @@ proxyAuthenticationRequired ) if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.__networkManager.sslErrors.connect(self.__sslErrors) self.__replies = [] @@ -7438,7 +7440,7 @@ Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel ) - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: self.__proxyFactory = EricNetworkProxyFactory() @@ -7484,7 +7486,7 @@ pwManager = PasswordManager() pwManager.mainPasswordChanged(oldPassword, newPassword) - Utilities.crypto.changeRememberedMain(newPassword) + EricUtilities.crypto.changeRememberedMain(newPassword) def __reloadAPIs(self): """ @@ -7603,7 +7605,7 @@ EricSslCertificatesDialog, ) - dlg = EricSslCertificatesDialog(self) + dlg = EricSslCertificatesDialog(settings=Preferences.getSettings(), parent=self) dlg.exec() def __clearPrivateData(self):
--- a/src/eric7/Utilities/__init__.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/Utilities/__init__.py Thu Sep 26 15:49:36 2024 +0200 @@ -18,8 +18,6 @@ import sys import warnings -from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32 - import chardet from PyQt6 import sip @@ -35,6 +33,14 @@ from eric7 import Preferences from eric7.__version__ import Version +from eric7.EricUtilities import ( # noqa + decodeBytes, + decodeString, + html_encode, + html_udecode, + html_uencode, + readStringFromStream, +) from eric7.EricWidgets.EricApplication import ericApp from eric7.SystemUtilities import DesktopUtilities, FileSystemUtilities, OSUtilities from eric7.UI.Info import Program @@ -290,15 +296,15 @@ @rtype tuple of (str, str) """ with contextlib.suppress(UnicodeError, LookupError): - if text.startswith(BOM_UTF8): + if text.startswith(codecs.BOM_UTF8): # UTF-8 with BOM - return str(text[len(BOM_UTF8) :], "utf-8"), "utf-8-bom" - elif text.startswith(BOM_UTF16): + return str(text[len(codecs.BOM_UTF8) :], "utf-8"), "utf-8-bom" + elif text.startswith(codecs.BOM_UTF16): # UTF-16 with BOM - return str(text[len(BOM_UTF16) :], "utf-16"), "utf-16" - elif text.startswith(BOM_UTF32): + return str(text[len(codecs.BOM_UTF16) :], "utf-16"), "utf-16" + elif text.startswith(codecs.BOM_UTF32): # UTF-32 with BOM - return str(text[len(BOM_UTF32) :], "utf-32"), "utf-32" + return str(text[len(codecs.BOM_UTF32) :], "utf-32"), "utf-32" coding = get_codingBytes(text) if coding: return str(text, coding), coding @@ -422,7 +428,7 @@ """ encoding = None if origEncoding == "utf-8-bom": - etext, encoding = BOM_UTF8 + text.encode("utf-8"), "utf-8-bom" + etext, encoding = codecs.BOM_UTF8 + text.encode("utf-8"), "utf-8-bom" else: # Try declared coding spec coding = get_coding(text) @@ -470,83 +476,6 @@ return etext, encoding -def decodeString(text): - """ - Function to decode a string containing Unicode encoded characters. - - @param text text containing encoded chars - @type str - @return decoded text - @rtype str - """ - buf = b"" - index = 0 - while index < len(text): - if text[index] == "\\": - qb = QByteArray.fromHex(text[index : index + 4].encode()) - buf += bytes(qb) - index += 4 - else: - buf += codecs.encode(text[index], "utf-8") - index += 1 - buf = buf.replace(b"\x00", b"") - return decodeBytes(buf) - - -def decodeBytes(buffer): - """ - Function to decode some byte text into a string. - - @param buffer byte buffer to decode - @type bytes - @return decoded text - @rtype str - """ - # try UTF with BOM - with contextlib.suppress(UnicodeError, LookupError): - if buffer.startswith(BOM_UTF8): - # UTF-8 with BOM - return str(buffer[len(BOM_UTF8) :], encoding="utf-8") - elif buffer.startswith(BOM_UTF16): - # UTF-16 with BOM - return str(buffer[len(BOM_UTF16) :], encoding="utf-16") - elif buffer.startswith(BOM_UTF32): - # UTF-32 with BOM - return str(buffer[len(BOM_UTF32) :], encoding="utf-32") - - # try UTF-8 - with contextlib.suppress(UnicodeError): - return str(buffer, encoding="utf-8") - - # try codec detection - try: - guess = chardet.detect(buffer) - if guess and guess["encoding"] is not None: - codec = guess["encoding"].lower() - return str(buffer, encoding=codec) - except (LookupError, UnicodeError): - pass - except ImportError: - pass - - return str(buffer, encoding="utf-8", errors="ignore") - - -def readStringFromStream(stream): - """ - Module function to read a string from the given stream. - - @param stream data stream opened for reading - @type QDataStream - @return string read from the stream - @rtype str - """ - data = stream.readString() - if data is None: - data = b"" - return data.decode("utf-8") - - def normalizeCode(codestring): """ Function to normalize the given code. @@ -564,120 +493,6 @@ return codestring -_escape = re.compile("[&<>\"'\u0080-\uffff]") - -_escape_map = { - "&": "&", - "<": "<", - ">": ">", - '"': """, - "'": "'", -} - - -def escape_entities(m, escmap=_escape_map): - """ - Function to encode html entities. - - @param m the match object - @type re.Match - @param escmap the map of entities to encode - @type dict - @return the converted text - @rtype str - """ - char = m.group() - text = escmap.get(char) - if text is None: - text = "&#{0:d};".format(ord(char)) - return text - - -def html_encode(text, pattern=_escape): - """ - Function to correctly encode a text for html. - - @param text text to be encoded - @type str - @param pattern search pattern for text to be encoded - @type str - @return the encoded text - @rtype str - """ - if not text: - return "" - text = pattern.sub(escape_entities, text) - return text - - -_uescape = re.compile("[\u0080-\uffff]") - - -def escape_uentities(m): - """ - Function to encode html entities. - - @param m the match object - @type re.Match - @return the converted text - @rtype str - """ - char = m.group() - text = "&#{0:d};".format(ord(char)) - return text - - -def html_uencode(text, pattern=_uescape): - """ - Function to correctly encode a unicode text for html. - - @param text text to be encoded - @type str - @param pattern search pattern for text to be encoded - @type str - @return the encoded text - @rtype str - """ - if not text: - return "" - text = pattern.sub(escape_uentities, text) - return text - - -_uunescape = re.compile(r"&#\d+;") - - -def unescape_uentities(m): - """ - Function to decode html entities. - - @param m the match object - @type re.Match - @return the converted text - @rtype str - """ - char = m.group() - ordinal = int(char[2:-1]) - return chr(ordinal) - - -def html_udecode(text, pattern=_uunescape): - """ - Function to correctly decode a html text to a unicode text. - - @param text text to be decoded - @type str - @param pattern search pattern for text to be decoded - @type str - @return the decoded text - @rtype str - """ - if not text: - return "" - text = pattern.sub(unescape_uentities, text) - return text - - def convertLineEnds(text, eol): """ Function to convert the end of line characters.
--- a/src/eric7/Utilities/crypto/__init__.py Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,350 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2011 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Package implementing cryptography related functionality. -""" - -import base64 -import random - -from PyQt6.QtCore import QCoreApplication -from PyQt6.QtWidgets import QInputDialog, QLineEdit - -from eric7 import Preferences -from eric7.EricWidgets import EricMessageBox - -############################################################################### -## password handling functions below -############################################################################### - - -EncodeMarker = "CE4" -CryptoMarker = "CR5" - -Delimiter = "$" - -MainPassword = None - - -def pwEncode(pw): - """ - Module function to encode a password. - - @param pw password to encode - @type str - @return encoded password - @rtype str - """ - pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,;:-_!$?*+#" - rpw = "".join(random.sample(pop, 32)) + pw + "".join(random.sample(pop, 32)) - return EncodeMarker + base64.b64encode(rpw.encode("utf-8")).decode("ascii") - - -def pwDecode(epw): - """ - Module function to decode a password. - - @param epw encoded password to decode - @type str - @return decoded password - @rtype str - """ - if not epw.startswith(EncodeMarker): - return epw # it was not encoded using pwEncode - - return base64.b64decode(epw[3:].encode("ascii"))[32:-32].decode("utf-8") - - -def __getMainPassword(): - """ - Private module function to get the password from the user. - """ - from .py3PBKDF2 import verifyPassword - - global MainPassword - - pw, ok = QInputDialog.getText( - None, - QCoreApplication.translate("Crypto", "Main Password"), - QCoreApplication.translate("Crypto", "Enter the main password:"), - QLineEdit.EchoMode.Password, - ) - if ok: - mainPassword = Preferences.getUser("MainPassword") - try: - if mainPassword: - if verifyPassword(pw, mainPassword): - MainPassword = pwEncode(pw) - else: - EricMessageBox.warning( - None, - QCoreApplication.translate("Crypto", "Main Password"), - QCoreApplication.translate( - "Crypto", """The given password is incorrect.""" - ), - ) - else: - EricMessageBox.critical( - None, - QCoreApplication.translate("Crypto", "Main Password"), - QCoreApplication.translate( - "Crypto", """There is no main password registered.""" - ), - ) - except ValueError as why: - EricMessageBox.warning( - None, - QCoreApplication.translate("Crypto", "Main Password"), - QCoreApplication.translate( - "Crypto", - """<p>The given password cannot be verified.</p>""" - """<p>Reason: {0}""".format(str(why)), - ), - ) - - -def pwEncrypt(pw, mainPW=None): - """ - Module function to encrypt a password. - - @param pw password to encrypt - @type str - @param mainPW password to be used for encryption - @type str - @return encrypted password (string) and flag indicating success - @rtype bool - """ - from .py3AES import encryptData - from .py3PBKDF2 import hashPasswordTuple - - if mainPW is None: - if MainPassword is None: - __getMainPassword() - if MainPassword is None: - return "", False - - mainPW = pwDecode(MainPassword) - - digestname, iterations, salt, pwHash = hashPasswordTuple(mainPW) - key = pwHash[:32] - try: - cipher = encryptData(key, pw.encode("utf-8")) - except ValueError: - return "", False - return ( - CryptoMarker - + Delimiter.join( - [ - digestname, - str(iterations), - base64.b64encode(salt).decode("ascii"), - base64.b64encode(cipher).decode("ascii"), - ] - ), - True, - ) - - -def pwDecrypt(epw, mainPW=None): - """ - Module function to decrypt a password. - - @param epw hashed password to decrypt - @type str - @param mainPW password to be used for decryption - @type str - @return decrypted password (string) and flag indicating success - @rtype bool - """ - from .py3AES import decryptData - from .py3PBKDF2 import rehashPassword - - if not epw.startswith(CryptoMarker): - return epw, False # it was not encoded using pwEncrypt - - if mainPW is None: - if MainPassword is None: - __getMainPassword() - if MainPassword is None: - return "", False - - mainPW = pwDecode(MainPassword) - - hashParameters, epw = epw[3:].rsplit(Delimiter, 1) - try: - # recreate the key used to encrypt - key = rehashPassword(mainPW, hashParameters)[:32] - plaintext = decryptData(key, base64.b64decode(epw.encode("ascii"))) - except ValueError: - return "", False - return plaintext.decode("utf-8"), True - - -def pwReencrypt(epw, oldPassword, newPassword): - """ - Module function to re-encrypt a password. - - @param epw hashed password to re-encrypt - @type str - @param oldPassword password used to encrypt - @type str - @param newPassword new password to be used - @type str - @return encrypted password (string) and flag indicating success - @rtype bool - """ - plaintext, ok = pwDecrypt(epw, oldPassword) - if ok: - return pwEncrypt(plaintext, newPassword) - else: - return "", False - - -def pwRecode(epw, oldPassword, newPassword): - """ - Module function to re-encode a password. - - In case of an error the encoded password is returned unchanged. - - @param epw encoded password to re-encode - @type str - @param oldPassword password used to encode - @type str - @param newPassword new password to be used - @type str - @return encoded password - @rtype str - """ - if epw == "": - return epw - - if newPassword == "": - plaintext, ok = pwDecrypt(epw) - return pwEncode(plaintext) if ok else epw - else: - if oldPassword == "": - plaintext = pwDecode(epw) - cipher, ok = pwEncrypt(plaintext, newPassword) - return cipher if ok else epw - else: - npw, ok = pwReencrypt(epw, oldPassword, newPassword) - return npw if ok else epw - - -def pwConvert(pw, encode=True): - """ - Module function to convert a plaintext password to the encoded form or - vice versa. - - If there is an error, an empty code is returned for the encode function - or the given encoded password for the decode function. - - @param pw password to encode - @type str - @param encode flag indicating an encode or decode function - @type bool - @return encoded or decoded password - @rtype str - """ - if pw == "": - return pw - - if encode: - # plain text -> encoded - if Preferences.getUser("UseMainPassword"): - epw = pwEncrypt(pw)[0] - else: - epw = pwEncode(pw) - return epw - else: - # encoded -> plain text - if Preferences.getUser("UseMainPassword"): - plain, ok = pwDecrypt(pw) - else: - plain, ok = pwDecode(pw), True - return plain if ok else pw - - -def changeRememberedMain(newPassword): - """ - Module function to change the remembered main password. - - @param newPassword new password to be used - @type str - """ - global MainPassword - MainPassword = pwEncode(newPassword) if newPassword else None - - -def dataEncrypt(data, password, keyLength=32, hashIterations=10000): - """ - Module function to encrypt a password. - - @param data data to encrypt - @type bytes - @param password password to be used for encryption - @type str - @param keyLength length of the key to be generated for encryption (16, 24 or 32) - @type int - @param hashIterations number of hashes to be applied to the password for - generating the encryption key - @type int - @return encrypted data (bytes) and flag indicating success - @rtype bool - """ - from .py3AES import encryptData - from .py3PBKDF2 import hashPasswordTuple - - digestname, iterations, salt, pwHash = hashPasswordTuple( - password, iterations=hashIterations - ) - key = pwHash[:keyLength] - try: - cipher = encryptData(key, data) - except ValueError: - return b"", False - return ( - CryptoMarker.encode("utf-8") - + Delimiter.encode("utf-8").join( - [ - digestname.encode("utf-8"), - str(iterations).encode("utf-8"), - base64.b64encode(salt), - base64.b64encode(cipher), - ] - ), - True, - ) - - -def dataDecrypt(edata, password, keyLength=32): - """ - Module function to decrypt a password. - - @param edata hashed data to decrypt - @type str - @param password password to be used for decryption - @type str - @param keyLength length of the key to be generated for decryption (16, 24 or 32) - @type int - @return decrypted data (bytes) and flag indicating success - @rtype bool - """ - from .py3AES import decryptData - from .py3PBKDF2 import rehashPassword - - if not edata.startswith(CryptoMarker.encode("utf-8")): - return edata, False # it was not encoded using dataEncrypt - - hashParametersBytes, edata = edata[3:].rsplit(Delimiter.encode("utf-8"), 1) - hashParameters = hashParametersBytes.decode() - try: - # recreate the key used to encrypt - key = rehashPassword(password, hashParameters)[:keyLength] - plaintext = decryptData(key, base64.b64decode(edata)) - except ValueError: - return "", False - return plaintext, True
--- a/src/eric7/Utilities/crypto/py3AES.py Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1662 +0,0 @@ -# -*- coding: utf-8 -*- - -# -# aes.py: implements AES - Advanced Encryption Standard -# from the SlowAES project, http://code.google.com/p/slowaes/ -# -# Copyright (c) 2008 Josh Davis ( http://www.josh-davis.org ), -# Alex Martelli ( http://www.aleax.it ) -# -# Ported from C code written by Laurent Haan -# ( http://www.progressive-coding.com ) -# -# Licensed under the Apache License, Version 2.0 -# http://www.apache.org/licenses/ -# - -# -# Ported to Python3 -# -# Copyright (c) 2011 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing classes for encryption according -Advanced Encryption Standard. -""" - -import math -import os - - -def append_PKCS7_padding(b): - """ - Function to pad the given data to a multiple of 16-bytes by PKCS7 padding. - - @param b data to be padded - @type bytes - @return padded data - @rtype bytes - """ - numpads = 16 - (len(b) % 16) - return b + numpads * bytes(chr(numpads), encoding="ascii") - - -def strip_PKCS7_padding(b): - """ - Function to strip off PKCS7 padding. - - @param b data to be stripped - @type bytes - @return stripped data - @rtype bytes - @exception ValueError data padding is invalid - """ - if len(b) % 16 or not b: - raise ValueError("Data of len {0} can't be PCKS7-padded".format(len(b))) - numpads = b[-1] - if numpads > 16: - raise ValueError("Data ending with {0} can't be PCKS7-padded".format(b[-1])) - return b[:-numpads] - - -class AES: - """ - Class implementing the Advanced Encryption Standard algorithm. - """ - - # valid key sizes - KeySize = { - "SIZE_128": 16, - "SIZE_192": 24, - "SIZE_256": 32, - } - - # Rijndael S-box - sbox = [ - 0x63, - 0x7C, - 0x77, - 0x7B, - 0xF2, - 0x6B, - 0x6F, - 0xC5, - 0x30, - 0x01, - 0x67, - 0x2B, - 0xFE, - 0xD7, - 0xAB, - 0x76, - 0xCA, - 0x82, - 0xC9, - 0x7D, - 0xFA, - 0x59, - 0x47, - 0xF0, - 0xAD, - 0xD4, - 0xA2, - 0xAF, - 0x9C, - 0xA4, - 0x72, - 0xC0, - 0xB7, - 0xFD, - 0x93, - 0x26, - 0x36, - 0x3F, - 0xF7, - 0xCC, - 0x34, - 0xA5, - 0xE5, - 0xF1, - 0x71, - 0xD8, - 0x31, - 0x15, - 0x04, - 0xC7, - 0x23, - 0xC3, - 0x18, - 0x96, - 0x05, - 0x9A, - 0x07, - 0x12, - 0x80, - 0xE2, - 0xEB, - 0x27, - 0xB2, - 0x75, - 0x09, - 0x83, - 0x2C, - 0x1A, - 0x1B, - 0x6E, - 0x5A, - 0xA0, - 0x52, - 0x3B, - 0xD6, - 0xB3, - 0x29, - 0xE3, - 0x2F, - 0x84, - 0x53, - 0xD1, - 0x00, - 0xED, - 0x20, - 0xFC, - 0xB1, - 0x5B, - 0x6A, - 0xCB, - 0xBE, - 0x39, - 0x4A, - 0x4C, - 0x58, - 0xCF, - 0xD0, - 0xEF, - 0xAA, - 0xFB, - 0x43, - 0x4D, - 0x33, - 0x85, - 0x45, - 0xF9, - 0x02, - 0x7F, - 0x50, - 0x3C, - 0x9F, - 0xA8, - 0x51, - 0xA3, - 0x40, - 0x8F, - 0x92, - 0x9D, - 0x38, - 0xF5, - 0xBC, - 0xB6, - 0xDA, - 0x21, - 0x10, - 0xFF, - 0xF3, - 0xD2, - 0xCD, - 0x0C, - 0x13, - 0xEC, - 0x5F, - 0x97, - 0x44, - 0x17, - 0xC4, - 0xA7, - 0x7E, - 0x3D, - 0x64, - 0x5D, - 0x19, - 0x73, - 0x60, - 0x81, - 0x4F, - 0xDC, - 0x22, - 0x2A, - 0x90, - 0x88, - 0x46, - 0xEE, - 0xB8, - 0x14, - 0xDE, - 0x5E, - 0x0B, - 0xDB, - 0xE0, - 0x32, - 0x3A, - 0x0A, - 0x49, - 0x06, - 0x24, - 0x5C, - 0xC2, - 0xD3, - 0xAC, - 0x62, - 0x91, - 0x95, - 0xE4, - 0x79, - 0xE7, - 0xC8, - 0x37, - 0x6D, - 0x8D, - 0xD5, - 0x4E, - 0xA9, - 0x6C, - 0x56, - 0xF4, - 0xEA, - 0x65, - 0x7A, - 0xAE, - 0x08, - 0xBA, - 0x78, - 0x25, - 0x2E, - 0x1C, - 0xA6, - 0xB4, - 0xC6, - 0xE8, - 0xDD, - 0x74, - 0x1F, - 0x4B, - 0xBD, - 0x8B, - 0x8A, - 0x70, - 0x3E, - 0xB5, - 0x66, - 0x48, - 0x03, - 0xF6, - 0x0E, - 0x61, - 0x35, - 0x57, - 0xB9, - 0x86, - 0xC1, - 0x1D, - 0x9E, - 0xE1, - 0xF8, - 0x98, - 0x11, - 0x69, - 0xD9, - 0x8E, - 0x94, - 0x9B, - 0x1E, - 0x87, - 0xE9, - 0xCE, - 0x55, - 0x28, - 0xDF, - 0x8C, - 0xA1, - 0x89, - 0x0D, - 0xBF, - 0xE6, - 0x42, - 0x68, - 0x41, - 0x99, - 0x2D, - 0x0F, - 0xB0, - 0x54, - 0xBB, - 0x16, - ] - - # Rijndael Inverted S-box - rsbox = [ - 0x52, - 0x09, - 0x6A, - 0xD5, - 0x30, - 0x36, - 0xA5, - 0x38, - 0xBF, - 0x40, - 0xA3, - 0x9E, - 0x81, - 0xF3, - 0xD7, - 0xFB, - 0x7C, - 0xE3, - 0x39, - 0x82, - 0x9B, - 0x2F, - 0xFF, - 0x87, - 0x34, - 0x8E, - 0x43, - 0x44, - 0xC4, - 0xDE, - 0xE9, - 0xCB, - 0x54, - 0x7B, - 0x94, - 0x32, - 0xA6, - 0xC2, - 0x23, - 0x3D, - 0xEE, - 0x4C, - 0x95, - 0x0B, - 0x42, - 0xFA, - 0xC3, - 0x4E, - 0x08, - 0x2E, - 0xA1, - 0x66, - 0x28, - 0xD9, - 0x24, - 0xB2, - 0x76, - 0x5B, - 0xA2, - 0x49, - 0x6D, - 0x8B, - 0xD1, - 0x25, - 0x72, - 0xF8, - 0xF6, - 0x64, - 0x86, - 0x68, - 0x98, - 0x16, - 0xD4, - 0xA4, - 0x5C, - 0xCC, - 0x5D, - 0x65, - 0xB6, - 0x92, - 0x6C, - 0x70, - 0x48, - 0x50, - 0xFD, - 0xED, - 0xB9, - 0xDA, - 0x5E, - 0x15, - 0x46, - 0x57, - 0xA7, - 0x8D, - 0x9D, - 0x84, - 0x90, - 0xD8, - 0xAB, - 0x00, - 0x8C, - 0xBC, - 0xD3, - 0x0A, - 0xF7, - 0xE4, - 0x58, - 0x05, - 0xB8, - 0xB3, - 0x45, - 0x06, - 0xD0, - 0x2C, - 0x1E, - 0x8F, - 0xCA, - 0x3F, - 0x0F, - 0x02, - 0xC1, - 0xAF, - 0xBD, - 0x03, - 0x01, - 0x13, - 0x8A, - 0x6B, - 0x3A, - 0x91, - 0x11, - 0x41, - 0x4F, - 0x67, - 0xDC, - 0xEA, - 0x97, - 0xF2, - 0xCF, - 0xCE, - 0xF0, - 0xB4, - 0xE6, - 0x73, - 0x96, - 0xAC, - 0x74, - 0x22, - 0xE7, - 0xAD, - 0x35, - 0x85, - 0xE2, - 0xF9, - 0x37, - 0xE8, - 0x1C, - 0x75, - 0xDF, - 0x6E, - 0x47, - 0xF1, - 0x1A, - 0x71, - 0x1D, - 0x29, - 0xC5, - 0x89, - 0x6F, - 0xB7, - 0x62, - 0x0E, - 0xAA, - 0x18, - 0xBE, - 0x1B, - 0xFC, - 0x56, - 0x3E, - 0x4B, - 0xC6, - 0xD2, - 0x79, - 0x20, - 0x9A, - 0xDB, - 0xC0, - 0xFE, - 0x78, - 0xCD, - 0x5A, - 0xF4, - 0x1F, - 0xDD, - 0xA8, - 0x33, - 0x88, - 0x07, - 0xC7, - 0x31, - 0xB1, - 0x12, - 0x10, - 0x59, - 0x27, - 0x80, - 0xEC, - 0x5F, - 0x60, - 0x51, - 0x7F, - 0xA9, - 0x19, - 0xB5, - 0x4A, - 0x0D, - 0x2D, - 0xE5, - 0x7A, - 0x9F, - 0x93, - 0xC9, - 0x9C, - 0xEF, - 0xA0, - 0xE0, - 0x3B, - 0x4D, - 0xAE, - 0x2A, - 0xF5, - 0xB0, - 0xC8, - 0xEB, - 0xBB, - 0x3C, - 0x83, - 0x53, - 0x99, - 0x61, - 0x17, - 0x2B, - 0x04, - 0x7E, - 0xBA, - 0x77, - 0xD6, - 0x26, - 0xE1, - 0x69, - 0x14, - 0x63, - 0x55, - 0x21, - 0x0C, - 0x7D, - ] - - # Rijndael Rcon - Rcon = [ - 0x8D, - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1B, - 0x36, - 0x6C, - 0xD8, - 0xAB, - 0x4D, - 0x9A, - 0x2F, - 0x5E, - 0xBC, - 0x63, - 0xC6, - 0x97, - 0x35, - 0x6A, - 0xD4, - 0xB3, - 0x7D, - 0xFA, - 0xEF, - 0xC5, - 0x91, - 0x39, - 0x72, - 0xE4, - 0xD3, - 0xBD, - 0x61, - 0xC2, - 0x9F, - 0x25, - 0x4A, - 0x94, - 0x33, - 0x66, - 0xCC, - 0x83, - 0x1D, - 0x3A, - 0x74, - 0xE8, - 0xCB, - 0x8D, - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1B, - 0x36, - 0x6C, - 0xD8, - 0xAB, - 0x4D, - 0x9A, - 0x2F, - 0x5E, - 0xBC, - 0x63, - 0xC6, - 0x97, - 0x35, - 0x6A, - 0xD4, - 0xB3, - 0x7D, - 0xFA, - 0xEF, - 0xC5, - 0x91, - 0x39, - 0x72, - 0xE4, - 0xD3, - 0xBD, - 0x61, - 0xC2, - 0x9F, - 0x25, - 0x4A, - 0x94, - 0x33, - 0x66, - 0xCC, - 0x83, - 0x1D, - 0x3A, - 0x74, - 0xE8, - 0xCB, - 0x8D, - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1B, - 0x36, - 0x6C, - 0xD8, - 0xAB, - 0x4D, - 0x9A, - 0x2F, - 0x5E, - 0xBC, - 0x63, - 0xC6, - 0x97, - 0x35, - 0x6A, - 0xD4, - 0xB3, - 0x7D, - 0xFA, - 0xEF, - 0xC5, - 0x91, - 0x39, - 0x72, - 0xE4, - 0xD3, - 0xBD, - 0x61, - 0xC2, - 0x9F, - 0x25, - 0x4A, - 0x94, - 0x33, - 0x66, - 0xCC, - 0x83, - 0x1D, - 0x3A, - 0x74, - 0xE8, - 0xCB, - 0x8D, - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1B, - 0x36, - 0x6C, - 0xD8, - 0xAB, - 0x4D, - 0x9A, - 0x2F, - 0x5E, - 0xBC, - 0x63, - 0xC6, - 0x97, - 0x35, - 0x6A, - 0xD4, - 0xB3, - 0x7D, - 0xFA, - 0xEF, - 0xC5, - 0x91, - 0x39, - 0x72, - 0xE4, - 0xD3, - 0xBD, - 0x61, - 0xC2, - 0x9F, - 0x25, - 0x4A, - 0x94, - 0x33, - 0x66, - 0xCC, - 0x83, - 0x1D, - 0x3A, - 0x74, - 0xE8, - 0xCB, - 0x8D, - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1B, - 0x36, - 0x6C, - 0xD8, - 0xAB, - 0x4D, - 0x9A, - 0x2F, - 0x5E, - 0xBC, - 0x63, - 0xC6, - 0x97, - 0x35, - 0x6A, - 0xD4, - 0xB3, - 0x7D, - 0xFA, - 0xEF, - 0xC5, - 0x91, - 0x39, - 0x72, - 0xE4, - 0xD3, - 0xBD, - 0x61, - 0xC2, - 0x9F, - 0x25, - 0x4A, - 0x94, - 0x33, - 0x66, - 0xCC, - 0x83, - 0x1D, - 0x3A, - 0x74, - 0xE8, - 0xCB, - ] - - def __getSBoxValue(self, num): - """ - Private method to retrieve a given S-Box value. - - @param num position of the value - @type int - @return value of the S-Box - @rtype int - """ - return self.sbox[num] - - def __getSBoxInvert(self, num): - """ - Private method to retrieve a given Inverted S-Box value. - - @param num position of the value - @type int - @return value of the Inverted S-Box - @rtype int - """ - return self.rsbox[num] - - def __rotate(self, data): - """ - Private method performing Rijndael's key schedule rotate operation. - - Rotate the data word eight bits to the left: eg, - rotate(1d2c3a4f) == 2c3a4f1d. - - @param data data of size 4 - @type bytearray - @return rotated data - @rtype bytearray - """ - return data[1:] + data[:1] - - def __getRconValue(self, num): - """ - Private method to retrieve a given Rcon value. - - @param num position of the value - @type int - @return Rcon value - @rtype int - """ - return self.Rcon[num] - - def __core(self, data, iteration): - """ - Private method performing the key schedule core operation. - - @param data data to operate on - @type bytearray - @param iteration iteration counter - @type int - @return modified data - @rtype bytearray - """ - # rotate the 32-bit word 8 bits to the left - data = self.__rotate(data) - # apply S-Box substitution on all 4 parts of the 32-bit word - for i in range(4): - data[i] = self.__getSBoxValue(data[i]) - # XOR the output of the rcon operation with i to the first part - # (leftmost) only - data[0] = data[0] ^ self.__getRconValue(iteration) - return data - - def __expandKey(self, key, size, expandedKeySize): - """ - Private method performing Rijndael's key expansion. - - Expands a 128, 192 or 256 bit key into a 176, 208 or 240 bit key. - - @param key key to be expanded - @type bytes or bytearray - @param size size of the key in bytes (16, 24 or 32) - @type int - @param expandedKeySize size of the expanded key - @type int - @return expanded key - @rtype bytearray - """ - # current expanded keySize, in bytes - currentSize = 0 - rconIteration = 1 - expandedKey = bytearray(expandedKeySize) - - # set the 16, 24, 32 bytes of the expanded key to the input key - for j in range(size): - expandedKey[j] = key[j] - currentSize += size - - while currentSize < expandedKeySize: - # assign the previous 4 bytes to the temporary value t - t = expandedKey[currentSize - 4 : currentSize] - - # every 16, 24, 32 bytes we apply the core schedule to t - # and increment rconIteration afterwards - if currentSize % size == 0: - t = self.__core(t, rconIteration) - rconIteration += 1 - # For 256-bit keys, we add an extra sbox to the calculation - if size == self.KeySize["SIZE_256"] and ((currentSize % size) == 16): - for ll in range(4): - t[ll] = self.__getSBoxValue(t[ll]) - - # We XOR t with the four-byte block 16, 24, 32 bytes before the new - # expanded key. This becomes the next four bytes in the expanded - # key. - for m in range(4): - expandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m] - currentSize += 1 # noqa: Y113 - - return expandedKey - - def __addRoundKey(self, state, roundKey): - """ - Private method to add (XORs) the round key to the state. - - @param state state to be changed - @type bytearray - @param roundKey key to be used for the modification - @type bytearray - @return modified state - @rtype bytearray - """ - buf = state[:] - for i in range(16): - buf[i] ^= roundKey[i] - return buf - - def __createRoundKey(self, expandedKey, roundKeyPointer): - """ - Private method to create a round key. - - @param expandedKey expanded key to be used - @type bytearray - @param roundKeyPointer position within the expanded key - @type int - @return round key - @rtype bytearray - """ - roundKey = bytearray(16) - for i in range(4): - for j in range(4): - roundKey[j * 4 + i] = expandedKey[roundKeyPointer + i * 4 + j] - return roundKey - - def __galois_multiplication(self, a, b): - """ - Private method to perform a Galois multiplication of 8 bit characters - a and b. - - @param a first factor - @type bytes - @param b second factor - @type bytes - @return result - @rtype bytes - """ - p = 0 - for _counter in range(8): - if b & 1: - p ^= a - hi_bit_set = a & 0x80 - a <<= 1 - # keep a 8 bit - a &= 0xFF - if hi_bit_set: - a ^= 0x1B - b >>= 1 - return p - - def __subBytes(self, state, isInv): - """ - Private method to substitute all the values from the state with the - value in the SBox using the state value as index for the SBox. - - @param state state to be worked on - @type bytearray - @param isInv flag indicating an inverse operation - @type bool - @return modified state - @rtype bytearray - """ - state = state[:] - getter = self.__getSBoxInvert if isInv else self.__getSBoxValue - for i in range(16): - state[i] = getter(state[i]) - return state - - def __shiftRows(self, state, isInv): - """ - Private method to iterate over the 4 rows and call __shiftRow() with - that row. - - @param state state to be worked on - @type bytearray - @param isInv flag indicating an inverse operation - @type bool - @return modified state - @rtype bytearray - """ - state = state[:] - for i in range(4): - state = self.__shiftRow(state, i * 4, i, isInv) - return state - - def __shiftRow(self, state, statePointer, nbr, isInv): - """ - Private method to shift the bytes of a row to the left. - - @param state state to be worked on - @type bytearray - @param statePointer index into the state - @type int - @param nbr number of positions to shift - @type int - @param isInv flag indicating an inverse operation - @type bool - @return modified state - @rtype bytearray - """ - state = state[:] - for _ in range(nbr): - if isInv: - state[statePointer : statePointer + 4] = ( - state[statePointer + 3 : statePointer + 4] - + state[statePointer : statePointer + 3] - ) - else: - state[statePointer : statePointer + 4] = ( - state[statePointer + 1 : statePointer + 4] - + state[statePointer : statePointer + 1] - ) - return state - - def __mixColumns(self, state, isInv): - """ - Private method to perform a galois multiplication of the 4x4 matrix. - - @param state state to be worked on - @type bytearray - @param isInv flag indicating an inverse operation - @type bool - @return modified state - @rtype bytearray - """ - state = state[:] - # iterate over the 4 columns - for i in range(4): - # construct one column by slicing over the 4 rows - column = state[i : i + 16 : 4] - # apply the __mixColumn on one column - column = self.__mixColumn(column, isInv) - # put the values back into the state - state[i : i + 16 : 4] = column - - return state - - # galois multiplication of 1 column of the 4x4 matrix - def __mixColumn(self, column, isInv): - """ - Private method to perform a galois multiplication of 1 column the - 4x4 matrix. - - @param column column to be worked on - @type bytearray - @param isInv flag indicating an inverse operation - @type bool - @return modified column - @rtype bytearray - """ - column = column[:] - mult = [14, 9, 13, 11] if isInv else [2, 1, 1, 3] - cpy = column[:] - g = self.__galois_multiplication - - column[0] = ( - g(cpy[0], mult[0]) - ^ g(cpy[3], mult[1]) - ^ g(cpy[2], mult[2]) - ^ g(cpy[1], mult[3]) - ) - column[1] = ( - g(cpy[1], mult[0]) - ^ g(cpy[0], mult[1]) - ^ g(cpy[3], mult[2]) - ^ g(cpy[2], mult[3]) - ) - column[2] = ( - g(cpy[2], mult[0]) - ^ g(cpy[1], mult[1]) - ^ g(cpy[0], mult[2]) - ^ g(cpy[3], mult[3]) - ) - column[3] = ( - g(cpy[3], mult[0]) - ^ g(cpy[2], mult[1]) - ^ g(cpy[1], mult[2]) - ^ g(cpy[0], mult[3]) - ) - return column - - def __aes_round(self, state, roundKey): - """ - Private method to apply the 4 operations of the forward round in - sequence. - - @param state state to be worked on - @type bytearray - @param roundKey round key to be used - @type bytearray - @return modified state - @rtype bytearray - """ - state = self.__subBytes(state, False) - state = self.__shiftRows(state, False) - state = self.__mixColumns(state, False) - state = self.__addRoundKey(state, roundKey) - return state - - def __aes_invRound(self, state, roundKey): - """ - Private method to apply the 4 operations of the inverse round in - sequence. - - @param state state to be worked on - @type bytearray - @param roundKey round key to be used - @type bytearray - @return modified state - @rtype bytearray - """ - state = self.__shiftRows(state, True) - state = self.__subBytes(state, True) - state = self.__addRoundKey(state, roundKey) - state = self.__mixColumns(state, True) - return state - - def __aes_main(self, state, expandedKey, nbrRounds): - """ - Private method to do the AES encryption for one round. - - Perform the initial operations, the standard round, and the - final operations of the forward AES, creating a round key for - each round. - - @param state state to be worked on - @type bytearray - @param expandedKey expanded key to be used - @type bytearray - @param nbrRounds number of rounds to be done - @type int - @return modified state - @rtype bytearray - """ - state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) - i = 1 - while i < nbrRounds: - state = self.__aes_round(state, self.__createRoundKey(expandedKey, 16 * i)) - i += 1 - state = self.__subBytes(state, False) - state = self.__shiftRows(state, False) - state = self.__addRoundKey( - state, self.__createRoundKey(expandedKey, 16 * nbrRounds) - ) - return state - - def __aes_invMain(self, state, expandedKey, nbrRounds): - """ - Private method to do the inverse AES encryption for one round. - - Perform the initial operations, the standard round, and the - final operations of the inverse AES, creating a round key for - each round. - - @param state state to be worked on - @type bytearray - @param expandedKey expanded key to be used - @type bytearray - @param nbrRounds number of rounds to be done - @type int - @return modified state - @rtype bytearray - """ - state = self.__addRoundKey( - state, self.__createRoundKey(expandedKey, 16 * nbrRounds) - ) - i = nbrRounds - 1 - while i > 0: - state = self.__aes_invRound( - state, self.__createRoundKey(expandedKey, 16 * i) - ) - i -= 1 - state = self.__shiftRows(state, True) - state = self.__subBytes(state, True) - state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) - return state - - def encrypt(self, iput, key, size): - """ - Public method to encrypt a 128 bit input block against the given key - of size specified. - - @param iput input data - @type bytearray - @param key key to be used - @type bytes or bytearray - @param size key size (16, 24 or 32) - @type int - @return encrypted data - @rtype bytes - @exception ValueError key size is invalid - """ - if size not in self.KeySize.values(): - raise ValueError("Wrong key size given ({0}).".format(size)) - - output = bytearray(16) - # the number of rounds - nbrRounds = 0 - # the 128 bit block to encode - block = bytearray(16) - # set the number of rounds - if size == self.KeySize["SIZE_128"]: - nbrRounds = 10 - elif size == self.KeySize["SIZE_192"]: - nbrRounds = 12 - else: - nbrRounds = 14 - - # the expanded keySize - expandedKeySize = 16 * (nbrRounds + 1) - - # Set the block values, for the block: - # a0,0 a0,1 a0,2 a0,3 - # a1,0 a1,1 a1,2 a1,3 - # a2,0 a2,1 a2,2 a2,3 - # a3,0 a3,1 a3,2 a3,3 - # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3 - # - # iterate over the columns - for i in range(4): - # iterate over the rows - for j in range(4): - block[i + j * 4] = iput[i * 4 + j] - - # expand the key into an 176, 208, 240 bytes key - # the expanded key - expandedKey = self.__expandKey(key, size, expandedKeySize) - - # encrypt the block using the expandedKey - block = self.__aes_main(block, expandedKey, nbrRounds) - - # unmap the block again into the output - for kk in range(4): - # iterate over the rows - for ll in range(4): - output[kk * 4 + ll] = block[kk + ll * 4] - return bytes(output) - - # decrypts a 128 bit input block against the given key of size specified - def decrypt(self, iput, key, size): - """ - Public method to decrypt a 128 bit input block against the given key - of size specified. - - @param iput input data - @type bytearray - @param key key to be used - @type bytes or bytearray - @param size key size (16, 24 or 32) - @type int - @return decrypted data - @rtype bytes - @exception ValueError key size is invalid - """ - if size not in self.KeySize.values(): - raise ValueError("Wrong key size given ({0}).".format(size)) - - output = bytearray(16) - # the number of rounds - nbrRounds = 0 - # the 128 bit block to decode - block = bytearray(16) - # set the number of rounds - - if size == self.KeySize["SIZE_128"]: - nbrRounds = 10 - elif size == self.KeySize["SIZE_192"]: - nbrRounds = 12 - else: - nbrRounds = 14 - - # the expanded keySize - expandedKeySize = 16 * (nbrRounds + 1) - - # Set the block values, for the block: - # a0,0 a0,1 a0,2 a0,3 - # a1,0 a1,1 a1,2 a1,3 - # a2,0 a2,1 a2,2 a2,3 - # a3,0 a3,1 a3,2 a3,3 - # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3 - - # iterate over the columns - for i in range(4): - # iterate over the rows - for j in range(4): - block[i + j * 4] = iput[i * 4 + j] - # expand the key into an 176, 208, 240 bytes key - expandedKey = self.__expandKey(key, size, expandedKeySize) - # decrypt the block using the expandedKey - block = self.__aes_invMain(block, expandedKey, nbrRounds) - # unmap the block again into the output - for kk in range(4): - # iterate over the rows - for ll in range(4): - output[kk * 4 + ll] = block[kk + ll * 4] - return output - - -class AESModeOfOperation: - """ - Class implementing the different AES mode of operations. - """ - - aes = AES() - - # structure of supported modes of operation - ModeOfOperation = { - "OFB": 0, - "CFB": 1, - "CBC": 2, - } - - def __extractBytes(self, inputData, start, end, mode): - """ - Private method to extract a range of bytes from the input. - - @param inputData input data - @type bytes - @param start start index - @type int - @param end end index - @type int - @param mode mode of operation (0, 1, 2) - @type int - @return extracted bytes - @rtype bytearray - """ - if end - start > 16: - end = start + 16 - ar = bytearray(16) if mode == self.ModeOfOperation["CBC"] else bytearray() - - i = start - j = 0 - while len(ar) < end - start: - ar.append(0) - while i < end: - ar[j] = inputData[i] - j += 1 - i += 1 - return ar - - def encrypt(self, inputData, mode, key, size, IV): - """ - Public method to perform the encryption operation. - - @param inputData data to be encrypted - @type bytes - @param mode mode of operation (0, 1 or 2) - @type int - @param key key to be used - @type bytes - @param size length of the key (16, 24 or 32) - @type int - @param IV initialisation vector - @type bytearray - @return tuple with mode of operation, length of the input data and - the encrypted data - @rtype tuple of (int, int, bytes) - @exception ValueError key size is invalid or decrypted data is invalid - """ - if len(key) % size: - raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key)) - if len(IV) % 16: - raise ValueError("IV is not a multiple of 16.") - # the AES input/output - iput = bytearray(16) - output = bytearray() - ciphertext = bytearray(16) - # the output cipher string - cipherOut = bytearray() - # char firstRound - firstRound = True - if inputData: - for j in range(int(math.ceil(float(len(inputData)) / 16))): - start = j * 16 - end = j * 16 + 16 - if end > len(inputData): - end = len(inputData) - plaintext = self.__extractBytes(inputData, start, end, mode) - if mode == self.ModeOfOperation["CFB"]: - if firstRound: - output = self.aes.encrypt(IV, key, size) - firstRound = False - else: - output = self.aes.encrypt(iput, key, size) - for i in range(16): - if len(plaintext) - 1 < i: - ciphertext[i] = 0 ^ output[i] - elif len(output) - 1 < i: - ciphertext[i] = plaintext[i] ^ 0 - elif len(plaintext) - 1 < i and len(output) < i: - ciphertext[i] = 0 ^ 0 - else: - ciphertext[i] = plaintext[i] ^ output[i] - for k in range(end - start): - cipherOut.append(ciphertext[k]) - iput = ciphertext - elif mode == self.ModeOfOperation["OFB"]: - if firstRound: - output = self.aes.encrypt(IV, key, size) - firstRound = False - else: - output = self.aes.encrypt(iput, key, size) - for i in range(16): - if len(plaintext) - 1 < i: - ciphertext[i] = 0 ^ output[i] - elif len(output) - 1 < i: - ciphertext[i] = plaintext[i] ^ 0 - elif len(plaintext) - 1 < i and len(output) < i: - ciphertext[i] = 0 ^ 0 - else: - ciphertext[i] = plaintext[i] ^ output[i] - for k in range(end - start): - cipherOut.append(ciphertext[k]) - iput = output - elif mode == self.ModeOfOperation["CBC"]: - for i in range(16): - if firstRound: - iput[i] = plaintext[i] ^ IV[i] - else: - iput[i] = plaintext[i] ^ ciphertext[i] - firstRound = False - ciphertext = self.aes.encrypt(iput, key, size) - # always 16 bytes because of the padding for CBC - for k in range(16): - cipherOut.append(ciphertext[k]) - return mode, len(inputData), bytes(cipherOut) - - # Mode of Operation Decryption - # cipherIn - Encrypted String - # originalsize - The unencrypted string length - required for CBC - # mode - mode of type modeOfOperation - # key - a number array of the bit length size - # size - the bit length of the key - # IV - the 128 bit number array Initilization Vector - def decrypt(self, cipherIn, originalsize, mode, key, size, IV): - """ - Public method to perform the decryption operation. - - @param cipherIn data to be decrypted - @type bytes - @param originalsize unencrypted string length (required for CBC) - @type int - @param mode mode of operation (0, 1 or 2) - @type int - @param key key to be used - @type bytes - @param size length of the key (16, 24 or 32) - @type int - @param IV initialisation vector - @type bytearray - @return decrypted data - @rtype bytes - @exception ValueError key size is invalid or decrypted data is invalid - """ - if len(key) % size: - raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key)) - if len(IV) % 16: - raise ValueError("IV is not a multiple of 16.") - # the AES input/output - ciphertext = bytearray() - iput = bytearray() - output = bytearray() - plaintext = bytearray(16) - # the output bytes - bytesOut = bytearray() - # char firstRound - firstRound = True - if cipherIn is not None: - for j in range(int(math.ceil(float(len(cipherIn)) / 16))): - start = j * 16 - end = j * 16 + 16 - if j * 16 + 16 > len(cipherIn): - end = len(cipherIn) - ciphertext = cipherIn[start:end] - if mode == self.ModeOfOperation["CFB"]: - if firstRound: - output = self.aes.encrypt(IV, key, size) - firstRound = False - else: - output = self.aes.encrypt(iput, key, size) - for i in range(16): - if len(output) - 1 < i: - plaintext[i] = 0 ^ ciphertext[i] - elif len(ciphertext) - 1 < i: - plaintext[i] = output[i] ^ 0 - elif len(output) - 1 < i and len(ciphertext) < i: - plaintext[i] = 0 ^ 0 - else: - plaintext[i] = output[i] ^ ciphertext[i] - for k in range(end - start): - bytesOut.append(plaintext[k]) - iput = ciphertext - elif mode == self.ModeOfOperation["OFB"]: - if firstRound: - output = self.aes.encrypt(IV, key, size) - firstRound = False - else: - output = self.aes.encrypt(iput, key, size) - for i in range(16): - if len(output) - 1 < i: - plaintext[i] = 0 ^ ciphertext[i] - elif len(ciphertext) - 1 < i: - plaintext[i] = output[i] ^ 0 - elif len(output) - 1 < i and len(ciphertext) < i: - plaintext[i] = 0 ^ 0 - else: - plaintext[i] = output[i] ^ ciphertext[i] - for k in range(end - start): - bytesOut.append(plaintext[k]) - iput = output - elif mode == self.ModeOfOperation["CBC"]: - output = self.aes.decrypt(ciphertext, key, size) - for i in range(16): - if firstRound: - plaintext[i] = IV[i] ^ output[i] - else: - plaintext[i] = iput[i] ^ output[i] - firstRound = False - if originalsize is not None and originalsize < end: - for k in range(originalsize - start): - bytesOut.append(plaintext[k]) - else: - for k in range(end - start): - bytesOut.append(plaintext[k]) - iput = ciphertext - return bytes(bytesOut) - - -def encryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]): - """ - Module function to encrypt the given data with the given key. - - @param key key to be used for encryption - @type bytes - @param data data to be encrypted - @type bytes - @param mode mode of operations (0, 1 or 2) - @type int - @return encrypted data prepended with the initialization vector - @rtype bytes - @exception ValueError raised to indicate an invalid key size - """ - key = bytearray(key) - if mode == AESModeOfOperation.ModeOfOperation["CBC"]: - data = append_PKCS7_padding(data) - keysize = len(key) - if keysize not in AES.KeySize.values(): - raise ValueError("invalid key size: {0}".format(keysize)) - # create a new iv using random data - iv = bytearray(list(os.urandom(16))) - moo = AESModeOfOperation() - _mode, _length, ciph = moo.encrypt(data, mode, key, keysize, iv) - # With padding, the original length does not need to be known. It's a bad - # idea to store the original message length. - # prepend the iv. - return bytes(iv) + bytes(ciph) - - -def decryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]): - """ - Module function to decrypt the given data with the given key. - - @param key key to be used for decryption - @type bytes - @param data data to be decrypted (with initialization vector prepended) - @type bytes - @param mode mode of operations (0, 1 or 2) - @type int - @return decrypted data - @rtype bytes - @exception ValueError raised to indicate an invalid key size - """ - key = bytearray(key) - keysize = len(key) - if keysize not in AES.KeySize.values(): - raise ValueError("invalid key size: {0}".format(keysize)) - # iv is first 16 bytes - iv = bytearray(data[:16]) - data = bytearray(data[16:]) - moo = AESModeOfOperation() - decr = moo.decrypt(data, None, mode, key, keysize, iv) - if mode == AESModeOfOperation.ModeOfOperation["CBC"]: - decr = strip_PKCS7_padding(decr) - return bytes(decr)
--- a/src/eric7/Utilities/crypto/py3PBKDF2.py Thu Sep 26 09:48:49 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing PBKDF2 functions. -""" - -import base64 -import hashlib -import hmac -import os - -Hashes = { - "sha1": hashlib.sha1, - "sha224": hashlib.sha224, - "sha256": hashlib.sha256, - "sha384": hashlib.sha384, - "sha512": hashlib.sha512, - "md5": hashlib.md5, -} - -Delimiter = "$" - - -def pbkdf2(password, salt, iterations, digestMod): - """ - Module function to hash a password according to the PBKDF2 specification. - - @param password clear text password - @type bytes - @param salt salt value - @type bytes - @param iterations number of times hash function should be applied - @type int - @param digestMod hash function - @type function - @return hashed password - @rtype bytes - """ - pwHash = password - for _ in range(iterations): - pwHash = hmac.new(salt, pwHash, digestMod).digest() - return pwHash - - -def hashPasswordTuple( - password, digestMod=hashlib.sha512, iterations=10000, saltSize=32 -): - """ - Module function to hash a password according to the PBKDF2 specification. - - @param password clear text password - @type str - @param digestMod hash function - @type function - @param iterations number of times hash function should be applied - @type int - @param saltSize size of the salt - @type int - @return tuple of digestname, number of iterations, salt and hashed password - @rtype tuple of (str, int, bytes, bytes) - """ - salt = os.urandom(saltSize) - password = password.encode("utf-8") - pwHash = pbkdf2(password, salt, iterations, digestMod) - digestname = digestMod.__name__.replace("openssl_", "") - return digestname, iterations, salt, pwHash - - -def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): - """ - Module function to hash a password according to the PBKDF2 specification. - - @param password clear text password - @type str - @param digestMod hash function - @type function - @param iterations number of times hash function should be applied - @type int - @param saltSize size of the salt - @type int - @return hashed password entry according to PBKDF2 specification - @rtype str - """ - digestname, iterations, salt, pwHash = hashPasswordTuple( - password, digestMod, iterations, saltSize - ) - return Delimiter.join( - [ - digestname, - str(iterations), - base64.b64encode(salt).decode("ascii"), - base64.b64encode(pwHash).decode("ascii"), - ] - ) - - -def verifyPassword(password, pwHash): - """ - Module function to verify a password against a hash encoded password. - - @param password clear text password - @type str - @param pwHash hash encoded password in the form - 'digestmod$iterations$salt$hashed_password' as produced by the - hashPassword function - @type str - @return flag indicating a successfull verification - @rtype bool - @exception ValueError the hash is not of the expected format or the - digest is not one of the known ones - """ - try: - digestname, iterations, salt, pwHash = pwHash.split(Delimiter) - except ValueError: - raise ValueError( - "Expected hash encoded password in format " - "'digestmod{0}iterations{0}salt{0}hashed_password".format(Delimiter) - ) - - if digestname not in Hashes: - raise ValueError( - "Unsupported hash algorithm '{0}' for hash encoded password '{1}'.".format( - digestname, pwHash - ) - ) - - iterations = int(iterations) - salt = base64.b64decode(salt.encode("ascii")) - pwHash = base64.b64decode(pwHash.encode("ascii")) - password = password.encode("utf-8") - return pwHash == pbkdf2(password, salt, iterations, Hashes[digestname]) - - -def rehashPassword(password, hashParameters): - """ - Module function to recreate a password hash given the hash parameters. - - @param password clear text password - @type str - @param hashParameters hash parameters in the form - 'digestmod$iterations$salt' - @type str - @return hashed password - @rtype bytes - @exception ValueError the hash parameters string is not of the expected - format or the digest is not one of the known ones - """ - try: - digestname, iterations, salt = hashParameters.split(Delimiter) - except ValueError: - raise ValueError( - "Expected hash parameters string in format " - "'digestmod{0}iterations{0}salt".format(Delimiter) - ) - - if digestname not in Hashes: - raise ValueError( - "Unsupported hash algorithm '{0}' for hash parameters '{1}'.".format( - digestname, hashParameters - ) - ) - - iterations = int(iterations) - salt = base64.b64decode(salt.encode("ascii")) - password = password.encode("utf-8") - return pbkdf2(password, salt, iterations, Hashes[digestname])
--- a/src/eric7/WebBrowser/Bookmarks/NsHtmlReader.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/Bookmarks/NsHtmlReader.py Thu Sep 26 15:49:36 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtCore import QDateTime, QFile, QIODevice, QObject -from eric7 import Utilities +from eric7 import EricUtilities from .BookmarkNode import BookmarkNode, BookmarkNodeType @@ -80,7 +80,7 @@ arguments = match.group(1) name = match.group(2) node = BookmarkNode(BookmarkNodeType.Folder, folders[-1]) - node.title = Utilities.html_udecode(name) + node.title = EricUtilities.html_udecode(name) node.expanded = self.__foldedRx.search(arguments) is None addedMatch = self.__addedRx.search(arguments) if addedMatch is not None: @@ -97,7 +97,7 @@ arguments = match.group(1) name = match.group(2) node = BookmarkNode(BookmarkNodeType.Bookmark, folders[-1]) - node.title = Utilities.html_udecode(name) + node.title = EricUtilities.html_udecode(name) match1 = self.__urlRx.search(arguments) if match1 is not None: node.url = match1.group(1) @@ -115,7 +115,7 @@ elif match.re is self.__descRx: # description if lastNode: - lastNode.desc = Utilities.html_udecode(match.group(1)) + lastNode.desc = EricUtilities.html_udecode(match.group(1)) elif match.re is self.__separatorRx: # separator definition
--- a/src/eric7/WebBrowser/Bookmarks/NsHtmlWriter.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/Bookmarks/NsHtmlWriter.py Thu Sep 26 15:49:36 2024 +0200 @@ -9,7 +9,7 @@ from PyQt6.QtCore import QFile, QIODevice, QObject -from eric7 import Utilities +from eric7 import EricUtilities, Utilities from .BookmarkNode import BookmarkNodeType @@ -133,7 +133,11 @@ self.__dev.write(" " * indent) self.__dev.write( '<DT><A HREF="{0}"{1}{2}{3}>{4}</A>\n'.format( - node.url, added, modified, visited, Utilities.html_uencode(node.title) + node.url, + added, + modified, + visited, + EricUtilities.html_uencode(node.title), ) ) @@ -165,7 +169,7 @@ self.__dev.write(" " * indent) self.__dev.write( "<DT><H3{0}{1}>{2}</H3>\n".format( - folded, added, Utilities.html_uencode(node.title) + folded, added, EricUtilities.html_uencode(node.title) ) )
--- a/src/eric7/WebBrowser/Network/NetworkManager.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/Network/NetworkManager.py Thu Sep 26 15:49:36 2024 +0200 @@ -20,6 +20,7 @@ from PyQt6.QtWidgets import QDialog, QStyle from eric7 import EricUtilities, Preferences +from eric7.EricCore import EricPreferences from eric7.EricNetwork.EricNetworkProxyFactory import ( EricNetworkProxyFactory, proxyAuthenticationRequired, @@ -63,7 +64,7 @@ super().__init__(parent) self.__proxyFactory = EricNetworkProxyFactory() - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) @@ -72,7 +73,9 @@ self.languagesChanged() if SSL_AVAILABLE: - self.__sslErrorHandler = EricSslErrorHandler(self) + self.__sslErrorHandler = EricSslErrorHandler( + Preferences.getSettings(), self + ) self.sslErrors.connect(self.__sslErrorHandlingSlot) self.__temporarilyIgnoredSslErrors = {} @@ -419,7 +422,7 @@ """ self.__interceptor.preferencesChanged() - if Preferences.getUI("UseSystemProxy"): + if EricPreferences.getNetworkProxy("UseSystemProxy"): QNetworkProxyFactory.setUseSystemConfiguration(True) else: QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory)
--- a/src/eric7/WebBrowser/SpeedDial/SpeedDial.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/SpeedDial/SpeedDial.py Thu Sep 26 15:49:36 2024 +0200 @@ -19,7 +19,7 @@ qWarning, ) -from eric7 import EricUtilities, Utilities +from eric7 import EricUtilities from eric7.EricWidgets import EricMessageBox from eric7.Utilities.AutoSaver import AutoSaver @@ -146,7 +146,7 @@ imgSource = pixmapFileToDataUrl(imgSource, True) self.__initialScript += ("addBox('{0}', '{1}', '{2}');\n").format( - page.url, Utilities.html_uencode(page.title), imgSource + page.url, EricUtilities.html_uencode(page.title), imgSource ) return self.__initialScript
--- a/src/eric7/WebBrowser/Sync/FtpSyncHandler.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/Sync/FtpSyncHandler.py Thu Sep 26 15:49:36 2024 +0200 @@ -15,6 +15,7 @@ from PyQt6.QtCore import QByteArray, QCoreApplication, QTimer, pyqtSignal from eric7 import Preferences +from eric7.EricCore import EricPreferences from eric7.EricNetwork.EricFtp import EricFtp, EricFtpProxyError, EricFtpProxyType from eric7.Utilities.FtpUtilities import FtpDirLineParser, FtpDirLineParserError from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow @@ -80,20 +81,20 @@ # do proxy setup proxyType = ( EricFtpProxyType.NO_PROXY - if not Preferences.getUI("UseProxy") - else Preferences.getUI("ProxyType/Ftp") + if not EricPreferences.getNetworkProxy("UseProxy") + else EricPreferences.getNetworkProxy("ProxyType/Ftp") ) if proxyType != EricFtpProxyType.NO_PROXY: self.__ftp.setProxy( proxyType, - Preferences.getUI("ProxyHost/Ftp"), - Preferences.getUI("ProxyPort/Ftp"), + EricPreferences.getNetworkProxy("ProxyHost/Ftp"), + EricPreferences.getNetworkProxy("ProxyPort/Ftp"), ) if proxyType != EricFtpProxyType.NON_AUTHORIZING: self.__ftp.setProxyAuthentication( - Preferences.getUI("ProxyUser/Ftp"), - Preferences.getUI("ProxyPassword/Ftp"), - Preferences.getUI("ProxyAccount/Ftp"), + EricPreferences.getNetworkProxy("ProxyUser/Ftp"), + EricPreferences.getNetworkProxy("ProxyPassword/Ftp"), + EricPreferences.getNetworkProxy("ProxyAccount/Ftp"), ) QTimer.singleShot(0, self.__doFtpCommands)
--- a/src/eric7/WebBrowser/Sync/SyncHandler.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/Sync/SyncHandler.py Thu Sep 26 15:49:36 2024 +0200 @@ -12,7 +12,7 @@ from PyQt6.QtCore import QByteArray, QObject, pyqtSignal from eric7 import Preferences -from eric7.Utilities.crypto import dataDecrypt, dataEncrypt +from eric7.EricUtilities.crypto import dataDecrypt, dataEncrypt class SyncHandler(QObject):
--- a/src/eric7/WebBrowser/UrlBar/UrlBar.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/UrlBar/UrlBar.py Thu Sep 26 15:49:36 2024 +0200 @@ -17,7 +17,7 @@ except ImportError: QSslCertificate = None # __IGNORE_WARNING__ -from eric7 import Preferences, Utilities +from eric7 import EricUtilities, Preferences from eric7.EricGui import EricPixmapCache from eric7.EricWidgets.EricLineEdit import EricClearableLineEdit, EricLineEditSide from eric7.WebBrowser.SafeBrowsing.SafeBrowsingLabel import SafeBrowsingLabel @@ -442,7 +442,7 @@ if sslConfiguration is not None and QSslCertificate is not None: sslCertificate = self.__browser.page().getSslCertificate() if sslCertificate is not None: - org = Utilities.decodeString( + org = EricUtilities.decodeString( ", ".join( sslCertificate.subjectInfo( QSslCertificate.SubjectInfo.Organization @@ -450,7 +450,7 @@ ) ) if org == "": - cn = Utilities.decodeString( + cn = EricUtilities.decodeString( ", ".join( sslCertificate.subjectInfo( QSslCertificate.SubjectInfo.CommonName
--- a/src/eric7/WebBrowser/WebBrowserWindow.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/WebBrowser/WebBrowserWindow.py Thu Sep 26 15:49:36 2024 +0200 @@ -3782,7 +3782,7 @@ if local: # we were called from our local configuration dialog Preferences.convertPasswords(oldPassword, newPassword) - Utilities.crypto.changeRememberedMain(newPassword) + EricUtilities.crypto.changeRememberedMain(newPassword) @pyqtSlot() def __showAcceptedLanguages(self):
--- a/src/eric7/eric7_ide.py Thu Sep 26 09:48:49 2024 +0200 +++ b/src/eric7/eric7_ide.py Thu Sep 26 15:49:36 2024 +0200 @@ -400,6 +400,12 @@ # Load translation files and install them loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",)) + # generate a graphical error handler + from eric7.EricWidgets import EricErrorMessage # __IGNORE_WARNING_I101__ + + eMsg = EricErrorMessage.qtHandler() + eMsg.setMinimumSize(600, 400) + # Initialize SSL stuff from eric7.EricNetwork.EricSslUtilities import initSSL # __IGNORE_WARNING_I101__ @@ -437,12 +443,6 @@ QTimer.singleShot(0, uiStartUp) - # generate a graphical error handler - from eric7.EricWidgets import EricErrorMessage # __IGNORE_WARNING_I101__ - - eMsg = EricErrorMessage.qtHandler() - eMsg.setMinimumSize(600, 400) - # start the event loop inMainLoop = True res = app.exec()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/icons/breeze-dark/preferences-network-proxy.svg Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,1 @@ +<svg height="22" width="22" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="5.08194" x2="5.08194" y1="19.653846" y2="1.346154"><stop offset="0" stop-color="#54d883"/><stop offset="1" stop-color="#abf9c7"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="7.697324" x2="20.774247" y1="3.961539" y2="17.038462"><stop offset="0" stop-color="#292c2f"/><stop offset="1" stop-opacity="0"/></linearGradient><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="5.08194" x2="5.08194" y1="19.653846" y2="1.346154"><stop offset="0" stop-color="#197cf1"/><stop offset="1" stop-color="#20bcfa"/></linearGradient><linearGradient id="d" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#433a35"/><stop offset="1" stop-color="#997657"/></linearGradient><linearGradient id="e" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#6c5548"/><stop offset="1" stop-color="#997657"/></linearGradient><radialGradient id="f" cx="6" cy="10.999999" gradientUnits="userSpaceOnUse" r="1"><stop offset="0" stop-color="#eff0f1"/><stop offset="1" stop-color="#bdc3c7"/></radialGradient><linearGradient id="g" x1="19" x2="19" xlink:href="#e" y1="19.782609" y2="1.695653"/><linearGradient id="h" x1="18.999999" x2="18.295986" xlink:href="#e" y1="19.999999" y2="19.999999"/><linearGradient id="i" gradientTransform="matrix(1.0000002 0 0 .67999998 -3.000002 -.72)" x1="11" x2="12" xlink:href="#d" y1="29" y2="29"/><linearGradient id="j" gradientUnits="userSpaceOnUse" x1="4" x2="9" y1="11" y2="11"><stop offset="0" stop-color="#997657"/><stop offset="1" stop-color="#d4ba94"/></linearGradient><linearGradient id="k" x1="5" x2="8" xlink:href="#e" y1="3" y2="3"/><linearGradient id="l" x1="3" x2="5" xlink:href="#d" y1="11" y2="11"/><g stroke-width=".653846"><path d="m9 3v15h9v-15z" fill="url(#c)"/><path d="m9 3v15h9v-15z" fill="url(#b)" opacity=".2"/><path d="m14 2-5 1v4l1 1v-1l1-1v-1h1v-1l1-1v1l1-1zm-5 9v5l1 1v1h5l1-1v-1l1-1v-1l-2-1h-1v-1h-1l-2-1z" fill="url(#a)"/></g><path d="m8 2h11v1h-11zm0 16h11v1h-11z" fill="url(#g)" stroke-width=".695652"/><path d="m18 2h1v17h-1z" fill="url(#h)" stroke-width=".704013"/><path d="m8 2h1v17h-1z" fill="url(#i)" stroke-width=".824621"/><g stroke-width=".695652"><path d="m9 3-5-2v20l5-2z" fill="url(#j)"/><path d="m5 3v2h1v-1.5zm2 1v2h1v-1.5zm-2 2v2h1v-1.5zm2 1v2h1v-1.5zm0 6v2l1-.5v-1.5zm-2 1v2l1-.5v-1.5zm2 2v2l1-.5v-1.5zm-2 1v2l1-.5v-1.5z" fill="url(#k)"/><path d="m3 1.5 1-.5v20l-1-.5z" fill="url(#l)"/></g><circle cx="6" cy="11" fill="url(#f)" r="1"/></svg> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/icons/breeze-light/preferences-network-proxy.svg Thu Sep 26 15:49:36 2024 +0200 @@ -0,0 +1,1 @@ +<svg height="22" width="22" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="5.08194" x2="5.08194" y1="19.653846" y2="1.346154"><stop offset="0" stop-color="#54d883"/><stop offset="1" stop-color="#abf9c7"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="7.697324" x2="20.774247" y1="3.961539" y2="17.038462"><stop offset="0" stop-color="#292c2f"/><stop offset="1" stop-opacity="0"/></linearGradient><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="5.08194" x2="5.08194" y1="19.653846" y2="1.346154"><stop offset="0" stop-color="#197cf1"/><stop offset="1" stop-color="#20bcfa"/></linearGradient><linearGradient id="d" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#433a35"/><stop offset="1" stop-color="#997657"/></linearGradient><linearGradient id="e" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#6c5548"/><stop offset="1" stop-color="#997657"/></linearGradient><radialGradient id="f" cx="6" cy="10.999999" gradientUnits="userSpaceOnUse" r="1"><stop offset="0" stop-color="#eff0f1"/><stop offset="1" stop-color="#bdc3c7"/></radialGradient><linearGradient id="g" x1="19" x2="19" xlink:href="#e" y1="19.782609" y2="1.695653"/><linearGradient id="h" x1="18.999999" x2="18.295986" xlink:href="#e" y1="19.999999" y2="19.999999"/><linearGradient id="i" gradientTransform="matrix(1.0000002 0 0 .67999998 -3.000002 -.72)" x1="11" x2="12" xlink:href="#d" y1="29" y2="29"/><linearGradient id="j" gradientUnits="userSpaceOnUse" x1="4" x2="9" y1="11" y2="11"><stop offset="0" stop-color="#997657"/><stop offset="1" stop-color="#d4ba94"/></linearGradient><linearGradient id="k" x1="5" x2="8" xlink:href="#e" y1="3" y2="3"/><linearGradient id="l" x1="3" x2="5" xlink:href="#d" y1="11" y2="11"/><g stroke-width=".653846"><path d="m9 3v15h9v-15z" fill="url(#c)"/><path d="m9 3v15h9v-15z" fill="url(#b)" opacity=".2"/><path d="m14 2-5 1v4l1 1v-1l1-1v-1h1v-1l1-1v1l1-1zm-5 9v5l1 1v1h5l1-1v-1l1-1v-1l-2-1h-1v-1h-1l-2-1z" fill="url(#a)"/></g><path d="m8 2h11v1h-11zm0 16h11v1h-11z" fill="url(#g)" stroke-width=".695652"/><path d="m18 2h1v17h-1z" fill="url(#h)" stroke-width=".704013"/><path d="m8 2h1v17h-1z" fill="url(#i)" stroke-width=".824621"/><g stroke-width=".695652"><path d="m9 3-5-2v20l5-2z" fill="url(#j)"/><path d="m5 3v2h1v-1.5zm2 1v2h1v-1.5zm-2 2v2h1v-1.5zm2 1v2h1v-1.5zm0 6v2l1-.5v-1.5zm-2 1v2l1-.5v-1.5zm2 2v2l1-.5v-1.5zm-2 1v2l1-.5v-1.5z" fill="url(#k)"/><path d="m3 1.5 1-.5v20l-1-.5z" fill="url(#l)"/></g><circle cx="6" cy="11" fill="url(#f)" r="1"/></svg> \ No newline at end of file