我正在使用基于 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 的屏幕截图所示: 。事实上,我似乎无法解密该流。
知道我可能做错了什么吗?
最佳答案
不确定这是否有帮助,但尝试在特权 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/