src/java.base/share/classes/sun/security/ssl/ServerHello.java
changeset 51574 ed52ea83f830
parent 50768 68fa3d4026ea
child 53055 c36464ea1f04
equal deleted inserted replaced
51573:3b3685479784 51574:ed52ea83f830
    38 import java.util.Optional;
    38 import java.util.Optional;
    39 import javax.crypto.SecretKey;
    39 import javax.crypto.SecretKey;
    40 import javax.crypto.spec.IvParameterSpec;
    40 import javax.crypto.spec.IvParameterSpec;
    41 import javax.net.ssl.SSLException;
    41 import javax.net.ssl.SSLException;
    42 import javax.net.ssl.SSLHandshakeException;
    42 import javax.net.ssl.SSLHandshakeException;
       
    43 import javax.net.ssl.SSLProtocolException;
    43 import sun.security.ssl.CipherSuite.KeyExchange;
    44 import sun.security.ssl.CipherSuite.KeyExchange;
    44 import sun.security.ssl.ClientHello.ClientHelloMessage;
    45 import sun.security.ssl.ClientHello.ClientHelloMessage;
    45 import sun.security.ssl.SSLCipher.SSLReadCipher;
    46 import sun.security.ssl.SSLCipher.SSLReadCipher;
    46 import sun.security.ssl.SSLCipher.SSLWriteCipher;
    47 import sun.security.ssl.SSLCipher.SSLWriteCipher;
    47 import sun.security.ssl.SSLHandshake.HandshakeMessage;
    48 import sun.security.ssl.SSLHandshake.HandshakeMessage;
   137                     ProtocolVersion.nameOf(major, minor));
   138                     ProtocolVersion.nameOf(major, minor));
   138             }
   139             }
   139 
   140 
   140             this.serverRandom = new RandomCookie(m);
   141             this.serverRandom = new RandomCookie(m);
   141             this.sessionId = new SessionId(Record.getBytes8(m));
   142             this.sessionId = new SessionId(Record.getBytes8(m));
   142             sessionId.checkLength(serverVersion.id);
   143             try {
   143 
   144                 sessionId.checkLength(serverVersion.id);
       
   145             } catch (SSLProtocolException ex) {
       
   146                 handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, ex);
       
   147             }
   144 
   148 
   145             int cipherSuiteId = Record.getInt16(m);
   149             int cipherSuiteId = Record.getInt16(m);
   146             this.cipherSuite = CipherSuite.valueOf(cipherSuiteId);
   150             this.cipherSuite = CipherSuite.valueOf(cipherSuiteId);
   147             if (cipherSuite == null || !context.isNegotiable(cipherSuite)) {
   151             if (cipherSuite == null || !context.isNegotiable(cipherSuite)) {
   148                 context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
   152                 context.conContext.fatal(Alert.ILLEGAL_PARAMETER,