Cryptography Reference
In-Depth Information
if ( master_secret != NULL )
{
free( master_secret );
}
Other than calling tls_resume instead of tls_connect , nothing else changes.
As far as the rest of the library is concerned, it's as if the socket was never closed.
Of course, if you actually want to try this out, you need to know what the ses-
sion ID and master secret are; you can go ahead and print them out just after
performing the TLS shutdown:
tls_shutdown( client_connection, &tls_context );
printf( “Session ID was: “ );
show_hex( tls_context.session_id, tls_context.session_id_length );
printf( “Master secret was: “ );
show_hex( tls_context.master_secret, MASTER_SECRET_LENGTH );
if ( close( client_connection ) == -1 )
Viewing a Resumed Session
The following code illustrates a network trace of a resumed session:
debian:/home/jdavies/devl/test/c/ssl# tcpdump -s 0 -X -i lo tcp port 8443
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
… (omitted initial handshake)
21:54:05.568241 IP localhost.37289 > localhost.8443: Flags [P.], ack 1, win 257,
Handshake
Header
options [nop,nop,TS val 274087 ecr 274087], length 82
0x0000: 4500 0086 88b0 4000 4006 b3bf 7f00 0001 E.....@.@.......
0x0010: 7f00 0001 91a9 20fb d246 a60a d260 dc47 .........F...`.G
Client Hello
Version
0x0020: 8018 0101 fe7a 0000 0101 080a 0004 2ea7 .....z..........
TLS Header
Client
Random
0x0030: 0004 2ea7 1603 0100 4d01 0000 4903 014c ........M...I..L
0x0040: 743f 7d00 0000 0000 0000 0000 0000 0000 t?}.............
Session Id
Length
0x0050: 0000 0000 0000 0000 0000 0000 0000 0020 ................
Session Id
0x0060: be2e b988 f5bc 6412 5981 35f7 7e3b 2128 ......d.Y.5.~;!(
0x0070: f8cc 4e6f fc52 77fd a687 2ac5 0f1e cbbb ..No.Rw...*.....
List of Cipher
Suites
Compression
Methods
0x0080: 0002 000a 0100 ......
Here, the client hello message looks like the client hello message in Chapter
6, except that, this time, the session ID is non-empty.
Search WWH ::




Custom Search