Reputation: 51
My code (I use -Dhttps.protocols=TLSv1.2
VM argument when run):
FTPSClient ftpClient = new FTPSClient("TLS", false);
ftpClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out)));
ftpClient.setAuthValue("TLS");
ftpClient.connect("myhost", 990);
ftpClient.login("mylogin", "mypassword");
Stack trace:
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
// too many traces...
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
... 33 more
Log from WinSCP (I can send files using WinSCP):
536 Copying 1 files/directories to remote directory "/" 536 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: Yes; Mask: . 536 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0 536 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml 539 File: 'C:\Users\trescon.jramos\Documents\cliente-dados.sql' [2016-10-06T16:34:29.298Z] [4869] 557 Copying "C:\Users\trescon.jramos\Documents\cliente-dados.sql" to remote directory started. 560 Binary transfer mode selected. 560 Iniciando carregamento de C:\Users\trescon.jramos\Documents\cliente-dados.sql 560 TYPE I 562 200 Type set to I 563 PASV 568 227 Entering Passive Mode (10,28,14,218,250,0) 569 STOR cliente-dados.sql 569 Conectando a 10.28.14.218:64000... 575 150 Opening data channel for file upload to server of "/cliente-dados.sql" 579 Session ID reused 579 Using TLSv1.2, cipher TLSv1/SSLv3: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA, ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD 580 Conexão SSL estabelecida 586 226 Successfully transferred "/cliente-dados.sql" 586 MFMT 20161006163429 cliente-dados.sql 590 213 modify=20161006163429; /cliente-dados.sql 590 Carregamento bem-sucedido 591 Transfer done: 'C:\Users\trescon.jramos\Documents\cliente-dados.sql' [4869]
Upvotes: 3
Views: 2760
Reputation: 202088
You are connecting to port 990, what is an implicit FTPS port. Yet, you are passing false
to isImplicit
argument of FTPSClient
constructor.
Either pass true
, if you really want to use the implicit FTPS:
FTPSClient ftpClient = new FTPSClient("TLS", true);
Or actually, you should really use an explicit FTPS and the default FTP port 21 (as the implicit FTPS is non-standard legacy compatibility hack):
FTPSClient ftpClient = new FTPSClient();
// ...
ftpClient.connect("myhost");
In other words, all you need to use FTPS is use FTPSClient
, no additional arguments or calls are needed.
Upvotes: 0