X-Received: by 2002:ac8:714a:: with SMTP id h10-v6mr9210146qtp.37.1529413609492; Tue, 19 Jun 2018 06:06:49 -0700 (PDT) X-Received: by 2002:a0c:f8c7:: with SMTP id h7-v6mr450218qvo.5.1529413609264; Tue, 19 Jun 2018 06:06:49 -0700 (PDT) Path: csiph.com!xmission!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h2-v6no3367462qtp.0!news-out.google.com!u13-v6ni1007qtg.0!nntp.google.com!h2-v6no3367456qtp.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.security Date: Tue, 19 Jun 2018 06:06:48 -0700 (PDT) In-Reply-To: <1171609488.650914.203230@q2g2000cwa.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:df0:d300:4:862:6fc5:c1fc:42f2; posting-account=tqNqgwoAAABSa9T0VZeXmdPlIEqlqfsP NNTP-Posting-Host: 2001:df0:d300:4:862:6fc5:c1fc:42f2 References: <1171515354.800218.281660@p10g2000cwp.googlegroups.com> <1171609488.650914.203230@q2g2000cwa.googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: SSLException: Unrecognized SSL message, plaintext connection? From: oswalmanish@gmail.com Injection-Date: Tue, 19 Jun 2018 13:06:49 +0000 Content-Type: text/plain; charset="UTF-8" Lines: 88 Xref: csiph.com comp.lang.java.security:325 On Friday, 16 February 2007 12:34:48 UTC+5:30, sva...@gmail.com wrote: > Hi > > I am successful in the following operations > - connecting to the server > - adding the server certificate to the client trustmanager dynamically > (without user intervention - that is the requirement here) > - logging into the server > - getting the details of the current working directory > > But thereon... any other operation fails with the above exception. Is > it something to to do with the SSLSession. Do I have to do something > on the session? > > Thanks again > > SV Hi Could you please share details regarding how did the connection with Server worked as I am facing similar issue . Please see error stack trace [Raw write]: length = 7 0000: 15 03 03 00 02 02 0A ....... main, called closeSocket() javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? main, called close() main, called closeInternal(true) main, called close() main, called closeInternal(true) main, called close() main, called closeInternal(true) at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710) at sun.security.ssl.InputRecord.read(InputRecord.java:527) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) at java.io.BufferedReader.readLine(BufferedReader.java:389) at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294) at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:364) at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:540) at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:167) at org.apache.commons.net.SocketClient.connect(SocketClient.java:178) at com.test.pmp.SftpClient.processDataToFTPSServer(SftpClient.java:102) at com.test.pmp.SftpClient.main(SftpClient.java:77) javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1541) at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1553) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) at java.io.BufferedWriter.flush(BufferedWriter.java:254) at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:472) at org.apache.commons.net.ftp.FTPSClient.sendCommand(FTPSClient.java:465) at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:534) at org.apache.commons.net.ftp.FTP.user(FTP.java:683) at org.apache.commons.net.ftp.FTPClient.login(FTPClient.java:628) at com.test.pmp.SftpClient.processDataToFTPSServer(SftpClient.java:136) at com.test.pmp.SftpClient.main(SftpClient.java:77) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710) at sun.security.ssl.InputRecord.read(InputRecord.java:527) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:928) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) at java.io.BufferedReader.readLine(BufferedReader.java:389) at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:294) at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:364) at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:540) at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:167) at org.apache.commons.net.SocketClient.connect(SocketClient.java:178) at com.test.pmp.SftpClient.processDataToFTPSServer(SftpClient.java:102) ... 1 more