One of reasons for shorter release cycles of the JDK is possibility to rollout faster security bugfixes and enhancements. In this article we will review in a nutshell what are the major security enhancements introduced in latest JDK versions. As most of these enhancements are related to TLS it is essential to understand the TLS handshake process as illustrated by the following diagram:
JDK 9
Major security enhancements introduced in JDK 9 are related to the TLS support provided by JSSE (Java Secure Socket Extension) API. These include:
• DTLS support in JDK 9: DTLS provides is essentially TLS over UDP so that you can encrypt communication established by unreliable protocols running over UDP
SSLContext sslContext = SSLContext.getInstance("DTLS");
sslContext.init(…)
SSLEngine engine = sslContext.createSSLEngine();
engine.setUseClientMode(…); // true or false depending on whether it is a DTLS client or server
• TLS ALPN extension in JDK 9: provides support for negotiating the application protocol during the TLS handshake process, the list of acceptable protocols is set as a simple list of strings on both the TLS client and TLS server
SSLParameters sslParams = sslSocket.getSSLParameters();
sslParams.setApplicationProtocols(…)
or (for non-blocking mode of operation)
SSLParameters sslParams = sslEngine.getSSLParameters();
sslParams.setApplicationProtocols(…)
or (using more complex logic to determine the negotiated protocol)
sslSocket.setHandshakeApplicationProtocolSelector((serverSocket, clientProtocols) {
SSLSession handshakeSession = serverSocket.getHandshakeSession();
String cipher = handshakeSession.getCipherSuite();
int packetBufferSize = handshakeSession.getPacketBufferSize();
if("RC4".equals(cipher) && packetBufferSize > 1024) {
return "protocol1";
} else {
return "protocol2";
}
});
TLS ALPN comes in handy i.e. for web servers that support both the HTTP 1.1 and HTTP 2.0 protocols over TLS for their clients
• OCSP Stapling for TCP: provides a mechanism for doing certificate revocation checking on the TLS server rather than the TLS client thus saving network bandwidth, must be enabled on both the TLS client and the TLS server
-Djdk.tls.client.enableStatusRequestExtension=true
-Dcom.sun.net.ssl.checkRevocation=true
and (on the TLS server)
-Djdk.tls.server.enableStatusRequestExtension=true
• PKCS12 keystores by default (so far these were JKS, but those are not portable across different than Java programming languages)
• DRBG-Based SecureRandom Implementations
• Utilization of CPU Instructions for GHASH and RSA
• SHA-1 Certificates disabled for certificate validation
• Implementation of the SHA-3 hash algorithms
JDK 10
There are two main enhancements introduced in JDK 10:
JEP 319 Root Certificates: a list or root certificates has been exposed to the cacerts keystore of the JDK
Some security-related APIs marked for removal: some
JDK 11
The major security enhancement introduced in JDK 11 is provided by JEP 332: Transport Layer Security (TLS) 1.3. This is the new version of the TLS protocol that provides a number of enhancements over the previous (1.2) version of the TLS specification. In addition more enhancements are made to the root certificates in the cacerts keystore (some root certificates are added and some removed).