diff options
Diffstat (limited to 'src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java')
| -rw-r--r-- | src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java index af64383457a..d5d6a49b050 100644 --- a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -200,6 +200,15 @@ final class DHServerKeyExchange { } if (x509Credentials == null) { + // Only anonymous key exchange is unsigned. For any other + // cipher suite the server Certificate message must have been + // received before the ServerKeyExchange message. + if (!chc.negotiatedCipherSuite.isAnonymous()) { + throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "No X.509 credentials negotiated for " + + "DH ServerKeyExchange: missing Certificate"); + } + // anonymous, no authentication, no signature if (m.hasRemaining()) { throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE, |
