Skip to content

Commit

Permalink
Added search for certifications
Browse files Browse the repository at this point in the history
  • Loading branch information
RikuVirtanen committed Sep 12, 2023
1 parent 76c276b commit c76c67a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Frends.FTP.DownloadFiles/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

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

## [1.0.4] - 2023-08-08
### Changed
- Moved client.EncryptionMode setting to be done if UseFTPS is enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,25 @@ private static FtpClient CreateFtpClient(Connection connect)
};

if (connect.EnableClientAuth)
client.ClientCertificates.Add(new X509Certificate2(connect.ClientCertificatePath));
{
if (!string.IsNullOrEmpty(connect.ClientCertificatePath))
{
client.ClientCertificates.Add(new X509Certificate2(connect.ClientCertificatePath));
}
else
{
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
try
{
store.Open(OpenFlags.ReadOnly);
client.ClientCertificates.AddRange(store.Certificates);
}
finally
{
store.Close();
}
}
}

client.ValidateCertificate += (control, e) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<IncludeSource>true</IncludeSource>
<PackageTags>Frends</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.0.4</Version>
<Version>1.0.5</Version>
<Description>Task for downloading files from FTP(S) servers.</Description>
</PropertyGroup>

Expand Down

0 comments on commit c76c67a

Please sign in to comment.