SSL TLS
SSL TLS
SSL architecture
SSL
SSL
Handshake
Handshake
Protocol
Protocol
SSL
SSLChange
Change
Cipher
CipherSpec
Spec
Protocol
Protocol
SSL
SSL
Alert
Alert
Protocol
Protocol
applications
applications
(e.g.,
(e.g.,HTTP)
HTTP)
SSL
SSLRecord
RecordProtocol
Protocol
TCP
TCP
IP
IP
SSL components
SSL Handshake Protocol
negotiation of security algorithms and parameters
key exchange
server authentication and optionally client authentication
fragmentation
compression
message authentication and integrity protection
encryption
peer certificate
X509 certificate of the peer
may be null
compression method
cipher spec
bulk data encryption algorithm (e.g., null, DES, 3DES, )
MAC algorithm (e.g., MD5, SHA-1)
cryptographic attributes (e.g., hash size, IV size, )
master secret
48-byte secret shared between the client and the server
is resumable
a flag indicating whether the session can be used to initiate new connections
connection states
6
initialization vectors
an IV is maintained for each encryption key if CBC mode is used
initialized by the SSL Handshake Protocol
final ciphertext block from each record is used as IV with the following record
State changes
operating state
currently used state
pending state
state to be used
built using the current state
party B
(server or client)
Chan
g e Ci
p her
Sp e c
fragmentation
SSLPlaintext
type version length
compression
SSLCompressed
MAC padding
Header
type
the higher level protocol used to process the enclosed fragment
possible types:
change_cipher_spec
alert
handshake
application_data
version
SSL Record Protocol
length
length (in bytes) of the enclosed fragment or compressed fragment
max value is 214 + 2048
10
MAC
MAC = hash( MAC_write_secret | pad_2 |
hash( MAC_write_secret | pad_1 | seq_num | type | length | fragment ) )
11
Encryption
supported algorithms
block ciphers (in CBC mode)
RC2_40
DES_40
DES_56
3DES_168
IDEA_128
Fortezza_80
stream ciphers
RC4_40
RC4_128
12
unexpected_message
bad_record_MAC
decompression_failure
handshake_failure
illegal_parameter
warning
close_notify
no_certificate
bad_certificate
unsupported_certificate
certificate_revoked
certificate_expired
certificate_unknown
server
client_hello
server_hello
certificate
server_key_exchange
certificate_request
server_hello_done
certificate
client_key_exchange
certificate_verify
change_cipher_spec
finished
change_cipher_spec
finished
14
Hello messages
client_hello
client_version
the highest version supported by the client
client_random
current time (4 bytes) + pseudo random bytes (28 bytes)
session_id
empty if the client wants to create a new session, or
the session ID of an old session within which the client wants to create the new
connection
cipher_suites
list of cryptographic options supported by the client ordered by preference
a cipher suite contains the specification of the
key exchange method, the encryption and the MAC algorithm
the algorithms implicitly specify the hash_size, IV_size, and key_material parameters (part
of the Cipher Spec of the session state)
exmaple: SSL_RSA_with_3DES_EDE_CBC_SHA
compression_methods
list of compression methods supported by the client
15
server_random
session_id
session ID chosen by the server
if the client wanted to resume an old session:
server checks if the session is resumable
if so, it responds with the session ID and the parties proceed to the finished messages
cipher_suite
single cipher suite selected by the server from the list given by the client
compression_method
single compression method selected by the server
16
anonymous Diffie-Hellman
both the server and the client generate one-time DH parameters
they send their parameters to the peer without authentication
Fortezza
Fortezza proprietary key exchange scheme
17
server_key_exchange
sent only if the certificate does not contain enough information to complete the
key exchange (e.g., the certificate contains an RSA signing key only)
may contain
public RSA key (exponent and modulus), or
DH parameters (p, g, public DH value), or
Fortezza parameters
digitally signed
if DSS: SHA-1 hash of (client_random | server_random | server_params) is signed
if RSA: MD5 hash and SHA-1 hash of (client_random | server_random |
server_params) are concatenated and encrypted with the private RSA key
18
server_hello_done
sent to indicate that the server is finished its part of the key exchange
after sending this message the server waits for client response
the client should verify that the server provided a valid certificate and
the server parameters are acceptable
19
client_key_exchange
always sent (but it is empty if the key exchange method is fix DH)
may contain
RSA encrypted pre-master secret, or
client one-time public DH value, or
Fortezza key exchange parameters
certificate_verify
sent only if the client sent a certificate
provides client authentication
contains signed hash of all the previous handshake messages
if DSS: SHA-1 hash is signed
if RSA: MD5 and SHA-1 hash is concatenated and encrypted with the private key
MD5( master_secret | pad_2 | MD5( handshake_messages | master_secret | pad_1 ) )
SHA( master_secret | pad_2 | SHA( handshake_messages | master_secret | pad_1 ) )
20
Finished messages
finished
where sender is a code that identifies that the sender is the client or the
server (client: 0x434C4E54; server: 0x53525652)
21
Cryptographic computations
pre-master secret
if key exchange is RSA based:
generated by the client
sent to the server encrypted with the servers public RSA key
key block :
client write MAC secret server write MAC secret
22
or
23
or
25
not allowed
27
MAC
TLS uses HMAC
the MAC covers the version field of the record header too
certificate_verify message
the hash is computed only over the handshake messages
in SSL the hash contained the master_secret and pads
28
29
cryptographic computations
pre-master secret is calculated in the same way as in SSL
master secret:
PRF( pre_master_secret,
master secret,
client_random | server_random )
key block:
PRF( master_secret,
key expansion,
server_random | client_random )
31