Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Transport Layer Security
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Basic TLS handshake==== A typical connection example follows, illustrating a [[Handshake (computing)|handshake]] where the server (but not the client) is authenticated by its certificate: #Negotiation phase: #*A client sends a '''ClientHello''' message specifying the highest TLS protocol version it supports, a random number, a list of suggested [[cipher suite]]s and suggested compression methods. If the client is attempting to perform a resumed handshake, it may send a ''session ID''. If the client can use [[Application-Layer Protocol Negotiation]], it may include a list of supported application [[communications protocol|protocols]], such as [[HTTP/2]]. #*The server responds with a '''ServerHello''' message, containing the chosen protocol version, a random number, cipher suite and compression method from the choices offered by the client. To confirm or allow resumed handshakes the server may send a ''session ID''. The chosen protocol version should be the highest that both the client and server support. For example, if the client supports TLS version 1.1 and the server supports version 1.2, version 1.1 should be selected; version 1.2 should not be selected. #*The server sends its '''Certificate''' message (depending on the selected cipher suite, this may be omitted by the server).<ref name="openpgp">These certificates are currently [[X.509]], but {{IETF RFC|6091}} also specifies the use of [[OpenPGP]]-based certificates.</ref> #*The server sends its '''ServerKeyExchange''' message (depending on the selected cipher suite, this may be omitted by the server). This message is sent for all [[Diffie–Hellman key exchange|DHE]], [[ECDHE]] and DH_anon cipher suites.{{ref RFC|5246}} #*The server sends a '''ServerHelloDone''' message, indicating it is done with handshake negotiation. #*The client responds with a '''ClientKeyExchange''' message, which may contain a ''PreMasterSecret'', public key, or nothing. (Again, this depends on the selected cipher.) This ''PreMasterSecret'' is encrypted using the public key of the server certificate. #*The client and server then use the random numbers and ''PreMasterSecret'' to compute a common secret, called the "master secret". All other key data ([[session key]]s such as [[initialization vector|IV]], [[symmetric encryption]] key, [[message authentication code|MAC]] key<ref>{{cite web|title=tls – Differences between the terms "pre-master secret", "master secret", "private key", and "shared secret"?|url=https://crypto.stackexchange.com/questions/27131/differences-between-the-terms-pre-master-secret-master-secret-private-key|access-date=2020-10-01|website=Cryptography Stack Exchange|archive-date=2020-09-22|archive-url=https://web.archive.org/web/20200922021454/https://crypto.stackexchange.com/questions/27131/differences-between-the-terms-pre-master-secret-master-secret-private-key|url-status=live}}</ref>) for this connection is derived from this master secret (and the client- and server-generated random values), which is passed through a carefully designed [[pseudorandomness|pseudorandom]] function. #The client now sends a '''ChangeCipherSpec''' record, essentially telling the server, "Everything I tell you from now on will be authenticated (and encrypted if encryption parameters were present in the server certificate)." The ChangeCipherSpec is itself a record-level protocol with content type of 20. #*The client sends an authenticated and encrypted '''Finished''' message, containing a hash and MAC over the previous handshake messages. #*The server will attempt to decrypt the client's ''Finished'' message and verify the hash and MAC. If the decryption or verification fails, the handshake is considered to have failed and the connection should be terminated. #Finally, the server sends a '''ChangeCipherSpec''', telling the client, "Everything I tell you from now on will be authenticated (and encrypted, if encryption was negotiated)." #*The server sends its authenticated and encrypted '''Finished''' message. #*The client performs the same decryption and verification procedure as the server did in the previous step. #Application phase: at this point, the "handshake" is complete and the application protocol is enabled, with content type of 23. Application messages exchanged between client and server will also be authenticated and optionally encrypted exactly like in their ''Finished'' message. Otherwise, the content type will return 25 and the client will not authenticate.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)