mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user