Java.nio频道和TLS [英] Java.nio Channels and TLS

查看:220
本文介绍了Java.nio频道和TLS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何保护Java SocketChannel ServerSocketChannel ,或者甚至是 DatagramChannel 使用TLS?

How do I secure a Java SocketChannel, ServerSocketChannel or, perhaps even, a DatagramChannel with TLS?

我知道有一些框架(#1 #2 )宣传能够,但我想知道是否可以单独使用纯Java标准库来实现这一目标。

I know that there are some frameworks (#1 #2) that advertise to be able, but I want to know if it is possible to achieve this with the pure Java standard library alone.

推荐答案

你需要使用 SSLEngine ,如使用SSLEngine进行非阻塞I / O 。您提到的库使用它或使用使用它的库。

You need to use the SSLEngine, as documented in Non-blocking I/O with SSLEngine. The libraries you mention use it or use libraries that use it.

(请注意,这是非常难以使用的。)

(Note that this is notoriously difficult to use.)

您可能会发现这些链接很有趣:

You may find these links interesting:

  • This answer (which also contains a link to a book chapter).
  • Notes from Jean-François Arcand who implemented it in Grizzly.
  • An example of the type of problems you can get with asynchronous SSL/TLS.
  • Getting familiar with the problems mentioned in these this question should also be relevant (in particular, how to deal with them in async mode).
  • The Simple Framework also has support for async SSL/TLS.

对于数据报,你应该考虑使用 DTLS 而不是TLS。我不确定它在Java中的实现状态,但你可以深入研究 java.openjdk.security.devel 邮件列表的档案。

For Datagrams, you should look into using DTLS instead of TLS. I'm not sure of its implementation status in Java, but you could dig through the archives of the java.openjdk.security.devel mailing list.

这篇关于Java.nio频道和TLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆