The most complex part of ssl is the handshake protocol.
When Handshaking Takes Place. In order to establish a connection between a computer and a device like a modem, printer, or server, the handshake process begins the connection by telling both devices how to communicate with each other. A classic example is the noises made when two dial-up modems connect to each other.