157 byte type = HandshakeContext.getHandshakeType(this, |
157 byte type = HandshakeContext.getHandshakeType(this, |
158 plaintext); |
158 plaintext); |
159 if (handshakeContext == null) { |
159 if (handshakeContext == null) { |
160 if (type == SSLHandshake.KEY_UPDATE.id || |
160 if (type == SSLHandshake.KEY_UPDATE.id || |
161 type == SSLHandshake.NEW_SESSION_TICKET.id) { |
161 type == SSLHandshake.NEW_SESSION_TICKET.id) { |
162 if (isNegotiated && |
162 if (!isNegotiated) { |
163 protocolVersion.useTLS13PlusSpec()) { |
163 throw fatal(Alert.UNEXPECTED_MESSAGE, |
164 handshakeContext = new PostHandshakeContext(this); |
164 "Unexpected unnegotiated post-handshake" + |
165 } else { |
165 " message: " + |
|
166 SSLHandshake.nameOf(type)); |
|
167 } |
|
168 if (type == SSLHandshake.KEY_UPDATE.id && |
|
169 !protocolVersion.useTLS13PlusSpec()) { |
166 throw fatal(Alert.UNEXPECTED_MESSAGE, |
170 throw fatal(Alert.UNEXPECTED_MESSAGE, |
167 "Unexpected post-handshake message: " + |
171 "Unexpected post-handshake message: " + |
168 SSLHandshake.nameOf(type)); |
172 SSLHandshake.nameOf(type)); |
169 } |
173 } |
|
174 handshakeContext = new PostHandshakeContext(this); |
170 } else { |
175 } else { |
171 handshakeContext = sslConfig.isClientMode ? |
176 handshakeContext = sslConfig.isClientMode ? |
172 new ClientHandshakeContext(sslContext, this) : |
177 new ClientHandshakeContext(sslContext, this) : |
173 new ServerHandshakeContext(sslContext, this); |
178 new ServerHandshakeContext(sslContext, this); |
174 outputRecord.initHandshaker(); |
179 outputRecord.initHandshaker(); |