github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/Doc/Authentication-TLS-PSK-DHE.txt (about)

     1  Notes on authentication using symmetric keys
     2  --------------------------------------------
     3  
     4  Openssl TLS cipher suites
     5  ...
     6  
     7  
     8  
     9  
    10  https://tools.ietf.org/html/rfc4279
    11  DHE_PSK 
    12   - have perfect forward secrecy
    13   - protect against passive dictionary attaches
    14  
    15  
    16        Client                                               Server
    17        ------                                               ------
    18  
    19        ClientHello
    20        - version number desired
    21        - client random
    22  	    - 4 bytes
    23  		- date, time, 28bit strong random
    24        - session id (optional, for resume)
    25        - cipher suites available
    26        - compression algs available
    27        ClientHello                  -------->
    28                                                  ServerHello
    29                                                  - version number chosen
    30                                                  - version number chosen
    31  												- server random
    32  												  - 4 bytes
    33  												  - date, time, 28bit strong random
    34  												- session id
    35  												- cipher suite chosen
    36  												- compression alg chosen
    37  												ServerCertificate *
    38  												- x509 for server w/ pub key
    39  												  - client will use to encrypt premaster
    40  												ClientCertificateRequest *
    41  												- type requested (rsa or dss)
    42  												- acceptable CAs
    43                                                  ServerKeyExchange (includes dh params and optional psk hint)
    44  												- temporary key? for client to use later
    45  												- only used if pub cert doesn't contain suitable pub key
    46  												  or if ephemeral key exchange, or if using DSS cert for server
    47                                     <--------    ServerHelloDone
    48  	  [ generate 48byte premaster secret = f(client random | server random | ?) ]
    49  	  ClientCertificate *
    50  	  - x509 for client
    51        ClientKeyExchange (includes psk identity and dh params)
    52  	  - encrypted(K_serverpub, premaster), version number
    53  	  CertificateVerifyMessage
    54  	  - sign(K_clientpriv, hash of all previous msgs with both md5 and sha1)
    55        ChangeCipherSpec
    56  	  [ generate master secret = f(premaster secret), start using it) ]
    57        Finished                     -------->
    58                                                   ChangeCipherSpec
    59                                     <--------             Finished
    60        Application Data             <------->     Application Data
    61  	
    62  	 master secret = PRF(premaster | "master secret" | client random | server random)
    63  	 all other keys = PRF(master secret)
    64