File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
src/java.base/share/classes/sun/security/ssl Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2020 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -1166,6 +1166,15 @@ public void consume(ConnectionContext context,
1166
1166
1167
1167
// clean up this consumer
1168
1168
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE .id );
1169
+
1170
+ // Ensure that the Certificate message has not been sent w/o
1171
+ // an EncryptedExtensions preceding
1172
+ if (hc .handshakeConsumers .containsKey (
1173
+ SSLHandshake .ENCRYPTED_EXTENSIONS .id )) {
1174
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1175
+ "Unexpected Certificate handshake message" );
1176
+ }
1177
+
1169
1178
T13CertificateMessage cm = new T13CertificateMessage (hc , message );
1170
1179
if (hc .sslConfig .isClientMode ) {
1171
1180
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -1157,6 +1157,14 @@ public void consume(ConnectionContext context,
1157
1157
// Clean up this consumer
1158
1158
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE_VERIFY .id );
1159
1159
1160
+ // Ensure that the Certificate Verify message has not been sent w/o
1161
+ // a Certificate message preceding
1162
+ if (hc .handshakeConsumers .containsKey (
1163
+ SSLHandshake .CERTIFICATE .id )) {
1164
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1165
+ "Unexpected Certificate Verify handshake message" );
1166
+ }
1167
+
1160
1168
T13CertificateVerifyMessage cvm =
1161
1169
new T13CertificateVerifyMessage (hc , message );
1162
1170
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -881,6 +881,14 @@ public void consume(ConnectionContext context,
881
881
882
882
private void onConsumeFinished (ClientHandshakeContext chc ,
883
883
ByteBuffer message ) throws IOException {
884
+ // Ensure that the Finished message has not been sent w/o
885
+ // an EncryptedExtensions preceding
886
+ if (chc .handshakeConsumers .containsKey (
887
+ SSLHandshake .ENCRYPTED_EXTENSIONS .id )) {
888
+ throw chc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
889
+ "Unexpected Finished handshake message" );
890
+ }
891
+
884
892
// Make sure that any expected CertificateVerify message
885
893
// has been received and processed.
886
894
if (!chc .isResumption ) {
You can’t perform that action at this time.
0 commit comments