使现代化
自从
April 23rd 2019
,Ubuntu(18.04 LTS和更新版本)附带JRE/JDK版本
11.0.3
. 因此,最初的答案是
阿拉玛
出于好奇,我编写了一个小小的TLSV1.3检查工具,通过编程检查TLSV1.3对目标的支持
运行时
环境通过这种方式,可以快速发现发生了什么:
public class TLS13Checker {
public static void main(String[] args) {
SSLContext context = null;
try {
KeyStore keyStore = KeyStore.getInstance("pkcs12");
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("PKIX");
trustManagerFactory.init(keyStore);
TrustManager[] trustAllCerts = trustManagerFactory.getTrustManagers();
context = SSLContext.getInstance("TLSv1.3");
context.init(null, trustAllCerts, new SecureRandom());
SSLParameters params = context.getSupportedSSLParameters();
String[] protocols = params.getProtocols();
System.out.println("Java version : " + System.getProperty("java.runtime.version"));
boolean supportsTLSv13 = false;
for (String protocol : protocols) {
if ("TLSv1.3".equals(protocol)) {
supportsTLSv13 = true;
break;
}
}
if(supportsTLSv13) {
System.out.println("JRE supports TLS v1.3!");
} else {
System.out.println("JRE does NOT support TLS v1.3!");
}
String[] suites = params.getCipherSuites();
System.out.println("A total of " + suites.length + " TLS cipher suites is supported.");
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
e.printStackTrace();
System.exit(42);
}
}
}
OpenJDK
环境(在MacOS下):
Java version : 11.0.3+7
JRE supports TLS v1.3!
A total of 45 TLS cipher suites is supported.
JSSE Cipher Suite Names