mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Added logic to the XmlConnectionsDocumentCompiler to respect the FullFileEncryption flag
This commit is contained in:
@@ -55,6 +55,14 @@ namespace mRemoteNGTests.Config.Serializers
|
||||
Assert.That(con4, Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void XmlContentEncryptedWhenFullFileEncryptionTurnedOn()
|
||||
{
|
||||
var xdoc = _documentCompiler.CompileDocument(_connectionTreeModel, true, false);
|
||||
var rootElementValue = xdoc.Root?.Value;
|
||||
Assert.That(rootElementValue, Is.Not.EqualTo(string.Empty));
|
||||
}
|
||||
|
||||
|
||||
private ConnectionTreeModel SetupConnectionTreeModel()
|
||||
{
|
||||
|
||||
@@ -32,7 +32,10 @@ namespace mRemoteNG.Config.Serializers
|
||||
|
||||
CompileRecursive(serializationTarget, rootElement);
|
||||
var xmlDeclaration = new XDeclaration("1.0", "utf-8", "");
|
||||
return new XDocument(xmlDeclaration, rootElement);
|
||||
var xmlDocument = new XDocument(xmlDeclaration, rootElement);
|
||||
if (fullFileEncryption)
|
||||
xmlDocument = new XmlConnectionsDocumentEncryptor(_cryptographyProvider).EncryptDocument(xmlDocument, rootNodeInfo.PasswordString.ConvertToSecureString());
|
||||
return xmlDocument;
|
||||
}
|
||||
|
||||
private void CompileRecursive(ConnectionInfo serializationTarget, XContainer parentElement)
|
||||
|
||||
Reference in New Issue
Block a user