我正在通过 SSL 连接到服务器。这适用于 OpenJDK8 262 和 265。
有了 275,我突然在输出中看到了这个:
javax.net.ssl|FINE|5F|pool-1-thread-1|2021-03-02 10:47:27.085 CET|Logger.java:765|Received alert message (
"Alert": {
"level" : "warning",
"description": "user_canceled"
}
我追踪到这个常数( https://github.com/openjdk/jdk8/blob/6a383433a9f4661a96a90b2a4c7b5b9a85720031/jdk/src/share/classes/sun/security/ssl/Alerts.java#L76 ):static final byte alert_user_canceled = 90;
当我在 repo 中搜索这个常量时,我只得到一个命中(在将代码转换为字符串的方法中): case alert_user_canceled:
return "user_canceled";
搜索所有 OpenJDK 源会产生相同的命中:https://github.com/search?q=org%3Aopenjdk+alert_user_canceled&type=code我难住了。谁发出这个警告,为什么?
更新:经过更多测试,我得到的印象是远程端发送了“取消”。那可能吗?对我来说,这没有意义,因为我连接到服务器(我发送 ClientHello,我接收 ServerHello)。
最佳答案
您看到的是您尝试与之握手的服务器发送的警报(定义在 TLS Protocol Specification, Section 7.2 "Alert Protocol" 中)。
在上面链接的规范中,警报代码 90
( user_canceled
) 描述如下:
This handshake is being canceled for some reason unrelated to a protocol failure. If the user cancels an operation after the handshake is complete, just closing the connection by sending a close_notify is more appropriate. This alert should be followed by a close_notify. This message is generally a warning.
简而言之,这表示此特定警报代码旨在指示取消握手过程的实现特定原因。因此,如果不知道另一端正在运行什么服务器软件,就不可能说出究竟出了什么问题。
您可以通过比较工作版本和损坏版本的握手过程的详细日志来尝试调试连接,看看有什么不同。这可能会提供一些有关如何解决此问题的见解。
关于ssl - javax.net.ssl 警告 "user_canceled"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66437618/