Le 20/07/2014 23:11, Jeff MAURY a écrit : > On Sat, Jul 19, 2014 at 6:25 PM, Emmanuel Lécharny <elecha...@gmail.com> > wrote: > >> Le 19/07/2014 17:34, Jeff MAURY a écrit : >>> No, I don't agree with that because the spec says that the new key >> materials should be set current only when the change cipher spec message is >> received from the server. So I think we can continue sending messages >> encrypted with the old key if the handshake messages are after in the queue. >> >> What I read from the spec (RFC 6101, par 5.5) : >> "the client sends a client hello message to which the server must >> respond with a server hello message, or else a fatal error will occur >> and the connection will fail " suggest the opposite. >> > This is related to the initial handshake. What we are discussing is more > rehandshake and the fact that the server has messages to sent to will > precede the handshake messages. > I am reading the TLS spec (RFC 5246) not the SSL one (will do it). > If you look at the TLS spec, the chapter 7.1 says: > > The ChangeCipherSpec message is sent by both the client and the > server to notify the receiving party that subsequent records will be > protected under the newly negotiated CipherSpec and keys. Reception > of this message causes the receiver to instruct the record layer to > immediately copy the read pending state into the read current state. > Immediately after sending this message, the sender MUST instruct the > > record layer to make the write pending state the write active state. The SSL sepc says basically the same thing.
However, that only means we shoudl switch to the new keys when the handshake is done. It does not say anything about any pending message. I still think that once one peer has started an HandShake, whatever pending message will be lost, because I don't think the SslEngine will handle an incoming data not being part of the handshake protocol.