在JCA中为TLS定义加密套件 [英] Define cipher suite for TLS in JCA
问题描述
我想使用JCA在TLS中支持以下密码套件:
I want the support of the following cipher suites in TLS using JCA:
- TLS_PSK_WITH_3DES_EDE_CBC_SHA
- TLS_PSK_WITH_AES_128_CBC_SHA
- TLS_PSK_WITH_NULL_SHA
- TLS_PSK_WITH_AES_128_CBC_SHA256
- TLS_PSK_WITH_NULL_SHA256
- TLS_PSK_WITH_3DES_EDE_CBC_SHA
- TLS_PSK_WITH_AES_128_CBC_SHA
- TLS_PSK_WITH_NULL_SHA
- TLS_PSK_WITH_AES_128_CBC_SHA256
- TLS_PSK_WITH_NULL_SHA256
它们可在 JDK7 中使用但不是 JDK6 ,而不是BouncyCastle。
They are available in JDK7 but not JDK6, neither BouncyCastle.
如果我想要JDK6中的支持,我可以扩展JCA来实现这些PSK扩展的支持,使用SPI,提供程序和JSSE的回调方法。我可以在运行时重新定义或添加新的密码实现,但我不确定JCA提供了足够的粒度在TLS中添加新的密码套件。
If I want the support in JDK6, could I extends JCA to implement the support of these PSK extensions, using SPI, providers and callback methods of JSSE. I can already redefine or add new cipher implementations on runtime, but I'm not sure JCA offers enough granularity to add new cipher suites in TLS.
推荐答案
干净的方式是实现您自己的 SSLSocketFactory 。
如果你想尝试添加我只看到通过反射修改内部类的方式。
If you want to try adding I only see the way to modify the internal classes via reflection.
相关类是:
com.sun.net.ssl.internal.ssl.CipherSuite
它有一个重载的私有静态方法add用于将加密实现添加到支持的列表。可能值得一试。
It has an overloaded private static method "add" for adding cipher implementations to the supported list. May be worth a try.
这篇关于在JCA中为TLS定义加密套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!