- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
Java 11 发布时默认使用 TLSv1.3
支持。
它在 HTTPS 和 SSL 套接字的上下文中工作正常,但似乎在使用 SSLEngine
时由于 TLSv1.3
行为的变化而存在额外的障碍。
因此,使用 SSLEngine
通过 NIO
进行通信的稳健实现在启用 TLSv1.3
时不再有效。没有明显的错误,以异常或 SSL 错误的形式出现,两个节点只会来回发送 wrap/unwrap 消息并最终超时。
我对使用 TLSv1.2 的 SSLEngine 和使用 TLSv1.3 的 SSLEngine 之间的行为变化的确切列表感兴趣,如果可能的话,还有这些之间的迁移 list 。不幸的是,Java 11 的 SSLEngine javadoc 没有此信息——Java 11 中没有新方法,也没有对 TLSv1.3 的引用。
最佳答案
的确,在 JDK 11 的 Javadoc 中没有明确提及 TLS 1.3 对 SSLEngine
的影响,其方法也没有变化。
但是the fifth item (closure) in the list of phases of SSLEngine
在 JDK 11 的 Javadoc 开头的一般描述中进行了更新:
Closure - When the connection is no longer needed, the client and the server applications should each close both sides of their respective connections. For
SSLEngine
objects, an application should callcloseOutbound()
and send any remaining messages to the peer. Likewise, an application should receive any remaining messages from the peer before callingcloseInbound()
. The underlying transport mechanism can then be closed after both sides of theSSLEngine
have been closed. If the connection is not closed in an orderly manner (for examplecloseInbound()
is called before the peer's write closure notification has been received), exceptions will be raised to indicate that an error has occurred. Once an engine is closed, it is not reusable: a newSSLEngine
must be created.
此更改也在 Oracle's Release Notes for JDK 11 中进行了讨论:
TLS 1.3 Half-Close Policy
A new system property,jdk.tls.acknowledgeCloseNotify
, has been added. The default value of the system property is false. If the system property is set to true, a correspondingclose_notify alert
will be sent when receiving aclose_notify
alert, and the connection will be duplex closed.TLS 1.2 and prior versions use a duplex-close policy, while TLS 1.3 uses a half-close policy. The inbound and the outbound close_notify alerts for TLS 1.3 are independent. When upgrading to TLS 1.3, unexpected behavior can occur if your application shuts down the (D)TLS connection by using only one of the
SSLEngine.closeInbound()
orSSLEngine.closeOutbound()
APIs, but not both in each side of the connection. If your application exhibits unexpected hangs or timeouts when the underlying (D)TLS transportation is not duplex closed, you may need to set this property to true.Note that when a TLS/DTLS connection is no longer needed, the client and server applications should each close both sides of their respective connection.
因此,将 jdk.tls.acknowledgeCloseNotify
设置为 true 可能会解决您在将 SSlEngine
与 TLS 1.3 一起使用时对超时的具体担忧:
If your application exhibits unexpected hangs or timeouts when the underlying (D)TLS transportation is not duplex closed, you may need to set this property to true.
发行说明文档还链接到已关闭的 JDK 错误 JDK-8208526 : TLS 1.3 half-close and synchronization issues其中更详细地讨论了更改。
相关(已关闭)错误 JDK-8207009 : TLS 1.3 half-close and synchronization issues也可能感兴趣。
其他引用资料:
关于java - 升级到 TLSv1.3 时 SSLEngine 使用的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54687831/
我正在使用 Java NIO 上的 SSLEngine 来解锁服务器套接字来处理连接。我能够成功地与客户端握手并将小记录集传递到服务器。但是,当我尝试将文件传输到服务器 text/binary 时,出
我已经实现了一个辅助模块,可以让我从使用 SSL 的 channel 获取干净数据并将加密数据写入其中:这是相关接口(interface)(我在该类中也有一些非抽象方法,所以没有不要对我说“DataP
我遇到了这个异常发生 SSLEngineResult result = sslEngine.wrap(b, engineToSocketData); if(b.hasRemaining
在 Java 中有没有一种方法可以具有与 SSLEngine 相同的功能,但没有委托(delegate)任务,因为我的程序需要处理大量连接,我用 NIO 编写它的目的是使用更少的 ram,有更多的连接
我正在尝试使用 SSLEngine 实现 SSL 握手,我需要同时作为服务器和客户端来执行此操作,但是我被卡住了,我无法弄清楚原因。 握手正确开始,交换了 Hello,交换了 key ,但随后我进入了
SSLEngine documentation指示如何正确关闭 SSL 连接。更具体地说,它提供了有关如何处理断开的连接的说明: In addition to orderly shutdowns, t
我需要为我正在开发的应用程序使用基于 TLS 的 TCP 套接字。我已经经历了几十个例子,虽然我通过握手没有问题,但我似乎无法通过任何方式读取输入流(尝试了很多,包括 readline(),读取字符数
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 2 年前。
我正在尝试在非阻塞模式下将 SSLengine 与 SocketChannels 一起使用。 握手已正确完成,但当我尝试从 channelsocket 读取和解密 http 帖子时,只有标题被解密,正
背景 我正在尝试创建 2 个通过 SSL 在内部网络上相互通信的 Java 应用程序。我通过授予 SSLEngine 访问 keystore 的权限来做到这一点,该 keystore 包含要使用的证书
我在使用 SSLEngine 时遇到了一个小问题 java 。我用它来创建客户端和服务器之间的 SSL 连接。这不是基于 Web 的应用程序。 我正在为我的产品开发人员创建一个框架,以便在客户端和服务
我正在为 Android 手机编写自定义服务器来处理 https 请求。它首先监听特定端口,一旦建立连接,它就会与客户端进行握手。这是代码 fragment : ServerSocket sock =
我使用来自 http://books.google.com/books?id=l6f1jTB_XCYC&lpg=PA185&vq=scalable%20secure&pg=PA185#v=onepag
我在 Java 中使用带有 NIO 的 SSL 和一个简单的客户端/服务器概念验证应用程序。我已经启动并运行良好的握手,但之后尝试加密和解密应用程序数据让我抓狂。我想知道我是否遗漏了预期用途方面的内容
当为 ssl/https 连接配置 apache2 虚拟主机时,在添加配置并使用此命令“a2ensite pm.university.com.conf”启用配置后,我收到此错误“无效命令‘SSLEng
我有一个 Java 服务器应用程序(加载了它自己的服务器证书)试图安全地连接到另一个服务器(Microsoft - 有它的服务器证书)。 他们每个人都加载了受信任的 ROOT-CA 证书,我可以在两台
我将 SSLEngine 与 NIO 一起使用,为我的应用程序提供非阻塞 SSL 连接。在握手期间的某个时刻(可能是在收到 ServerHelloDone 之后),SSLEngine 要求我处理委托(
我有下一个案例:客户端在其信任库中只有根证书。在 TLS 握手期间,服务器将自己的证书发送给客户端,该证书使用中间证书 签名。 客户端的 SLLEngine 是否会下载中间证书来验证服务器证书,直到引
我需要通过我的代理(我相信是隧道)建立一个使用 JSSE 建立的 SSL 连接。是否已经有任何库/属性/方法,或者我必须在低级别实现它? 请注意,只需为我的程序的一个子集定义此代理。我程序中的其他 H
来自 SSLEngine 文档:“通过将 SSL/TLS 抽象与 I/O 传输机制分离,SSLEngine 可用于各种 I/O 类型,例如非阻塞 I/O(轮询) ,可选择的非阻塞 I/O,Socket
我是一名优秀的程序员,十分优秀!