Table of Contents

What is StartTLS? known also as Opportunistic TLS

About

StartTLS or Opportunistic TLS is a communication pattern that secures the traffic in the middle of a plaintext connection.

It is different from SSL/TLS, which secures the traffic from the beginning of the connection.

Usage

It's used in cases where the server supports both:

For instance, SMTP is not secured by default, which means that if you were to send an email over SMTP without StartTLS the email could be intercepted and easily interpreted.

Steps

StartTLS is composed of three steps:

Example

Example of SMTP scenario

S: 220 mail.example.org ESMTP service ready  # <-- The server presents itself
C: EHLO client.example.org # <-- The client presents itself
S: 250-mail.example.org offers a warm hug of welcome  # <-- The server welcomes
S: 250 STARTTLS # <-- The server makes StartTls mandatory
C: STARTTLS  # <-- The StartTls client request
S: 220 Go ahead # <-- The server is ready for the handshake
C: <starts TLS negotiation> 
C & S: <negotiate a TLS session>
C & S: <check result of negotiation>
C: EHLO client.example.org # <-- The connection is secured

Implementation

If you implement a server, you need to:

The client-side implementation is much simpler.

1)