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, 2021 , 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
@@ -1160,6 +1160,15 @@ public void consume(ConnectionContext context,
1160
1160
1161
1161
// clean up this consumer
1162
1162
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE .id );
1163
+
1164
+ // Ensure that the Certificate message has not been sent w/o
1165
+ // an EncryptedExtensions preceding
1166
+ if (hc .handshakeConsumers .containsKey (
1167
+ SSLHandshake .ENCRYPTED_EXTENSIONS .id )) {
1168
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1169
+ "Unexpected Certificate handshake message" );
1170
+ }
1171
+
1163
1172
T13CertificateMessage cm = new T13CertificateMessage (hc , message );
1164
1173
if (hc .sslConfig .isClientMode ) {
1165
1174
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2021 , 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
@@ -1160,6 +1160,14 @@ public void consume(ConnectionContext context,
1160
1160
// Clean up this consumer
1161
1161
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE_VERIFY .id );
1162
1162
1163
+ // Ensure that the Certificate Verify message has not been sent w/o
1164
+ // a Certificate message preceding
1165
+ if (hc .handshakeConsumers .containsKey (
1166
+ SSLHandshake .CERTIFICATE .id )) {
1167
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1168
+ "Unexpected Certificate Verify handshake message" );
1169
+ }
1170
+
1163
1171
T13CertificateVerifyMessage cvm =
1164
1172
new T13CertificateVerifyMessage (hc , message );
1165
1173
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2021 , 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
@@ -900,6 +900,14 @@ public void consume(ConnectionContext context,
900
900
901
901
private void onConsumeFinished (ClientHandshakeContext chc ,
902
902
ByteBuffer message ) throws IOException {
903
+ // Ensure that the Finished message has not been sent w/o
904
+ // an EncryptedExtensions preceding
905
+ if (chc .handshakeConsumers .containsKey (
906
+ SSLHandshake .ENCRYPTED_EXTENSIONS .id )) {
907
+ throw chc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
908
+ "Unexpected Finished handshake message" );
909
+ }
910
+
903
911
// Make sure that any expected CertificateVerify message
904
912
// has been received and processed.
905
913
if (!chc .isResumption ) {
You can’t perform that action at this time.
0 commit comments