我想将 TLS/TLSv1.2 用于 ssl 上下文:
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(new KeyManager[] { km }, new TrustManager[] { new MyTrustStore(keyStore) }, new SecureRandom());
System.out.println("PROTOCOL: "+SSLContext.getDefault().getSupportedSSLParameters().getProtocols()[0]);
我们正在使用自定义信任库和密钥管理器,在这里忽略它们,但我们确实需要它们。
现在每次都会打印“SSLv2Hello”。
我都试过了
SSLContext context = SSLContext.getInstance("TLSv1.2");
和
SSLContext context = SSLContext.getInstance("TLS");
两者都没有奏效。
作为参考,这在 JDK 1.8.0_171 上运行
谢谢您的帮助