2 回答

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超3個(gè)贊
更新
自2019 年 4 月 23 日起,Ubuntu(18.04 LTS 和更新版本)附帶 JRE/JDK 版本11.0.3。出于這個(gè)原因,alamar的原始答案已經(jīng)過(guò)時(shí)。
出于好奇,我編寫(xiě)了一個(gè)小的 TLS v1.3 檢查工具,它以編程方式檢查目標(biāo)運(yùn)行時(shí)環(huán)境的 TLS v1.3 支持。這樣,人們可以快速發(fā)現(xiàn)發(fā)生了什么:
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);
}
}
}
您可以簡(jiǎn)單地編譯并運(yùn)行它,輸出將類(lèi)似于我在最近的OpenJDK環(huán)境(在 MacOS 下)得到的結(jié)果:
Java version : 11.0.3+7
JRE supports TLS v1.3!
A total of 45 TLS cipher suites is supported.
此外,此列表概述了所有常規(guī)JSSE 密碼套件名稱(chēng)。它可能有助于參考或其他(實(shí)施)目的。
希望能幫助到你。

TA貢獻(xiàn)1725條經(jīng)驗(yàn) 獲得超8個(gè)贊
似乎出于某種原因,Ubuntu 實(shí)際上在 openjdk-11-* 軟件包下提供了 Java 10。
添加回答
舉報(bào)