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, 2022 , 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
@@ -1129,6 +1129,15 @@ public void consume(ConnectionContext context,
1129
1129
1130
1130
// clean up this consumer
1131
1131
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE .id );
1132
+
1133
+ // Ensure that the Certificate message has not been sent w/o
1134
+ // an EncryptedExtensions preceding
1135
+ if (hc .handshakeConsumers .containsKey (
1136
+ SSLHandshake .ENCRYPTED_EXTENSIONS .id )) {
1137
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1138
+ "Unexpected Certificate handshake message" );
1139
+ }
1140
+
1132
1141
T13CertificateMessage cm = new T13CertificateMessage (hc , message );
1133
1142
if (hc .sslConfig .isClientMode ) {
1134
1143
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2022 , 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
@@ -1163,6 +1163,14 @@ public void consume(ConnectionContext context,
1163
1163
// Clean up this consumer
1164
1164
hc .handshakeConsumers .remove (SSLHandshake .CERTIFICATE_VERIFY .id );
1165
1165
1166
+ // Ensure that the Certificate Verify message has not been sent w/o
1167
+ // a Certificate message preceding
1168
+ if (hc .handshakeConsumers .containsKey (
1169
+ SSLHandshake .CERTIFICATE .id )) {
1170
+ throw hc .conContext .fatal (Alert .UNEXPECTED_MESSAGE ,
1171
+ "Unexpected Certificate Verify handshake message" );
1172
+ }
1173
+
1166
1174
T13CertificateVerifyMessage cvm =
1167
1175
new T13CertificateVerifyMessage (hc , message );
1168
1176
if (SSLLogger .isOn && SSLLogger .isOn ("ssl,handshake" )) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2022 , 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