{"id":5120,"date":"2016-11-18T12:23:10","date_gmt":"2016-11-18T10:23:10","guid":{"rendered":"https:\/\/www.limilabs.com\/blog\/?p=5120"},"modified":"2016-11-28T16:55:13","modified_gmt":"2016-11-28T14:55:13","slug":"use-ftp-tls12-with-ftp-ftps","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/use-ftp-tls12-with-ftp-ftps","title":{"rendered":"Using FTP TLS 1.2 with FTP"},"content":{"rendered":"<p>By default most systems allow SSL 3.0, TLS 1.0, 1.2 and 1.2 to be used.<\/p>\n<p>TLS 1.2 is the most secure version of SSL\/TLS protocols. It is easy to force the connection to use it. All you need to do is to set <em>Ftp.SSLConfiguration.EnabledSslProtocols<\/em> property to SslProtocols.Tls12:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nusing (Ftp ftp = new Ftp())\r\n{\r\n    ftp.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;\r\n\r\n    ftp.ConnectSSL(&quot;ftps.example.com&quot;);\r\n\r\n    ftp.Login(&quot;user&quot;,&quot;password&quot;);\r\n\r\n    ftp.ChangeFolder(&quot;uploads&quot;);\r\n    ftp.Upload(&quot;report.txt&quot;, @&quot;c:\\report.txt&quot;);\r\n\r\n\r\n    ftp.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nUsing ftp As New Ftp()\r\n\tftp.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12\r\n\r\n\tftp.ConnectSSL(&quot;ftps.example.com&quot;)\r\n\r\n\tftp.Login(&quot;user&quot;, &quot;password&quot;)\r\n\r\n\tftp.ChangeFolder(&quot;uploads&quot;)\r\n\tftp.Upload(&quot;report.txt&quot;, &quot;c:\\report.txt&quot;)\r\n\r\n\r\n\tftp.Close()\r\nEnd Using\r\n<\/pre>\n<p>For explicit SSL\/TLS, code is almost the same. You first connect to non-secure port (21) and secure the connection using <em>Ftp.AuthTLS<\/em> command:<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C#\r\n\r\nusing (Ftp ftp = new Ftp())\r\n{\r\n    ftp.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;\r\n\r\n    ftp.Connect(&quot;ftp.example.com&quot;);\r\n    ftp.AuthTLS();\r\n\r\n    ftp.Login(&quot;user&quot;,&quot;password&quot;);\r\n\r\n    ftp.ChangeFolder(&quot;uploads&quot;);\r\n    ftp.Upload(&quot;report.txt&quot;, @&quot;c:\\report.txt&quot;);\r\n\r\n    ftp.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET\r\n\r\nUsing ftp As New Ftp()\r\n\tftp.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12\r\n\r\n\tftp.Connect(&quot;ftp.example.com&quot;)\r\n\tftp.AuthTLS()\r\n\r\n\tftp.Login(&quot;user&quot;, &quot;password&quot;)\r\n\r\n\tftp.ChangeFolder(&quot;uploads&quot;)\r\n\tftp.Upload(&quot;report.txt&quot;, &quot;c:\\report.txt&quot;)\r\n\r\n\tftp.Close()\r\nEnd Using\r\n<\/pre>\n<p>To use TLS 1.2 .NET Framework 4.5+ must be installed on your machine and you application should target .NET 4.5+.<\/p>\n<p>It is possible to use TLS 1.2 in applications targeting .NET lower than 4.5, but 4.5 must be installed on the machine. After you have .NET 4.5 installed, your 2.0-4.0 apps will use the 4.5 System.dll and you can enable TLS 1.2 using this code: <\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n    ftp.SSLConfiguration.EnabledSslProtocols = (System.Security.Authentication.SslProtocols)3072;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>By default most systems allow SSL 3.0, TLS 1.0, 1.2 and 1.2 to be used. TLS 1.2 is the most secure version of SSL\/TLS protocols. It is easy to force the connection to use it. All you need to do is to set Ftp.SSLConfiguration.EnabledSslProtocols property to SslProtocols.Tls12: \/\/ C# using (Ftp ftp = new Ftp()) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-5120","post","type-post","status-publish","format-standard","hentry","category-ftp-dll"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5120"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=5120"}],"version-history":[{"count":11,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5120\/revisions"}],"predecessor-version":[{"id":5143,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/5120\/revisions\/5143"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=5120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=5120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=5120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}