Skip to content

Commit

Permalink
Debugging certification search on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
RikuVirtanen committed Sep 15, 2023
1 parent 5184d24 commit 0f39029
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Frends.FTP.UploadFiles/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [1.0.3] - 2023-099-12
## [1.0.3] - 2023-09-12
### Added
- Added search for local certificates from machine certification store.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,47 @@ public void UploadFTPS_OperationLog()
SetUp();
}
}

[TestMethod]
public void UploadFTPS_LocalMachineHasNoCertificates()
{
var connection = new Connection
{
Address = Helpers.FtpHost,
UserName = Helpers.FtpUsername,
Password = Helpers.FtpPassword,
Port = Helpers.FtpsPort,
SslMode = FtpsSslMode.Explicit,
EnableClientAuth = true,
UseFTPS = true,
ValidateAnyCertificate = false,
CertificateHashStringSHA1 = "",
ClientCertificatePath = ""
};

if (Environment.OSVersion.Platform == PlatformID.Unix)
{
var ex = Assert.ThrowsException<System.Security.Cryptography.CryptographicException>(() =>
{
var result = FTP.UploadFiles(_source, _destination, connection, new Options(), new Info(),
new CancellationToken());

});

Assert.AreEqual("Unix LocalMachine X509Store is limited to the Root and Certif", ex.Message);
}
else
{
var ex = Assert.ThrowsException<AggregateException>(() =>
{
var result = FTP.UploadFiles(_source, _destination, connection, new Options(), new Info(),
new CancellationToken());

});

Assert.AreEqual(1, ex.InnerExceptions.Count);
Assert.AreEqual(typeof(AuthenticationException), ex.InnerExceptions[0].GetType());
}

}
}

0 comments on commit 0f39029

Please sign in to comment.