java SSLException:SSL 对等方关闭不正确

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11873709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 06:45:06  来源:igfitidea点击:

SSLException: SSL peer shut down incorrectly

javasslantnetwork-programmingjetty

提问by rmoh21

Within my client Ant task to download files off of a Jetty server, I occasionally get a

在我从 Jetty 服务器下载文件的客户端 Ant 任务中,我偶尔会得到一个

javax.net.ssl.SSLException: SSL peer shut down incorrectly 
at com.sun.net.ssl.internal.ssl.InputRecord.readV3Record(InputRecord.java:408)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:360)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)

I have Googled for a bit - but so far I do not have a conclusive answer as to why this might be happening.

我在谷歌上搜索了一段时间 - 但到目前为止,我还没有关于为什么会发生这种情况的结论性答案。

Can anyone explain what might be the root cause of this exception?

谁能解释这个异常的根本原因是什么?

My Jetty logs do not seem to have an equivalent trace of this exception. However, it seems that the Jetty server is indeed terminating the secure connection.

我的 Jetty 日志似乎没有此异常的等效跟踪。但是,似乎 Jetty 服务器确实在终止安全连接。

As a bit of a background - I see this exception when two clients spawned by the Ant task use the same certificate to download predetermined files from the Jetty server. The only suspicion I have is that presenting the same certificate by two clients originating from the same host is tripping up the Jetty and it ends up shutting down the connection - but thats just a unproven theory.

作为背景知识 - 当 Ant 任务产生的两个客户端使用相同的证书从 Jetty 服务器下载预定文件时,我看到了这个异常。我唯一的怀疑是来自同一主机的两个客户端提供相同的证书会导致 Jetty 跳闸并最终关闭连接 - 但这只是一个未经证实的理论。

回答by user207421

This problem can be caused if you have a plaintext socket that you have wrapped in an SSLSocket and you close the plaintext socket rather than the SSLSocket. The exception is warning about a possible truncation attack.

如果您有一个包含在 SSLSocket 中的明文套接字,并且您关闭了明文套接字而不是 SSLSocket,则可能会导致此问题。例外是关于可能的截断攻击的警告。

Of course it can also be caused by a realtruncation attack.

当然它也可能是由真正的截断攻击引起的。