java - 限制基于 Java 的 Web 服务器 TLS 协议(protocol)以供 Wireshark 检查

标签 java android ssl playframework wireshark

我正在使用基于 Java 的 Web 服务器(PlayFramework 2.2 FWIW - 请参阅 very good write up on TLS ),并且我想调试各种设备(例如:Android)的 SSL 通信,以准确了解线路上发生的情况随着 TLS 的发展。为此我可以使用 Wireshark to decrypt the SSL layer 。如果服务器未创建临时 key ,则此方法有效,如 explained nicely by Steven Iveson :

Important: Ensure the use of a Diffie-Hellman Ephemeral (DHE/EDH) or RSA Ephemeral cipher suite is not negotiated between the two hosts. This is indicated by the use of a ServerKeyExchange message. There is no way to decrypt data where ephemeral ciphers are used.

Java Secure Sockets Extension Reference Guide section on how to Disable Algorithms指向 jdk.tls.disabledAlgorithms 属性,我尝试直接在 $JAVA_HOME/jre/lib/security/java.security 文件中将其设置为

jdk.tls.disabledAlgorithms=DH, ECDH, EDCHE, DiffieHellman

我尝试使用一些 Java™ Cryptography Architecture Standard Algorithm Name Documentation作为尝试选择其中一个字符串,但我一直在野外选择一些。

我尝试在代码中使用它来设置它

java.security.Security.setProperty("jdk.tls.disabledAlgorithms","ECDH, ECDHE, ECDHE_RSA, DiffieHellman")

但这似乎并没有阻止 ServerKeyExchange 消息的出现,如 OSX 上 Wireshark 1.11.2 的屏幕截图所示:screenshot of Wireshark 1.11.2 on OSX 。事实上,我似乎无法解密该流。

知道我可能做错了什么吗?

最佳答案

不确定这是否有帮助,但尝试在特权 block 内执行此操作:

AccessController.doPrivileged(
  new PrivilegedExceptionAction[Unit]() {
     java.security.Security.setProperty("jdk.tls.disabledAlgorithms","ECDH, ECDHE, ECDHE_RSA, DiffieHellman")

  }
)

关于java - 限制基于 Java 的 Web 服务器 TLS 协议(protocol)以供 Wireshark 检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21958615/

相关文章:

java - MIUI 10.2 红米设备上的锁屏上无法设置壁纸

ssl - 如何更改本地主机 (XAMPP) 上 TLS 协议(protocol)的密码学方法?

java - Android - 在表格加载后添加表格行

java - 忽略新实例

java - 使用 jersey 客户端编写 POST 请求

Android 滑动屏幕带圆圈指示

java - 在Android中将语音录制为mp3

node.js - 无法信任 Node.js 中来自 IIS Express 的自签名 SSL 证书

amazon-web-services - 如何为 Heroku 应用配置带 SSL 的 Amazon Route

java - 删除不使用 JpaRepository