Revision 39350a4c4d646ff97b250c4f59379674c4fb7d31 (click the page title to view the current version)
TLS Handshake Model
This example demonstrates modeling the TLS 1.2 handshake protocol (RFC 5246, section 7.3) between a client and a server, as a product line: anonymous mode and client authentication are features, fixed in each trace.
Client Server
ClientHello -------->
ServerHello
Certificate*
ServerKeyExchange*
CertificateRequest*
<-------- ServerHelloDone
Certificate*
ClientKeyExchange
CertificateVerify*
[ChangeCipherSpec]
Finished -------->
[ChangeCipherSpec]
<-------- Finished
Application Data <-------> Application Data
The server answers with a protocol_version alert when the client and the server have no version in common, and a fatal alert ends the connection.
Feature modeling
abstract final Feature
abstract final FeatureModel
TLSFeatures : FeatureModel
// the server requests a client certificate only from a known server (no anonymous mode)
abstract final Domain
enum ProtocolVersion = SSL2_0 | SSL3_0 | TLS1_0 | TLS1_1 | TLS1_2
enum HandshakeStatus = initiated | completed | failed
abstract Port
abstract final Message
Server side messages
Client side messages
Application data
Nodes
Connecting messages
Concrete client and server
The main protocol
A phase of the channel is left only from its last states. A transition that leaves a phase is a constraint of the channel: as a transition of a state nested in the phase, it would lapse when the phase is left, which is when it should take effect.
Protocol : Domain
// the application data flows until a new handshake (renegotiation)
xor channel
// The phases of the connection. A phase is left only from its last states, and a
xor serverResponse// transition that leaves a phase is a constraint of the channel: as a transition of a state
[ handshakeStatus = initiated ]// nested in the phase, it would lapse when the phase is left, which is when it should take
[ initially serverHello || mismatch ]// effect. The transitions within a phase hold while the phase lasts.
serverHello
serverCertificate// the server picks a version that both support
[ serverCertificate -[no clientAuthentication]-> serverKeyExchange || serverHelloDone ]// a known server sends its certificate; an anonymous one its key exchange
serverKeyExchange
serverHelloDone
[ serverResponse -[ ! (serverResponse.mismatch || serverResponse.serverHelloDone)]-> serverResponse ]// features: client authentication
xor clientResponse
// the client sends its certificate when the server requests it
// both Finished messages complete the handshake
clientKeyExchange
[ clientKeyExchange -[clientAuthentication && some client.certificate.signing]-> certificateVerify ]
[ clientKeyExchange -[ ! (clientAuthentication && some client.certificate.signing)]-> clientChangeCipherSpec ]
certificateVerify --> clientChangeCipherSpec
[ client.send = certificateVerifyMessage ]// a client with a certificate that can sign proves that it has the private key
clientFinished
// a fatal alert ends the connection
