Learning Python Network Programming

(Sean Pound) #1

Programming with Sockets


Let us examine the SSL handshake process between the client and the server. In
the first step of a SSL handshake, the client sends a Hello message to the remote
server saying what it is capable of, in terms handling key files, encrypting messages,
doing message integrity checks, and so on. In the following screenshot, you can see
that the client is presenting a set of 38 cipher suites to the server to choose relevant
algorithms. It also sends the TLS version number 1.0 and a random number to
generate a master secret for encrypting the subsequent message exchanges. This
is helpful for preventing any third party to look inside the packets. The random
numbers seen in the hello messages are used to generate the pre-master secret,
which both ends will process further to arrive at the master secret, and then use
that to generate the symmetric key.


In the second packet from server to client, the server selects the cipher suite
TLS_ECDHE_RSA_WITH_RC4_128_SHA for the purpose of connecting to the client.
This roughly means the server wants to use the RSA algorithm for key handling,
RC4 for encryption, and SHA for integrity checking (hashing). This is shown in the
following screenshot:

Free download pdf