From d736d3c3889f1adcac4a3dc4070c94636d9bd3ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:07:26 +0000 Subject: [PATCH] Fix connection file encryption with password protection Changed CreateProtectedAttribute to use PasswordString as source of truth instead of Password property. This prevents encryption failures when Password property is true but _customPassword is empty. Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com> --- .../ConnectionSerializers/Xml/XmlRootNodeSerializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs index 12dc9415..a28813eb 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs @@ -28,7 +28,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml private XAttribute CreateProtectedAttribute(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider) { XAttribute attribute = new(XName.Get("Protected"), ""); - string plainText = rootNodeInfo.Password ? "ThisIsProtected" : "ThisIsNotProtected"; + string plainText = (rootNodeInfo.PasswordString != rootNodeInfo.DefaultPassword) ? "ThisIsProtected" : "ThisIsNotProtected"; System.Security.SecureString encryptionPassword = rootNodeInfo.PasswordString.ConvertToSecureString(); attribute.Value = cryptographyProvider.Encrypt(plainText, encryptionPassword); return attribute;