How SSL works?
The Secure Socket Layer sits in between
the application layer (such as HTTP or RMI) and the transport layer (usually
TCP). It provides
encryption, authentication and session management services to the
application layer.
The figure above shows its position
in the TCP/IP four layer model. SSL is most often associated with HTTP( the ubiquitous HTTPS protocol)
but by no means is limited to this. Virtually all common
Internet protocols – Telnet, SMTP, NNTP, FTP, LDAP etc
can be used with secure sockets.
SSL is an Internet standard first
developed by Netscape in 1994. IETF has more recently taken over SSL
development and renamed it Transport
Layer Security
(TLS). TLS version 1.0 is a minor
development of SSL 3.0 (the protocol in fact identifies itself as SSL 3.1
during the negotiation phase).
SSL Handshaking
Setting up secure communication
between client and server takes quite a bit of setting up. The encryption and
authentication parts of SSL are optional
and a number of ciphers can be used for each. This cipher suite
needs to be negotiated and then key information and (optionally) digital certificates
exchanged. SSL handshaking takes care of all this when the SSL
connection is first established.
cipher suites.
in the Internet.
trusted Certificate
Authority a security warning message pops up.
If the
browser accepts the certificate chain the client will respond with:
a.
A certificate chain if
the server requested it.
b.
A session key encrypted
with the server’s public key. The session key is randomly generated for each
SSL session and used for symmetric
encryption of data. If
no RSA public key cipher is available, Diffie Hellman may be used for key agreement instead.
c.
Optionally, a
certificate verify message. The client sends the server some signed
information, the server can then use the client certificate to verify that
the client is in the
possession of the private key corresponding to the certificate’s public key. This
option is rarely used.
d.
A change cipher spec
message indicating that the server should switch to encrypted mode. The client
selects the strongest cipher supported by both parties.
e.
A finished message to
indicate that the response is finished.
At this point the SSL session is
established and encrypted data can be exchanged between the client and the
server. For all data a HMAC message authentication code is calculated to
guarantee data authenticity and integrity. If the client is a browser, it will indicate
that the connection is secure by displaying
a key symbol (Netscape) or a lock symbol (IE) in its status
line.