-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom definition of SSL encryption protocols for the connection
Add property to define encryption protocols. This allows use of TLS 1.1 and TLS 1.2 protocols, which are disabled by default.
- Loading branch information
Showing
4 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Net; | ||
using System.Net.FtpClient; | ||
using System.Security.Authentication; | ||
|
||
namespace Examples | ||
{ | ||
public static class SetEncryptionProtocolsExample { | ||
public static void ValidateCertificate() | ||
{ | ||
using (FtpClient conn = new FtpClient()) | ||
{ | ||
conn.Host = "localhost"; | ||
conn.Credentials = new NetworkCredential("ftptest", "ftptest"); | ||
conn.EncryptionMode = FtpEncryptionMode.Explicit; | ||
|
||
// Override the default protocols. The example line sets the protocols | ||
// to support TLS 1.1 and TLS 1.2. These are only available if the | ||
// executable targets .NET 4.5 (or higher). The framework does not enable these | ||
// protocols by default. | ||
//conn.SslProtocols = SslProtocols.Default | SslProtocols.Tls11 | SslProtocols.Tls12; | ||
|
||
// Alternate example: Only support the latest level. | ||
//conn.SslProtocols = SslProtocols.Tls12; | ||
|
||
conn.Connect(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters