|
|
f78025 |
# HG changeset patch
|
|
|
f78025 |
# User jnimeh
|
|
|
f78025 |
# Date 1578287079 28800
|
|
|
f78025 |
# Sun Jan 05 21:04:39 2020 -0800
|
|
|
f78025 |
# Node ID b9d1ce20dd4b2ce34e74c8fa2d784335231abcd1
|
|
|
f78025 |
# Parent 3782f295811625b65d57f1aef15daa10d82a58a7
|
|
|
f78025 |
8236039: JSSE Client does not accept status_request extension in CertificateRequest messages for TLS 1.3
|
|
|
f78025 |
Reviewed-by: xuelei
|
|
|
f78025 |
|
|
|
f78025 |
diff --git a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java
|
|
|
f78025 |
--- a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java
|
|
|
f78025 |
+++ b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java
|
|
|
f78025 |
@@ -1,5 +1,5 @@
|
|
|
f78025 |
/*
|
|
|
f78025 |
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
f78025 |
*
|
|
|
f78025 |
* This code is free software; you can redistribute it and/or modify it
|
|
|
f78025 |
@@ -39,11 +39,7 @@
|
|
|
f78025 |
import javax.net.ssl.SSLProtocolException;
|
|
|
f78025 |
import sun.security.provider.certpath.OCSPResponse;
|
|
|
f78025 |
import sun.security.provider.certpath.ResponderId;
|
|
|
f78025 |
-import static sun.security.ssl.SSLExtension.CH_STATUS_REQUEST;
|
|
|
f78025 |
-import static sun.security.ssl.SSLExtension.CH_STATUS_REQUEST_V2;
|
|
|
f78025 |
import sun.security.ssl.SSLExtension.ExtensionConsumer;
|
|
|
f78025 |
-import static sun.security.ssl.SSLExtension.SH_STATUS_REQUEST;
|
|
|
f78025 |
-import static sun.security.ssl.SSLExtension.SH_STATUS_REQUEST_V2;
|
|
|
f78025 |
import sun.security.ssl.SSLExtension.SSLExtensionSpec;
|
|
|
f78025 |
import sun.security.ssl.SSLHandshake.HandshakeMessage;
|
|
|
f78025 |
import sun.security.util.DerInputStream;
|
|
|
f78025 |
@@ -434,8 +430,9 @@
|
|
|
f78025 |
} else {
|
|
|
f78025 |
extBuilder.append(",\n");
|
|
|
f78025 |
}
|
|
|
f78025 |
- extBuilder.append(
|
|
|
f78025 |
- "{\n" + Utilities.indent(ext.toString()) + "}");
|
|
|
f78025 |
+ extBuilder.append("{\n").
|
|
|
f78025 |
+ append(Utilities.indent(ext.toString())).
|
|
|
f78025 |
+ append("}");
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
extsStr = extBuilder.toString();
|
|
|
f78025 |
@@ -552,11 +549,11 @@
|
|
|
f78025 |
return null;
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
- if (!chc.sslConfig.isAvailable(CH_STATUS_REQUEST)) {
|
|
|
f78025 |
+ if (!chc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST)) {
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
SSLLogger.fine(
|
|
|
f78025 |
"Ignore unavailable extension: " +
|
|
|
f78025 |
- CH_STATUS_REQUEST.name);
|
|
|
f78025 |
+ SSLExtension.CH_STATUS_REQUEST.name);
|
|
|
f78025 |
}
|
|
|
f78025 |
return null;
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -568,8 +565,8 @@
|
|
|
f78025 |
byte[] extData = new byte[] {0x01, 0x00, 0x00, 0x00, 0x00};
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- chc.handshakeExtensions.put(
|
|
|
f78025 |
- CH_STATUS_REQUEST, CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
+ chc.handshakeExtensions.put(SSLExtension.CH_STATUS_REQUEST,
|
|
|
f78025 |
+ CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
return extData;
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -593,10 +590,10 @@
|
|
|
f78025 |
// The consuming happens in server side only.
|
|
|
f78025 |
ServerHandshakeContext shc = (ServerHandshakeContext)context;
|
|
|
f78025 |
|
|
|
f78025 |
- if (!shc.sslConfig.isAvailable(CH_STATUS_REQUEST)) {
|
|
|
f78025 |
+ if (!shc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST)) {
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
SSLLogger.fine("Ignore unavailable extension: " +
|
|
|
f78025 |
- CH_STATUS_REQUEST.name);
|
|
|
f78025 |
+ SSLExtension.CH_STATUS_REQUEST.name);
|
|
|
f78025 |
}
|
|
|
f78025 |
return; // ignore the extension
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -610,7 +607,7 @@
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- shc.handshakeExtensions.put(CH_STATUS_REQUEST, spec);
|
|
|
f78025 |
+ shc.handshakeExtensions.put(SSLExtension.CH_STATUS_REQUEST, spec);
|
|
|
f78025 |
if (!shc.isResumption &&
|
|
|
f78025 |
!shc.negotiatedProtocol.useTLS13PlusSpec()) {
|
|
|
f78025 |
shc.handshakeProducers.put(SSLHandshake.CERTIFICATE_STATUS.id,
|
|
|
f78025 |
@@ -654,13 +651,12 @@
|
|
|
f78025 |
|
|
|
f78025 |
// In response to "status_request" extension request only.
|
|
|
f78025 |
CertStatusRequestSpec spec = (CertStatusRequestSpec)
|
|
|
f78025 |
- shc.handshakeExtensions.get(CH_STATUS_REQUEST);
|
|
|
f78025 |
+ shc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST);
|
|
|
f78025 |
if (spec == null) {
|
|
|
f78025 |
// Ignore, no status_request extension requested.
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
- SSLLogger.finest(
|
|
|
f78025 |
- "Ignore unavailable extension: " +
|
|
|
f78025 |
- CH_STATUS_REQUEST.name);
|
|
|
f78025 |
+ SSLLogger.finest("Ignore unavailable extension: " +
|
|
|
f78025 |
+ SSLExtension.CH_STATUS_REQUEST.name);
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
return null; // ignore the extension
|
|
|
f78025 |
@@ -681,8 +677,8 @@
|
|
|
f78025 |
byte[] extData = new byte[0];
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- shc.handshakeExtensions.put(
|
|
|
f78025 |
- SH_STATUS_REQUEST, CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
+ shc.handshakeExtensions.put(SSLExtension.SH_STATUS_REQUEST,
|
|
|
f78025 |
+ CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
return extData;
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -708,7 +704,7 @@
|
|
|
f78025 |
|
|
|
f78025 |
// In response to "status_request" extension request only.
|
|
|
f78025 |
CertStatusRequestSpec requestedCsr = (CertStatusRequestSpec)
|
|
|
f78025 |
- chc.handshakeExtensions.get(CH_STATUS_REQUEST);
|
|
|
f78025 |
+ chc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST);
|
|
|
f78025 |
if (requestedCsr == null) {
|
|
|
f78025 |
throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
|
|
|
f78025 |
"Unexpected status_request extension in ServerHello");
|
|
|
f78025 |
@@ -722,8 +718,8 @@
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- chc.handshakeExtensions.put(
|
|
|
f78025 |
- SH_STATUS_REQUEST, CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
+ chc.handshakeExtensions.put(SSLExtension.SH_STATUS_REQUEST,
|
|
|
f78025 |
+ CertStatusRequestSpec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
// Since we've received a legitimate status_request in the
|
|
|
f78025 |
// ServerHello, stapling is active if it's been enabled.
|
|
|
f78025 |
@@ -909,7 +905,7 @@
|
|
|
f78025 |
return null;
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
- if (!chc.sslConfig.isAvailable(CH_STATUS_REQUEST_V2)) {
|
|
|
f78025 |
+ if (!chc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST_V2)) {
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
SSLLogger.finest(
|
|
|
f78025 |
"Ignore unavailable status_request_v2 extension");
|
|
|
f78025 |
@@ -926,8 +922,8 @@
|
|
|
f78025 |
0x00, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00};
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- chc.handshakeExtensions.put(
|
|
|
f78025 |
- CH_STATUS_REQUEST_V2, CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
+ chc.handshakeExtensions.put(SSLExtension.CH_STATUS_REQUEST_V2,
|
|
|
f78025 |
+ CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
return extData;
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -951,7 +947,7 @@
|
|
|
f78025 |
// The consuming happens in server side only.
|
|
|
f78025 |
ServerHandshakeContext shc = (ServerHandshakeContext)context;
|
|
|
f78025 |
|
|
|
f78025 |
- if (!shc.sslConfig.isAvailable(CH_STATUS_REQUEST_V2)) {
|
|
|
f78025 |
+ if (!shc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST_V2)) {
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
SSLLogger.finest(
|
|
|
f78025 |
"Ignore unavailable status_request_v2 extension");
|
|
|
f78025 |
@@ -969,7 +965,8 @@
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- shc.handshakeExtensions.put(CH_STATUS_REQUEST_V2, spec);
|
|
|
f78025 |
+ shc.handshakeExtensions.put(SSLExtension.CH_STATUS_REQUEST_V2,
|
|
|
f78025 |
+ spec);
|
|
|
f78025 |
if (!shc.isResumption) {
|
|
|
f78025 |
shc.handshakeProducers.putIfAbsent(
|
|
|
f78025 |
SSLHandshake.CERTIFICATE_STATUS.id,
|
|
|
f78025 |
@@ -1013,7 +1010,7 @@
|
|
|
f78025 |
|
|
|
f78025 |
// In response to "status_request_v2" extension request only
|
|
|
f78025 |
CertStatusRequestV2Spec spec = (CertStatusRequestV2Spec)
|
|
|
f78025 |
- shc.handshakeExtensions.get(CH_STATUS_REQUEST_V2);
|
|
|
f78025 |
+ shc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST_V2);
|
|
|
f78025 |
if (spec == null) {
|
|
|
f78025 |
// Ignore, no status_request_v2 extension requested.
|
|
|
f78025 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
|
|
|
f78025 |
@@ -1038,8 +1035,8 @@
|
|
|
f78025 |
byte[] extData = new byte[0];
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- shc.handshakeExtensions.put(
|
|
|
f78025 |
- SH_STATUS_REQUEST_V2, CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
+ shc.handshakeExtensions.put(SSLExtension.SH_STATUS_REQUEST_V2,
|
|
|
f78025 |
+ CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
return extData;
|
|
|
f78025 |
}
|
|
|
f78025 |
@@ -1065,7 +1062,7 @@
|
|
|
f78025 |
|
|
|
f78025 |
// In response to "status_request" extension request only
|
|
|
f78025 |
CertStatusRequestV2Spec requestedCsr = (CertStatusRequestV2Spec)
|
|
|
f78025 |
- chc.handshakeExtensions.get(CH_STATUS_REQUEST_V2);
|
|
|
f78025 |
+ chc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST_V2);
|
|
|
f78025 |
if (requestedCsr == null) {
|
|
|
f78025 |
throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
|
|
|
f78025 |
"Unexpected status_request_v2 extension in ServerHello");
|
|
|
f78025 |
@@ -1079,8 +1076,8 @@
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
// Update the context.
|
|
|
f78025 |
- chc.handshakeExtensions.put(
|
|
|
f78025 |
- SH_STATUS_REQUEST_V2, CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
+ chc.handshakeExtensions.put(SSLExtension.SH_STATUS_REQUEST_V2,
|
|
|
f78025 |
+ CertStatusRequestV2Spec.DEFAULT);
|
|
|
f78025 |
|
|
|
f78025 |
// Since we've received a legitimate status_request in the
|
|
|
f78025 |
// ServerHello, stapling is active if it's been enabled. If it
|
|
|
f78025 |
diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java
|
|
|
f78025 |
--- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java
|
|
|
f78025 |
+++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java
|
|
|
f78025 |
@@ -1,5 +1,5 @@
|
|
|
f78025 |
/*
|
|
|
f78025 |
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
f78025 |
*
|
|
|
f78025 |
* This code is free software; you can redistribute it and/or modify it
|
|
|
f78025 |
@@ -113,7 +113,6 @@
|
|
|
f78025 |
null,
|
|
|
f78025 |
null,
|
|
|
f78025 |
CertStatusExtension.certStatusReqStringizer),
|
|
|
f78025 |
-
|
|
|
f78025 |
CR_STATUS_REQUEST (0x0005, "status_request"),
|
|
|
f78025 |
CT_STATUS_REQUEST (0x0005, "status_request",
|
|
|
f78025 |
SSLHandshake.CERTIFICATE,
|
|
|
f78025 |
@@ -124,6 +123,7 @@
|
|
|
f78025 |
null,
|
|
|
f78025 |
null,
|
|
|
f78025 |
CertStatusExtension.certStatusRespStringizer),
|
|
|
f78025 |
+
|
|
|
f78025 |
// extensions defined in RFC 4681
|
|
|
f78025 |
USER_MAPPING (0x0006, "user_mapping"),
|
|
|
f78025 |
|
|
|
f78025 |
@@ -515,6 +515,16 @@
|
|
|
f78025 |
return null;
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
+ static String nameOf(int extensionType) {
|
|
|
f78025 |
+ for (SSLExtension ext : SSLExtension.values()) {
|
|
|
f78025 |
+ if (ext.id == extensionType) {
|
|
|
f78025 |
+ return ext.name;
|
|
|
f78025 |
+ }
|
|
|
f78025 |
+ }
|
|
|
f78025 |
+
|
|
|
f78025 |
+ return "unknown extension";
|
|
|
f78025 |
+ }
|
|
|
f78025 |
+
|
|
|
f78025 |
static boolean isConsumable(int extensionType) {
|
|
|
f78025 |
for (SSLExtension ext : SSLExtension.values()) {
|
|
|
f78025 |
if (ext.id == extensionType &&
|
|
|
f78025 |
diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java b/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java
|
|
|
f78025 |
--- a/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java
|
|
|
f78025 |
+++ b/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java
|
|
|
f78025 |
@@ -1,5 +1,5 @@
|
|
|
f78025 |
/*
|
|
|
f78025 |
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
+ * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
|
|
|
f78025 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
f78025 |
*
|
|
|
f78025 |
* This code is free software; you can redistribute it and/or modify it
|
|
|
f78025 |
@@ -86,11 +86,14 @@
|
|
|
f78025 |
"Received buggy supported_groups extension " +
|
|
|
f78025 |
"in the ServerHello handshake message");
|
|
|
f78025 |
}
|
|
|
f78025 |
- } else {
|
|
|
f78025 |
+ } else if (handshakeType == SSLHandshake.SERVER_HELLO) {
|
|
|
f78025 |
throw hm.handshakeContext.conContext.fatal(
|
|
|
f78025 |
- Alert.UNSUPPORTED_EXTENSION,
|
|
|
f78025 |
- "extension (" + extId +
|
|
|
f78025 |
- ") should not be presented in " + handshakeType.name);
|
|
|
f78025 |
+ Alert.UNSUPPORTED_EXTENSION, "extension (" +
|
|
|
f78025 |
+ extId + ") should not be presented in " +
|
|
|
f78025 |
+ handshakeType.name);
|
|
|
f78025 |
+ } else {
|
|
|
f78025 |
+ isSupported = false;
|
|
|
f78025 |
+ // debug log to ignore unknown extension for handshakeType
|
|
|
f78025 |
}
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
@@ -365,9 +368,10 @@
|
|
|
f78025 |
}
|
|
|
f78025 |
|
|
|
f78025 |
private static String toString(int extId, byte[] extData) {
|
|
|
f78025 |
+ String extName = SSLExtension.nameOf(extId);
|
|
|
f78025 |
MessageFormat messageFormat = new MessageFormat(
|
|
|
f78025 |
- "\"unknown extension ({0})\": '{'\n" +
|
|
|
f78025 |
- "{1}\n" +
|
|
|
f78025 |
+ "\"{0} ({1})\": '{'\n" +
|
|
|
f78025 |
+ "{2}\n" +
|
|
|
f78025 |
"'}'",
|
|
|
f78025 |
Locale.ENGLISH);
|
|
|
f78025 |
|
|
|
f78025 |
@@ -375,6 +379,7 @@
|
|
|
f78025 |
String encoded = hexEncoder.encodeBuffer(extData);
|
|
|
f78025 |
|
|
|
f78025 |
Object[] messageFields = {
|
|
|
f78025 |
+ extName,
|
|
|
f78025 |
extId,
|
|
|
f78025 |
Utilities.indent(encoded)
|
|
|
f78025 |
};
|