1

Following exception is thrown while connecting to FTPS server : java.io.EOFException: SSL peer shut down incorrectly

Server certificate is added in jre/lib/security/cacerts. Tried with JDK8 and JDK11, but it fails with same exception.

How to fix this issue.

javax.net.debug log (ServerHelloDone onwards) : __________________________________

*** ServerHelloDone
[read] MD5 and SHA1 hashes:  len = 4
0000: 0E 00 00 00                                        ....
*** ECDHClientKeyExchange
ECDH Public value:  { 4, 178, 153, 201, 133, 162, 82, 146, 241, 49, 176, 247, 206, 20, 125, 91, 178, 230, 144, 68, 55, 50, 206, 9, 115, 136, 61, 103, 201, 44, 57, 168, 54, 247, 56, 156, 160, 242, 47, 107, 79, 46, 240, 67, 59, 190, 97, 8, 204, 68, 102, 129, 40, 76, 83, 132, 129, 199, 59, 101, 104, 76, 231, 104, 49 }
[write] MD5 and SHA1 hashes:  len = 70
0000: 10 00 00 42 41 04 B2 99   C9 85 A2 52 92 F1 31 B0  ...BA......R..1.
0010: F7 CE 14 7D 5B B2 E6 90   44 37 32 CE 09 73 88 3D  ....[...D72..s.=
0020: 67 C9 2C 39 A8 36 F7 38   9C A0 F2 2F 6B 4F 2E F0  g.,9.6.8.../kO..
0030: 43 3B BE 61 08 CC 44 66   81 28 4C 53 84 81 C7 3B  C;.a..Df.(LS...;
0040: 65 68 4C E7 68 31                                  ehL.h1
main, WRITE: TLSv1.2 Handshake, length = 70
[Raw write]: length = 75
0000: 16 03 03 00 46 10 00 00   42 41 04 B2 99 C9 85 A2  ....F...BA......
0010: 52 92 F1 31 B0 F7 CE 14   7D 5B B2 E6 90 44 37 32  R..1.....[...D72
0020: CE 09 73 88 3D 67 C9 2C   39 A8 36 F7 38 9C A0 F2  ..s.=g.,9.6.8...
0030: 2F 6B 4F 2E F0 43 3B BE   61 08 CC 44 66 81 28 4C  /kO..C;.a..Df.(L
0040: 53 84 81 C7 3B 65 68 4C   E7 68 31                 S...;ehL.h1
SESSION KEYGEN:
PreMaster Secret:
0000: 31 27 F1 39 95 53 C7 13   68 FB EB 5F A8 30 EE B4  1'.9.S..h.._.0..
0010: 70 AB 88 5A BE EB E7 E2   AC 69 F3 FA 7A DE B3 F4  p..Z.....i..z...
CONNECTION KEYGEN:
Client Nonce:
0000: 62 30 27 77 A0 7F 32 32   D2 1B F0 CB C9 84 B5 E7  b0'w..22........
0010: 64 82 11 26 E5 59 97 03   09 95 E1 64 16 52 39 F0  d..&.Y.....d.R9.
Server Nonce:
0000: 2B E5 19 7C 4C 91 7F CE   11 08 69 36 9D 23 0D BB  +...L.....i6.#..
0010: 04 92 7D 14 12 03 DC 68   83 7C 28 4E 9F B3 B3 C0  .......h..(N....
Master Secret:
0000: 0E 53 1D D1 5D 82 EF 7C   DC B7 41 F2 31 29 19 61  .S..].....A.1).a
0010: B0 92 F1 23 38 BB C7 4D   59 20 8F 4C 0F 50 71 73  ...#8..MY .L.Pqs
0020: FB DE A5 25 F4 7C BD 00   41 61 15 FA C9 4F 3E C4  ...%....Aa...O>.
Client MAC write Secret:
0000: F3 04 24 61 15 44 58 B3   EF 15 CF 6F A5 39 BF BF  ..$a.DX....o.9..
0010: FC CA 5D 36 D6 1A DA AF   1E 77 A3 86 2F 66 23 8C  ..]6.....w../f#.
0020: BE 6C 8B 82 F3 00 20 41   82 19 EA 07 7F 91 28 66  .l.... A......(f
Server MAC write Secret:
0000: E8 0E AA 00 6F 1A 9C 7A   2D 09 34 A1 F4 AA 8D 9C  ....o..z-.4.....
0010: D9 39 81 D3 37 79 C5 D6   D9 DD BB B6 60 05 CC 90  .9..7y......`...
0020: BF 13 AC 9D 28 2E 8E 27   DF 70 3A D2 51 8F 85 43  ....(..'.p:.Q..C
Client write key:
0000: C0 92 A3 06 91 2D BC DF   31 23 FD 02 9A ED BD 27  .....-..1#.....'
0010: 06 E8 F6 1D F7 1F B0 AC   D1 6E DE 1A 34 85 BC F9  .........n..4...
Server write key:
0000: D4 3D 88 0E 35 0D 17 9D   CC 9D 03 DE FD 55 69 67  .=..5........Uig
0010: 05 02 B9 FC E7 68 58 E9   F1 95 2E B5 A1 13 6C BC  .....hX.......l.
... no IV derived for this protocol
main, WRITE: TLSv1.2 Change Cipher Spec, length = 1
[Raw write]: length = 6
0000: 14 03 03 00 01 01                                  ......
*** Finished
verify_data:  { 115, 94, 17, 134, 75, 180, 250, 50, 81, 178, 155, 185 }
***
[write] MD5 and SHA1 hashes:  len = 16
0000: 14 00 00 0C 73 5E 11 86   4B B4 FA 32 51 B2 9B B9  ....s^..K..2Q...
Padded plaintext before ENCRYPTION:  len = 96
0000: 49 0C AE FE DE B7 1F 2A   A6 96 37 B5 A8 1F A0 E0  I......*..7.....
0010: 14 00 00 0C 73 5E 11 86   4B B4 FA 32 51 B2 9B B9  ....s^..K..2Q...
0020: 2E A7 FB 7F 53 04 09 90   FD 99 44 2D 35 C4 84 33  ....S.....D-5..3
0030: 7C 37 5A A5 FD 01 15 0B   0B AE EC F7 AA 79 CC 41  .7Z..........y.A
0040: 3B E0 16 9C FE D8 0C 66   57 57 FC EC 84 7F 69 EE  ;......fWW....i.
0050: 0F 0F 0F 0F 0F 0F 0F 0F   0F 0F 0F 0F 0F 0F 0F 0F  ................
main, WRITE: TLSv1.2 Handshake, length = 96
[Raw write]: length = 101
0000: 16 03 03 00 60 DE 4D 5C   6E 9B D5 16 10 96 70 8F  ....`.M\n.....p.
0010: 8B CD AA 50 86 83 5C 6C   C2 AC A8 4D CD BA 79 03  ...P..\l...M..y.
0020: 27 1E AC F3 82 A7 1A C0   0B 33 1D 37 7A C3 7C 9D  '........3.7z...
0030: E2 46 6D 95 87 3B 7A 98   7B 31 1A AE 17 E4 70 C6  .Fm..;z..1....p.
0040: 11 FD A2 33 65 9E EC B3   5E 89 64 32 E1 5E 8F 52  ...3e...^.d2.^.R
0050: 0B D2 3B 5B 3F D9 62 F4   79 31 19 38 0B 8C 99 32  ..;[?.b.y1.8...2
0060: 56 DE F6 43 F4                                     V..C.
main, received EOFException: error
main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
%% Invalidated:  [Session-4, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384]
main, SEND TLSv1.2 ALERT:  fatal, description = handshake_failure
Padded plaintext before ENCRYPTION:  len = 80
0000: 94 B4 1E B3 29 30 18 E7   E1 F3 D9 0B D5 54 B0 96  ....)0.......T..
0010: 02 28 F1 86 BA 9D 57 52   1F B6 75 17 8A 7F DD 0C  .(....WR..u.....
0020: D2 ED 3A 0B 41 2F D0 4A   43 C0 9F C3 BD 46 08 D5  ..:.A/.JC....F..
0030: 4C 66 3F 6C EC 65 C2 38   B0 8F EA B5 DE 62 52 2A  Lf?l.e.8.....bR*
0040: 96 09 0D 0D 0D 0D 0D 0D   0D 0D 0D 0D 0D 0D 0D 0D  ................
main, WRITE: TLSv1.2 Alert, length = 80
[Raw write]: length = 85
0000: 15 03 03 00 50 38 37 70   6C E6 7E 07 32 2A 6B 0E  ....P87pl...2*k.
0010: A2 EB C6 DB 1F D6 A1 BB   09 DC 26 29 C5 E9 94 54  ..........&)...T
0020: 2D 80 DE DA FE 2D 45 C8   95 E8 7E 40 A3 25 3A 9E  -....-E....@.%:.
0030: 09 A2 0D 24 89 FD 74 81   E3 33 C8 4D 05 36 C1 42  ...$..t..3.M.6.B
0040: 7B D2 21 C5 C7 93 69 7F   0E A3 2B F0 46 91 BB B2  ..!...i...+.F...
0050: 78 22 F2 98 84                                     x"...
main, called closeSocket()
org.apache.commons.vfs2.FileNotFolderException: Could not list the contents of "ftps://dadbftp.allero.org:990/Results" because it is not a folder.
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:492)
    at A1.listRemoteFileNames(A1.java:120)
    at A1.test(A1.java:51)
    at A1.main(A1.java:144)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
    at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:639)
    at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:711)
    at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2255)
    at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2390)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2651)
    at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.listFilesInDirectory(FTPClientWrapper.java:198)
    at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.listFiles(FTPClientWrapper.java:192)
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetChildren(FtpFileObject.java:241)
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildFile(FtpFileObject.java:470)
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.setFTPFile(FtpFileObject.java:634)
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doGetType(FtpFileObject.java:367)
    at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:488)
    ... 3 more
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:983)
    ... 18 more

Process finished with exit code 0
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.