1src/backend/libpq/README.SSL
2
3SSL
4===
5
6>From the servers perspective:
7
8
9  Receives StartupPacket
10           |
11           |
12 (Is SSL_NEGOTIATE_CODE?) -----------  Normal startup
13           |                  No
14           |
15           | Yes
16           |
17           |
18 (Server compiled with USE_SSL?) ------- Send 'N'
19           |                       No        |
20           |                                 |
21           | Yes                         Normal startup
22           |
23           |
24        Send 'S'
25           |
26           |
27      Establish SSL
28           |
29           |
30      Normal startup
31
32
33
34
35
36>From the clients perspective (v6.6 client _with_ SSL):
37
38
39      Connect
40         |
41         |
42  Send packet with SSL_NEGOTIATE_CODE
43         |
44         |
45  Receive single char  ------- 'S' -------- Establish SSL
46         |                                       |
47         | '<else>'                              |
48         |                                  Normal startup
49         |
50         |
51   Is it 'E' for error  ------------------- Retry connection
52         |                  Yes             without SSL
53         | No
54         |
55   Is it 'N' for normal ------------------- Normal startup
56         |                  Yes
57         |
58   Fail with unknown
59
60---------------------------------------------------------------------------
61