--- a/CertManagement.py Fri Mar 14 14:27:23 2025 +0100
+++ b/CertManagement.py Tue Mar 25 14:31:18 2025 +0100
@@ -10,9 +10,11 @@
from zipfile import ZipFile
from cryptography import x509
+from twisted.internet.ssl import PrivateCertificate from cryptography.x509.oid import ExtensionOID
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from util.paths import AppDataPath
@@ -176,7 +178,8 @@
with open(file_path, "rb") as cert_file:
cert_data = cert_file.read()
- cert = x509.load_pem_x509_certificate(cert_data, default_backend())
+ client_cert = PrivateCertificate.loadPEM(cert_data) + cert = client_cert.original.to_cryptography() # Support for legacy common name
common_names = cert.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)
@@ -193,6 +196,8 @@
info += "Fingerprint: %s\n"%cert.fingerprint(hashes.SHA256()).hex()
info += "Creation date: %s\n"%cert.not_valid_before.isoformat()
info += "Expiration date: %s\n"%cert.not_valid_after.isoformat()
+ except OpenSSL.crypto.Error: + info += "Imported PEM is invalid, it must contain Certificate and Private Key.\n" info += "Error while loading certificate: %s\n"%str(e)
--- a/connectors/WAMP/__init__.py Fri Mar 14 14:27:23 2025 +0100
+++ b/connectors/WAMP/__init__.py Tue Mar 25 14:31:18 2025 +0100
@@ -71,7 +71,9 @@
elif auth in SSL_AUTHENTICATION_TYPES:
- raise Exception("Invalid authentication: "+auth)
+ log = self.config.extra["log"] + log.write_error("WAMP Invalid authentication: %s\n"%auth) self.join(self.config.realm,
authmethods=[accepted_method],
@@ -93,13 +95,15 @@
signature = auth.compute_wcs(key, challenge.extra['challenge'])
- raise Exception("Invalid authmethod {}".format(challenge.method))
+ log = self.config.extra["log"] + log.write_error("Invalid authmethod {}\n".format(challenge.method)) def onJoin(self, details):
global _WampSession, _WampConnectEvent
- print('WAMP session joined for: ', self.config.extra["IDE_ID"])
+ log = self.config.extra["log"] + log.write('WAMP session joined for: %s\n'%self.config.extra["IDE_ID"]) def onLeave(self, details):
global _WampSession, _WampError, _WampConnectEvent
@@ -110,6 +114,9 @@
_WampError = "WAMP authentication failed. Check IDE identity in security manager."
_WampError = "WAMP closed with error {}: {}".format(details.reason, details.message)
+ # this case can go silent if connection was already established, so log it additionally. + log = self.config.extra["log"] + log.write_error(_WampError+"\n") @@ -169,7 +176,8 @@
+ "authentication": auth, + "log": confnodesroot.logger extraconf["secret"] = secret
--- a/controls/OwnIdentityPanel.py Fri Mar 14 14:27:23 2025 +0100
+++ b/controls/OwnIdentityPanel.py Tue Mar 25 14:31:18 2025 +0100
@@ -125,8 +125,8 @@
def OnImportClientCertButton(self, event):
dialog = wx.FileDialog(self, _("Choose a file"),
- wildcard=_("Certificate files (*.crt)|*.crt|All files|*.*"),
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
+ wildcard=_("Certificate files (*.pem)|*.pem|All files|*.*"), if dialog.ShowModal() == wx.ID_OK:
if self._confirm_overwrite_identity():
CertManagement.ImportClientCert(dialog.GetPath())