/
draft-ietf-quic-tls.html
1706 lines (1603 loc) · 118 KB
/
draft-ietf-quic-tls.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>Using TLS to Secure QUIC</title>
<style type="text/css">/*<![CDATA[*/
body {
font: 16px "Helvetica Neue","Open Sans",Helvetica,Calibri,sans-serif;
color: #333;
font-size-adjust: 0.5;
line-height: 24px;
margin: 75px auto;
max-width: 624px;
padding: 0 5px;
}
.title, .filename, h1, h2, h3, h4, h5 {
font: 16px "Roboto Condensed","Helvetica Neue","Open Sans",Helvetica,Calibri,sans-serif;
font-size-adjust: 0.5;
font-weight: bold;
color: #333;
line-height: 100%;
margin: 1.2em 0 0.3em;
}
.title, #rfc\.title h1 { font-size: 32px; }
h1, section h1, h2, section h2, section h3, nav h2 { font-size: 20px; }
h3, section h4, h4, section h5 { font-size: 16px; }
h1 a[href], h2 a[href], h3 a[href], h4 a[href] {
color: #333;
}
table {
margin-left: 0em;
border-collapse: collapse;
}
th {
text-align: left;
border-bottom: 2px solid #ddd;
}
td {
border-top: 1px solid #ddd;
vertical-align: top;
}
tr:nth-child(2n+1) > td,
tr:nth-child(2n+1) > th {
background-color: #f9f9f9;
}
td.reference {
max-width: 200px;
border-top: none;
padding-right: 1em;
}
.right {
text-align: right;
}
table.header, table#rfc\.headerblock {
width: 100%;
}
table.header td, table#rfc\.headerblock td {
border: none;
background-color: transparent;
color: black;
padding: 0;
}
.filename {
display: block;
color: rgb(119, 119, 119);
font-size: 20px;
font-weight: normal;
line-height: 100%;
margin: 10px 0 32px;
}
#rfc\.abstract+p, #rfc\.abstract+p code, #rfc\.abstract+p samp, #rfc\.abstract+p tt {
font-size: 20px;
line-height: 28px;
}
samp, tt, code, pre, span.tt {
font-size: 13.5px;
font-family: Consolas, monospace;
font-size-adjust: none;
}
pre {
background-color: #eee;
border: 1px solid #ddd;
overflow-x: auto;
padding: 5px;
margin: 5px;
}
.figure, caption {
font-style: italic;
margin: 0 1.5em;
text-align: left;
}
address {
margin: 16px 2px;
line-height: 20px;
}
.vcard {
font-style: normal;
}
.vcardline {
display: block;
}
.vcardline .fn, address b {
font-weight: normal;
}
.vcardline .hidden {
display: none;
}
dl {
margin-left: 1em;
}
dl.dl-horizontal: {
margin-left: 0;
}
dl > dt {
float: left;
margin-right: 1em;
}
dl.nohang > dt {
float: none;
}
dl > dd {
margin-bottom: .5em;
}
dl.compact > dd {
margin-bottom: 0em;
}
dl > dd > dl {
margin-top: 0.5em;
margin-bottom: 0em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
hr {
border: 0;
border-top: 1px solid #eee;
}
hr.noprint {
display: none;
}
a {
text-decoration: none;
}
a[href] {
color: #2a6496;
}
a[href]:hover {
background-color: #eee;
}
p, ol, ul, li {
padding: 0;
}
p {
margin: 0.5em 0;
}
ol, ul {
margin: 0.2em 0 0.2em 2em;
}
li {
margin: 0.2em 0;
}
address {
font-style: normal;
}
ul.toc ul {
margin: 0 0 0 2em;
}
ul.toc li {
list-style: none;
margin: 0;
}
@media screen and (min-width: 924px) {
body {
padding-right: 350px;
}
body>ul.toc, body>#rfc\.toc {
position: fixed;
bottom: 0;
right: 0;
right: calc(50vw - 500px);
width: 300px;
z-index: 1;
overflow: auto;
overscroll-behavior: contain;
}
body>#rfc\.toc {
top: 55px;
}
body>ul.toc {
top: 100px;
}
ul.toc {
margin: 0 0 0 4px;
font-size: 12px;
line-height: 20px;
}
ul.toc ul {
margin-left: 1.2em;
}
}
.github-fork-ribbon-wrapper {
display: none;
}
@media screen and (min-width: 800px) {
/* "Fork me on GitHub" CSS ribbon based on
* https://github.com/simonwhitaker/github-fork-ribbon-css
*/
.github-fork-ribbon {
position: absolute;
padding: 2px 0;
background-color: #a00;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
font: 700 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
pointer-events: auto;
top: 38px;
right: -45px;
transform: rotate(45deg);
}
.github-fork-ribbon a[href],
.github-fork-ribbon a[href]:hover {
color: #fff;
background-color: transparent;
text-decoration: none;
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
text-align: center;
width: 190px;
line-height: 18px;
display: inline-block;
padding: 2px 0;
border: 1.5px dotted #fff;
border-color: rgba(255, 255, 255, 0.6);
}
.github-fork-ribbon-wrapper {
display: block;
width: 130px;
height: 130px;
position: absolute;
overflow: hidden;
top: 0; right: 0;
z-index: 2;
pointer-events: none;
}
}
@media screen and (min-width: 1000px) {
.github-fork-ribbon-wrapper {
position: fixed;
}
/*]]>*/</style>
<meta name="viewport" content="initial-scale=1.0">
<link href="#rfc.toc" rel="Contents">
<link href="#rfc.section.1" rel="Chapter" title="1 Introduction">
<link href="#rfc.section.2" rel="Chapter" title="2 Notational Conventions">
<link href="#rfc.section.2.1" rel="Chapter" title="2.1 TLS Overview">
<link href="#rfc.section.3" rel="Chapter" title="3 Protocol Overview">
<link href="#rfc.section.4" rel="Chapter" title="4 Carrying TLS Messages">
<link href="#rfc.section.4.1" rel="Chapter" title="4.1 Interface to TLS">
<link href="#rfc.section.4.1.1" rel="Chapter" title="4.1.1 Handshake Complete">
<link href="#rfc.section.4.1.2" rel="Chapter" title="4.1.2 Handshake Confirmed">
<link href="#rfc.section.4.1.3" rel="Chapter" title="4.1.3 Sending and Receiving Handshake Messages">
<link href="#rfc.section.4.1.4" rel="Chapter" title="4.1.4 Encryption Level Changes">
<link href="#rfc.section.4.1.5" rel="Chapter" title="4.1.5 TLS Interface Summary">
<link href="#rfc.section.4.2" rel="Chapter" title="4.2 TLS Version">
<link href="#rfc.section.4.3" rel="Chapter" title="4.3 ClientHello Size">
<link href="#rfc.section.4.4" rel="Chapter" title="4.4 Peer Authentication">
<link href="#rfc.section.4.5" rel="Chapter" title="4.5 Enabling 0-RTT">
<link href="#rfc.section.4.6" rel="Chapter" title="4.6 Rejecting 0-RTT">
<link href="#rfc.section.4.7" rel="Chapter" title="4.7 HelloRetryRequest">
<link href="#rfc.section.4.8" rel="Chapter" title="4.8 TLS Errors">
<link href="#rfc.section.4.9" rel="Chapter" title="4.9 Discarding Unused Keys">
<link href="#rfc.section.4.9.1" rel="Chapter" title="4.9.1 Discarding Initial Keys">
<link href="#rfc.section.4.9.2" rel="Chapter" title="4.9.2 Discarding Handshake Keys">
<link href="#rfc.section.4.9.3" rel="Chapter" title="4.9.3 Discarding 0-RTT Keys">
<link href="#rfc.section.5" rel="Chapter" title="5 Packet Protection">
<link href="#rfc.section.5.1" rel="Chapter" title="5.1 Packet Protection Keys">
<link href="#rfc.section.5.2" rel="Chapter" title="5.2 Initial Secrets">
<link href="#rfc.section.5.3" rel="Chapter" title="5.3 AEAD Usage">
<link href="#rfc.section.5.4" rel="Chapter" title="5.4 Header Protection">
<link href="#rfc.section.5.4.1" rel="Chapter" title="5.4.1 Header Protection Application">
<link href="#rfc.section.5.4.2" rel="Chapter" title="5.4.2 Header Protection Sample">
<link href="#rfc.section.5.4.3" rel="Chapter" title="5.4.3 AES-Based Header Protection">
<link href="#rfc.section.5.4.4" rel="Chapter" title="5.4.4 ChaCha20-Based Header Protection">
<link href="#rfc.section.5.5" rel="Chapter" title="5.5 Receiving Protected Packets">
<link href="#rfc.section.5.6" rel="Chapter" title="5.6 Use of 0-RTT Keys">
<link href="#rfc.section.5.7" rel="Chapter" title="5.7 Receiving Out-of-Order Protected Frames">
<link href="#rfc.section.6" rel="Chapter" title="6 Key Update">
<link href="#rfc.section.7" rel="Chapter" title="7 Security of Initial Messages">
<link href="#rfc.section.8" rel="Chapter" title="8 QUIC-Specific Additions to the TLS Handshake">
<link href="#rfc.section.8.1" rel="Chapter" title="8.1 Protocol Negotiation">
<link href="#rfc.section.8.2" rel="Chapter" title="8.2 QUIC Transport Parameters Extension">
<link href="#rfc.section.8.3" rel="Chapter" title="8.3 Removing the EndOfEarlyData Message">
<link href="#rfc.section.9" rel="Chapter" title="9 Security Considerations">
<link href="#rfc.section.9.1" rel="Chapter" title="9.1 Replay Attacks with 0-RTT">
<link href="#rfc.section.9.2" rel="Chapter" title="9.2 Packet Reflection Attack Mitigation">
<link href="#rfc.section.9.3" rel="Chapter" title="9.3 Peer Denial of Service">
<link href="#rfc.section.9.4" rel="Chapter" title="9.4 Header Protection Analysis">
<link href="#rfc.section.9.5" rel="Chapter" title="9.5 Key Diversity">
<link href="#rfc.section.10" rel="Chapter" title="10 IANA Considerations">
<link href="#rfc.references" rel="Chapter" title="11 References">
<link href="#rfc.references.1" rel="Chapter" title="11.1 Normative References">
<link href="#rfc.references.2" rel="Chapter" title="11.2 Informative References">
<link href="#rfc.appendix.A" rel="Chapter" title="A Sample Initial Packet Protection">
<link href="#rfc.appendix.A.1" rel="Chapter" title="A.1 Keys">
<link href="#rfc.appendix.A.2" rel="Chapter" title="A.2 Client Initial">
<link href="#rfc.appendix.A.3" rel="Chapter" title="A.3 Server Initial">
<link href="#rfc.appendix.B" rel="Chapter" title="B Change Log">
<link href="#rfc.appendix.B.1" rel="Chapter" title="B.1 Since draft-ietf-quic-tls-18">
<link href="#rfc.appendix.B.2" rel="Chapter" title="B.2 Since draft-ietf-quic-tls-17">
<link href="#rfc.appendix.B.3" rel="Chapter" title="B.3 Since draft-ietf-quic-tls-14">
<link href="#rfc.appendix.B.4" rel="Chapter" title="B.4 Since draft-ietf-quic-tls-13">
<link href="#rfc.appendix.B.5" rel="Chapter" title="B.5 Since draft-ietf-quic-tls-12">
<link href="#rfc.appendix.B.6" rel="Chapter" title="B.6 Since draft-ietf-quic-tls-11">
<link href="#rfc.appendix.B.7" rel="Chapter" title="B.7 Since draft-ietf-quic-tls-10">
<link href="#rfc.appendix.B.8" rel="Chapter" title="B.8 Since draft-ietf-quic-tls-09">
<link href="#rfc.appendix.B.9" rel="Chapter" title="B.9 Since draft-ietf-quic-tls-08">
<link href="#rfc.appendix.B.10" rel="Chapter" title="B.10 Since draft-ietf-quic-tls-07">
<link href="#rfc.appendix.B.11" rel="Chapter" title="B.11 Since draft-ietf-quic-tls-05">
<link href="#rfc.appendix.B.12" rel="Chapter" title="B.12 Since draft-ietf-quic-tls-04">
<link href="#rfc.appendix.B.13" rel="Chapter" title="B.13 Since draft-ietf-quic-tls-03">
<link href="#rfc.appendix.B.14" rel="Chapter" title="B.14 Since draft-ietf-quic-tls-02">
<link href="#rfc.appendix.B.15" rel="Chapter" title="B.15 Since draft-ietf-quic-tls-01">
<link href="#rfc.appendix.B.16" rel="Chapter" title="B.16 Since draft-ietf-quic-tls-00">
<link href="#rfc.appendix.B.17" rel="Chapter" title="B.17 Since draft-thomson-quic-tls-01">
<link href="#rfc.acknowledgments" rel="Chapter">
<link href="#rfc.contributors" rel="Chapter">
<link href="#rfc.authors" rel="Chapter">
<meta name="generator" content="xml2rfc version 2.22.2 - https://tools.ietf.org/tools/xml2rfc" />
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<meta name="dct.creator" content="Thomson, M., Ed. and S. Turner, Ed." />
<meta name="dct.identifier" content="urn:ietf:id:draft-ietf-quic-tls-latest" />
<meta name="dct.issued" scheme="ISO8601" content="2019-07-03" />
<meta name="dct.abstract" content="This document describes how Transport Layer Security (TLS) is used to secure QUIC." />
<meta name="description" content="This document describes how Transport Layer Security (TLS) is used to secure QUIC." />
</head>
<body>
<table class="header">
<tbody>
<tr>
<td class="left">QUIC</td>
<td class="right">M. Thomson, Ed.</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right">Mozilla</td>
</tr>
<tr>
<td class="left">Intended status: Standards Track</td>
<td class="right">S. Turner, Ed.</td>
</tr>
<tr>
<td class="left">Expires: January 4, 2020</td>
<td class="right">sn3rd</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">July 03, 2019</td>
</tr>
</tbody>
</table>
<p class="title">Using TLS to Secure QUIC<br />
<span class="filename">draft-ietf-quic-tls-latest</span></p>
<h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1>
<p>This document describes how Transport Layer Security (TLS) is used to secure QUIC.</p>
<h1><a>Note to Readers</a></h1>
<p>Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org), which is archived at <a href="https://mailarchive.ietf.org/arch/search/?email_list=quic">https://mailarchive.ietf.org/arch/search/?email_list=quic</a>.</p>
<p>Working Group information can be found at <a href="https://github.com/quicwg">https://github.com/quicwg</a>; source code and issues list for this draft can be found at <a href="https://github.com/quicwg/base-drafts/labels/-tls">https://github.com/quicwg/base-drafts/labels/-tls</a>.</p>
<h1 id="rfc.status"><a href="#rfc.status">Status of This Memo</a></h1>
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>
<p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.</p>
<p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."</p>
<p>This Internet-Draft will expire on January 4, 2020.</p>
<h1 id="rfc.copyrightnotice"><a href="#rfc.copyrightnotice">Copyright Notice</a></h1>
<p>Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.</p>
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p>
<hr class="noprint" />
<h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
<ul class="toc">
<li>1. <a href="#rfc.section.1">Introduction</a>
</li>
<li>2. <a href="#rfc.section.2">Notational Conventions</a>
</li>
<ul><li>2.1. <a href="#rfc.section.2.1">TLS Overview</a>
</li>
</ul><li>3. <a href="#rfc.section.3">Protocol Overview</a>
</li>
<li>4. <a href="#rfc.section.4">Carrying TLS Messages</a>
</li>
<ul><li>4.1. <a href="#rfc.section.4.1">Interface to TLS</a>
</li>
<ul><li>4.1.1. <a href="#rfc.section.4.1.1">Handshake Complete</a>
</li>
<li>4.1.2. <a href="#rfc.section.4.1.2">Handshake Confirmed</a>
</li>
<li>4.1.3. <a href="#rfc.section.4.1.3">Sending and Receiving Handshake Messages</a>
</li>
<li>4.1.4. <a href="#rfc.section.4.1.4">Encryption Level Changes</a>
</li>
<li>4.1.5. <a href="#rfc.section.4.1.5">TLS Interface Summary</a>
</li>
</ul><li>4.2. <a href="#rfc.section.4.2">TLS Version</a>
</li>
<li>4.3. <a href="#rfc.section.4.3">ClientHello Size</a>
</li>
<li>4.4. <a href="#rfc.section.4.4">Peer Authentication</a>
</li>
<li>4.5. <a href="#rfc.section.4.5">Enabling 0-RTT</a>
</li>
<li>4.6. <a href="#rfc.section.4.6">Rejecting 0-RTT</a>
</li>
<li>4.7. <a href="#rfc.section.4.7">HelloRetryRequest</a>
</li>
<li>4.8. <a href="#rfc.section.4.8">TLS Errors</a>
</li>
<li>4.9. <a href="#rfc.section.4.9">Discarding Unused Keys</a>
</li>
<ul><li>4.9.1. <a href="#rfc.section.4.9.1">Discarding Initial Keys</a>
</li>
<li>4.9.2. <a href="#rfc.section.4.9.2">Discarding Handshake Keys</a>
</li>
<li>4.9.3. <a href="#rfc.section.4.9.3">Discarding 0-RTT Keys</a>
</li>
</ul></ul><li>5. <a href="#rfc.section.5">Packet Protection</a>
</li>
<ul><li>5.1. <a href="#rfc.section.5.1">Packet Protection Keys</a>
</li>
<li>5.2. <a href="#rfc.section.5.2">Initial Secrets</a>
</li>
<li>5.3. <a href="#rfc.section.5.3">AEAD Usage</a>
</li>
<li>5.4. <a href="#rfc.section.5.4">Header Protection</a>
</li>
<ul><li>5.4.1. <a href="#rfc.section.5.4.1">Header Protection Application</a>
</li>
<li>5.4.2. <a href="#rfc.section.5.4.2">Header Protection Sample</a>
</li>
<li>5.4.3. <a href="#rfc.section.5.4.3">AES-Based Header Protection</a>
</li>
<li>5.4.4. <a href="#rfc.section.5.4.4">ChaCha20-Based Header Protection</a>
</li>
</ul><li>5.5. <a href="#rfc.section.5.5">Receiving Protected Packets</a>
</li>
<li>5.6. <a href="#rfc.section.5.6">Use of 0-RTT Keys</a>
</li>
<li>5.7. <a href="#rfc.section.5.7">Receiving Out-of-Order Protected Frames</a>
</li>
</ul><li>6. <a href="#rfc.section.6">Key Update</a>
</li>
<li>7. <a href="#rfc.section.7">Security of Initial Messages</a>
</li>
<li>8. <a href="#rfc.section.8">QUIC-Specific Additions to the TLS Handshake</a>
</li>
<ul><li>8.1. <a href="#rfc.section.8.1">Protocol Negotiation</a>
</li>
<li>8.2. <a href="#rfc.section.8.2">QUIC Transport Parameters Extension</a>
</li>
<li>8.3. <a href="#rfc.section.8.3">Removing the EndOfEarlyData Message</a>
</li>
</ul><li>9. <a href="#rfc.section.9">Security Considerations</a>
</li>
<ul><li>9.1. <a href="#rfc.section.9.1">Replay Attacks with 0-RTT</a>
</li>
<li>9.2. <a href="#rfc.section.9.2">Packet Reflection Attack Mitigation</a>
</li>
<li>9.3. <a href="#rfc.section.9.3">Peer Denial of Service</a>
</li>
<li>9.4. <a href="#rfc.section.9.4">Header Protection Analysis</a>
</li>
<li>9.5. <a href="#rfc.section.9.5">Key Diversity</a>
</li>
</ul><li>10. <a href="#rfc.section.10">IANA Considerations</a>
</li>
<li>11. <a href="#rfc.references">References</a>
</li>
<ul><li>11.1. <a href="#rfc.references.1">Normative References</a>
</li>
<li>11.2. <a href="#rfc.references.2">Informative References</a>
</li>
</ul><li>Appendix A. <a href="#rfc.appendix.A">Sample Initial Packet Protection</a>
</li>
<ul><li>A.1. <a href="#rfc.appendix.A.1">Keys</a>
</li>
<li>A.2. <a href="#rfc.appendix.A.2">Client Initial</a>
</li>
<li>A.3. <a href="#rfc.appendix.A.3">Server Initial</a>
</li>
</ul><li>Appendix B. <a href="#rfc.appendix.B">Change Log</a>
</li>
<ul><li>B.1. <a href="#rfc.appendix.B.1">Since draft-ietf-quic-tls-18</a>
</li>
<li>B.2. <a href="#rfc.appendix.B.2">Since draft-ietf-quic-tls-17</a>
</li>
<li>B.3. <a href="#rfc.appendix.B.3">Since draft-ietf-quic-tls-14</a>
</li>
<li>B.4. <a href="#rfc.appendix.B.4">Since draft-ietf-quic-tls-13</a>
</li>
<li>B.5. <a href="#rfc.appendix.B.5">Since draft-ietf-quic-tls-12</a>
</li>
<li>B.6. <a href="#rfc.appendix.B.6">Since draft-ietf-quic-tls-11</a>
</li>
<li>B.7. <a href="#rfc.appendix.B.7">Since draft-ietf-quic-tls-10</a>
</li>
<li>B.8. <a href="#rfc.appendix.B.8">Since draft-ietf-quic-tls-09</a>
</li>
<li>B.9. <a href="#rfc.appendix.B.9">Since draft-ietf-quic-tls-08</a>
</li>
<li>B.10. <a href="#rfc.appendix.B.10">Since draft-ietf-quic-tls-07</a>
</li>
<li>B.11. <a href="#rfc.appendix.B.11">Since draft-ietf-quic-tls-05</a>
</li>
<li>B.12. <a href="#rfc.appendix.B.12">Since draft-ietf-quic-tls-04</a>
</li>
<li>B.13. <a href="#rfc.appendix.B.13">Since draft-ietf-quic-tls-03</a>
</li>
<li>B.14. <a href="#rfc.appendix.B.14">Since draft-ietf-quic-tls-02</a>
</li>
<li>B.15. <a href="#rfc.appendix.B.15">Since draft-ietf-quic-tls-01</a>
</li>
<li>B.16. <a href="#rfc.appendix.B.16">Since draft-ietf-quic-tls-00</a>
</li>
<li>B.17. <a href="#rfc.appendix.B.17">Since draft-thomson-quic-tls-01</a>
</li>
</ul><li><a href="#rfc.acknowledgments">Acknowledgments</a>
</li>
<li><a href="#rfc.contributors">Contributors</a>
</li>
<li><a href="#rfc.authors">Authors' Addresses</a>
</li>
</ul>
<h1 id="rfc.section.1">
<a href="#rfc.section.1">1.</a> <a href="#introduction" id="introduction">Introduction</a>
</h1>
<p id="rfc.section.1.p.1">This document describes how QUIC <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a> is secured using TLS <a href="#TLS13" class="xref">[TLS13]</a>.</p>
<p id="rfc.section.1.p.2">TLS 1.3 provides critical latency improvements for connection establishment over previous versions. Absent packet loss, most new connections can be established and secured within a single round trip; on subsequent connections between the same client and server, the client can often send application data immediately, that is, using a zero round trip setup.</p>
<p id="rfc.section.1.p.3">This document describes how TLS acts as a security component of QUIC.</p>
<h1 id="rfc.section.2">
<a href="#rfc.section.2">2.</a> <a href="#notational-conventions" id="notational-conventions">Notational Conventions</a>
</h1>
<p id="rfc.section.2.p.1">The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 <a href="#RFC2119" class="xref">[RFC2119]</a> <a href="#RFC8174" class="xref">[RFC8174]</a> when, and only when, they appear in all capitals, as shown here.</p>
<p id="rfc.section.2.p.2">This document uses the terminology established in <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a>.</p>
<p id="rfc.section.2.p.3">For brevity, the acronym TLS is used to refer to TLS 1.3, though a newer version could be used (see <a href="#tls-version" class="xref">Section 4.2</a>).</p>
<h2 id="rfc.section.2.1">
<a href="#rfc.section.2.1">2.1.</a> <a href="#tls-overview" id="tls-overview">TLS Overview</a>
</h2>
<p id="rfc.section.2.1.p.1">TLS provides two endpoints with a way to establish a means of communication over an untrusted medium (that is, the Internet) that ensures that messages they exchange cannot be observed, modified, or forged.</p>
<p id="rfc.section.2.1.p.2">Internally, TLS is a layered protocol, with the structure shown below:</p>
<pre>
+--------------+--------------+--------------+
| Handshake | Alerts | Application |
| Layer | | Data |
| | | |
+--------------+--------------+--------------+
| |
| Record Layer |
| |
+--------------------------------------------+
</pre>
<p id="rfc.section.2.1.p.3">Each upper layer (handshake, alerts, and application data) is carried as a series of typed TLS records. Records are individually cryptographically protected and then transmitted over a reliable transport (typically TCP) which provides sequencing and guaranteed delivery.</p>
<p id="rfc.section.2.1.p.4">Change Cipher Spec records cannot be sent in QUIC.</p>
<p id="rfc.section.2.1.p.5">The TLS authenticated key exchange occurs between two entities: client and server. The client initiates the exchange and the server responds. If the key exchange completes successfully, both client and server will agree on a secret. TLS supports both pre-shared key (PSK) and Diffie-Hellman (DH) key exchanges. PSK is the basis for 0-RTT; the latter provides perfect forward secrecy (PFS) when the DH keys are destroyed.</p>
<p id="rfc.section.2.1.p.6">After completing the TLS handshake, the client will have learned and authenticated an identity for the server and the server is optionally able to learn and authenticate an identity for the client. TLS supports X.509 <a href="#RFC5280" class="xref">[RFC5280]</a> certificate-based authentication for both server and client.</p>
<p id="rfc.section.2.1.p.7">The TLS key exchange is resistant to tampering by attackers and it produces shared secrets that cannot be controlled by either participating peer.</p>
<p id="rfc.section.2.1.p.8">TLS provides two basic handshake modes of interest to QUIC:</p>
<p></p>
<ul>
<li>A full 1-RTT handshake in which the client is able to send application data after one round trip and the server immediately responds after receiving the first handshake message from the client.</li>
<li>A 0-RTT handshake in which the client uses information it has previously learned about the server to send application data immediately. This application data can be replayed by an attacker so it MUST NOT carry a self-contained trigger for any non-idempotent action.</li>
</ul>
<p id="rfc.section.2.1.p.10">A simplified TLS handshake with 0-RTT application data is shown in <a href="#tls-full" class="xref">Figure 1</a>. Note that this omits the EndOfEarlyData message, which is not used in QUIC (see <a href="#remove-eoed" class="xref">Section 8.3</a>).</p>
<div id="rfc.figure.1"></div>
<div id="tls-full"></div>
<pre>
Client Server
ClientHello
(0-RTT Application Data) -------->
ServerHello
{EncryptedExtensions}
{Finished}
<-------- [Application Data]
{Finished} -------->
[Application Data] <-------> [Application Data]
() Indicates messages protected by early data (0-RTT) keys
{} Indicates messages protected using handshake keys
[] Indicates messages protected using application data
(1-RTT) keys
</pre>
<p class="figure">Figure 1: TLS Handshake with 0-RTT</p>
<p id="rfc.section.2.1.p.11">Data is protected using a number of encryption levels:</p>
<p></p>
<ul>
<li>Initial Keys</li>
<li>Early Data (0-RTT) Keys</li>
<li>Handshake Keys</li>
<li>Application Data (1-RTT) Keys</li>
</ul>
<p id="rfc.section.2.1.p.13">Application data may appear only in the early data and application data levels. Handshake and Alert messages may appear in any level.</p>
<p id="rfc.section.2.1.p.14">The 0-RTT handshake is only possible if the client and server have previously communicated. In the 1-RTT handshake, the client is unable to send protected application data until it has received all of the handshake messages sent by the server.</p>
<h1 id="rfc.section.3">
<a href="#rfc.section.3">3.</a> <a href="#protocol-overview" id="protocol-overview">Protocol Overview</a>
</h1>
<p id="rfc.section.3.p.1">QUIC <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a> assumes responsibility for the confidentiality and integrity protection of packets. For this it uses keys derived from a TLS handshake <a href="#TLS13" class="xref">[TLS13]</a>, but instead of carrying TLS records over QUIC (as with TCP), TLS Handshake and Alert messages are carried directly over the QUIC transport, which takes over the responsibilities of the TLS record layer, as shown below.</p>
<pre>
+--------------+--------------+ +-------------+
| TLS | TLS | | QUIC |
| Handshake | Alerts | | Applications|
| | | | (h3, etc.) |
+--------------+--------------+-+-------------+
| |
| QUIC Transport |
| (streams, reliability, congestion, etc.) |
| |
+---------------------------------------------+
| |
| QUIC Packet Protection |
| |
+---------------------------------------------+
</pre>
<p id="rfc.section.3.p.2">QUIC also relies on TLS for authentication and negotiation of parameters that are critical to security and performance.</p>
<p id="rfc.section.3.p.3">Rather than a strict layering, these two protocols are co-dependent: QUIC uses the TLS handshake; TLS uses the reliability, ordered delivery, and record layer provided by QUIC.</p>
<p id="rfc.section.3.p.4">At a high level, there are two main interactions between the TLS and QUIC components:</p>
<p></p>
<ul>
<li>The TLS component sends and receives messages via the QUIC component, with QUIC providing a reliable stream abstraction to TLS.</li>
<li>The TLS component provides a series of updates to the QUIC component, including (a) new packet protection keys to install (b) state changes such as handshake completion, the server certificate, etc.</li>
</ul>
<p><a href="#schematic" class="xref">Figure 2</a> shows these interactions in more detail, with the QUIC packet protection being called out specially.</p>
<div id="rfc.figure.2"></div>
<div id="schematic"></div>
<pre>
+------------+ +------------+
| |<- Handshake Messages ->| |
| |<---- 0-RTT Keys -------| |
| |<--- Handshake Keys-----| |
| QUIC |<---- 1-RTT Keys -------| TLS |
| |<--- Handshake Done ----| |
+------------+ +------------+
| ^
| Protect | Protected
v | Packet
+------------+
| QUIC |
| Packet |
| Protection |
+------------+
</pre>
<p class="figure">Figure 2: QUIC and TLS Interactions</p>
<p id="rfc.section.3.p.7">Unlike TLS over TCP, QUIC applications which want to send data do not send it through TLS “application_data” records. Rather, they send it as QUIC STREAM frames which are then carried in QUIC packets.</p>
<h1 id="rfc.section.4">
<a href="#rfc.section.4">4.</a> <a href="#carrying-tls" id="carrying-tls">Carrying TLS Messages</a>
</h1>
<p id="rfc.section.4.p.1">QUIC carries TLS handshake data in CRYPTO frames, each of which consists of a contiguous block of handshake data identified by an offset and length. Those frames are packaged into QUIC packets and encrypted under the current TLS encryption level. As with TLS over TCP, once TLS handshake data has been delivered to QUIC, it is QUIC’s responsibility to deliver it reliably. Each chunk of data that is produced by TLS is associated with the set of keys that TLS is currently using. If QUIC needs to retransmit that data, it MUST use the same keys even if TLS has already updated to newer keys.</p>
<p id="rfc.section.4.p.2">One important difference between TLS records (used with TCP) and QUIC CRYPTO frames is that in QUIC multiple frames may appear in the same QUIC packet as long as they are associated with the same encryption level. For instance, an implementation might bundle a Handshake message and an ACK for some Handshake data into the same packet.</p>
<p id="rfc.section.4.p.3">Some frames are prohibited in different encryption levels, others cannot be sent. The rules here generalize those of TLS, in that frames associated with establishing the connection can usually appear at any encryption level, whereas those associated with transferring data can only appear in the 0-RTT and 1-RTT encryption levels:</p>
<p></p>
<ul>
<li>PADDING frames MAY appear in packets of any encryption level.</li>
<li>CRYPTO and CONNECTION_CLOSE frames MAY appear in packets of any encryption level except 0-RTT.</li>
<li>ACK frames MAY appear in packets of any encryption level other than 0-RTT, but can only acknowledge packets which appeared in that packet number space.</li>
<li>All other frame types MUST only be sent in the 0-RTT and 1-RTT levels.</li>
</ul>
<p id="rfc.section.4.p.5">Note that it is not possible to send the following frames in 0-RTT for various reasons: ACK, CRYPTO, NEW_TOKEN, PATH_RESPONSE, and RETIRE_CONNECTION_ID.</p>
<p id="rfc.section.4.p.6">Because packets could be reordered on the wire, QUIC uses the packet type to indicate which level a given packet was encrypted under, as shown in <a href="#packet-types-levels" class="xref">Table 1</a>. When multiple packets of different encryption levels need to be sent, endpoints SHOULD use coalesced packets to send them in the same UDP datagram.</p>
<div id="rfc.table.1"></div>
<div id="packet-types-levels"></div>
<table cellpadding="3" cellspacing="0" class="tt full center">
<caption>Encryption Levels by Packet Type</caption>
<thead><tr>
<th class="left">Packet Type</th>
<th class="left">Encryption Level</th>
<th class="left">PN Space</th>
</tr></thead>
<tbody>
<tr>
<td class="left">Initial</td>
<td class="left">Initial secrets</td>
<td class="left">Initial</td>
</tr>
<tr>
<td class="left">0-RTT Protected</td>
<td class="left">0-RTT</td>
<td class="left">0/1-RTT</td>
</tr>
<tr>
<td class="left">Handshake</td>
<td class="left">Handshake</td>
<td class="left">Handshake</td>
</tr>
<tr>
<td class="left">Retry</td>
<td class="left">N/A</td>
<td class="left">N/A</td>
</tr>
<tr>
<td class="left">Version Negotiation</td>
<td class="left">N/A</td>
<td class="left">N/A</td>
</tr>
<tr>
<td class="left">Short Header</td>
<td class="left">1-RTT</td>
<td class="left">0/1-RTT</td>
</tr>
</tbody>
</table>
<p id="rfc.section.4.p.7">Section 17 of <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a> shows how packets at the various encryption levels fit into the handshake process.</p>
<h2 id="rfc.section.4.1">
<a href="#rfc.section.4.1">4.1.</a> <a href="#interface-to-tls" id="interface-to-tls">Interface to TLS</a>
</h2>
<p id="rfc.section.4.1.p.1">As shown in <a href="#schematic" class="xref">Figure 2</a>, the interface from QUIC to TLS consists of three primary functions:</p>
<p></p>
<ul>
<li>Sending and receiving handshake messages</li>
<li>Rekeying (both transmit and receive)</li>
<li>Handshake state updates</li>
</ul>
<p id="rfc.section.4.1.p.3">Additional functions might be needed to configure TLS.</p>
<h3 id="rfc.section.4.1.1">
<a href="#rfc.section.4.1.1">4.1.1.</a> <a href="#handshake-complete" id="handshake-complete">Handshake Complete</a>
</h3>
<p id="rfc.section.4.1.1.p.1">In this document, the TLS handshake is considered complete when the TLS stack has reported that the handshake is complete. This happens when the TLS stack has both sent a Finished message and verified the peer’s Finished message. Verifying the peer’s Finished provides the endpoints with an assurance that previous handshake messages have not been modified. Note that the handshake does not complete at both endpoints simultaneously. Consequently, any requirement that is based on the completion of the handshake depends on the perspective of the endpoint in question.</p>
<h3 id="rfc.section.4.1.2">
<a href="#rfc.section.4.1.2">4.1.2.</a> <a href="#handshake-confirmed" id="handshake-confirmed">Handshake Confirmed</a>
</h3>
<p id="rfc.section.4.1.2.p.1">In this document, the TLS handshake is considered confirmed at an endpoint when the following two conditions are met: the handshake is complete, and the endpoint has received an acknowledgment for a packet sent with 1-RTT keys. This second condition can be implemented by recording the lowest packet number sent with 1-RTT keys, and the highest value of the Largest Acknowledged field in any received 1-RTT ACK frame: once the latter is higher than or equal to the former, the handshake is confirmed.</p>
<h3 id="rfc.section.4.1.3">
<a href="#rfc.section.4.1.3">4.1.3.</a> <a href="#sending-and-receiving-handshake-messages" id="sending-and-receiving-handshake-messages">Sending and Receiving Handshake Messages</a>
</h3>
<p id="rfc.section.4.1.3.p.1">In order to drive the handshake, TLS depends on being able to send and receive handshake messages. There are two basic functions on this interface: one where QUIC requests handshake messages and one where QUIC provides handshake packets.</p>
<p id="rfc.section.4.1.3.p.2">Before starting the handshake QUIC provides TLS with the transport parameters (see <a href="#quic_parameters" class="xref">Section 8.2</a>) that it wishes to carry.</p>
<p id="rfc.section.4.1.3.p.3">A QUIC client starts TLS by requesting TLS handshake bytes from TLS. The client acquires handshake bytes before sending its first packet. A QUIC server starts the process by providing TLS with the client’s handshake bytes.</p>
<p id="rfc.section.4.1.3.p.4">At any given time, the TLS stack at an endpoint will have a current sending encryption level and receiving encryption level. Each encryption level is associated with a different flow of bytes, which is reliably transmitted to the peer in CRYPTO frames. When TLS provides handshake bytes to be sent, they are appended to the current flow and any packet that includes the CRYPTO frame is protected using keys from the corresponding encryption level.</p>
<p id="rfc.section.4.1.3.p.5">QUIC takes the unprotected content of TLS handshake records as the content of CRYPTO frames. TLS record protection is not used by QUIC. QUIC assembles CRYPTO frames into QUIC packets, which are protected using QUIC packet protection.</p>
<p id="rfc.section.4.1.3.p.6">When an endpoint receives a QUIC packet containing a CRYPTO frame from the network, it proceeds as follows:</p>
<p></p>
<ul>
<li>If the packet was in the TLS receiving encryption level, sequence the data into the input flow as usual. As with STREAM frames, the offset is used to find the proper location in the data sequence. If the result of this process is that new data is available, then it is delivered to TLS in order.</li>
<li>If the packet is from a previously installed encryption level, it MUST not contain data which extends past the end of previously received data in that flow. Implementations MUST treat any violations of this requirement as a connection error of type PROTOCOL_VIOLATION.</li>
<li>If the packet is from a new encryption level, it is saved for later processing by TLS. Once TLS moves to receiving from this encryption level, saved data can be provided. When providing data from any new encryption level to TLS, if there is data from a previous encryption level that TLS has not consumed, this MUST be treated as a connection error of type PROTOCOL_VIOLATION.</li>
</ul>
<p id="rfc.section.4.1.3.p.8">Each time that TLS is provided with new data, new handshake bytes are requested from TLS. TLS might not provide any bytes if the handshake messages it has received are incomplete or it has no data to send.</p>
<p id="rfc.section.4.1.3.p.9">Once the TLS handshake is complete, this is indicated to QUIC along with any final handshake bytes that TLS needs to send. TLS also provides QUIC with the transport parameters that the peer advertised during the handshake.</p>
<p id="rfc.section.4.1.3.p.10">Once the handshake is complete, TLS becomes passive. TLS can still receive data from its peer and respond in kind, but it will not need to send more data unless specifically requested - either by an application or QUIC. One reason to send data is that the server might wish to provide additional or updated session tickets to a client.</p>
<p id="rfc.section.4.1.3.p.11">When the handshake is complete, QUIC only needs to provide TLS with any data that arrives in CRYPTO streams. In the same way that is done during the handshake, new data is requested from TLS after providing received data.</p>
<h3 id="rfc.section.4.1.4">
<a href="#rfc.section.4.1.4">4.1.4.</a> <a href="#encryption-level-changes" id="encryption-level-changes">Encryption Level Changes</a>
</h3>
<p id="rfc.section.4.1.4.p.1">As keys for new encryption levels become available, TLS provides QUIC with those keys. Separately, as TLS starts using keys at a given encryption level, TLS indicates to QUIC that it is now reading or writing with keys at that encryption level. These events are not asynchronous; they always occur immediately after TLS is provided with new handshake bytes, or after TLS produces handshake bytes.</p>
<p id="rfc.section.4.1.4.p.2">TLS provides QUIC with three items as a new encryption level becomes available:</p>
<p></p>
<ul>
<li>A secret</li>
<li>An Authenticated Encryption with Associated Data (AEAD) function</li>
<li>A Key Derivation Function (KDF)</li>
</ul>
<p id="rfc.section.4.1.4.p.4">These values are based on the values that TLS negotiates and are used by QUIC to generate packet and header protection keys (see <a href="#packet-protection" class="xref">Section 5</a> and <a href="#header-protect" class="xref">Section 5.4</a>).</p>
<p id="rfc.section.4.1.4.p.5">If 0-RTT is possible, it is ready after the client sends a TLS ClientHello message or the server receives that message. After providing a QUIC client with the first handshake bytes, the TLS stack might signal the change to 0-RTT keys. On the server, after receiving handshake bytes that contain a ClientHello message, a TLS server might signal that 0-RTT keys are available.</p>
<p id="rfc.section.4.1.4.p.6">Although TLS only uses one encryption level at a time, QUIC may use more than one level. For instance, after sending its Finished message (using a CRYPTO frame at the Handshake encryption level) an endpoint can send STREAM data (in 1-RTT encryption). If the Finished message is lost, the endpoint uses the Handshake encryption level to retransmit the lost message. Reordering or loss of packets can mean that QUIC will need to handle packets at multiple encryption levels. During the handshake, this means potentially handling packets at higher and lower encryption levels than the current encryption level used by TLS.</p>
<p id="rfc.section.4.1.4.p.7">In particular, server implementations need to be able to read packets at the Handshake encryption level at the same time as the 0-RTT encryption level. A client could interleave ACK frames that are protected with Handshake keys with 0-RTT data and the server needs to process those acknowledgments in order to detect lost Handshake packets.</p>
<h3 id="rfc.section.4.1.5">
<a href="#rfc.section.4.1.5">4.1.5.</a> <a href="#tls-interface-summary" id="tls-interface-summary">TLS Interface Summary</a>
</h3>
<p><a href="#exchange-summary" class="xref">Figure 3</a> summarizes the exchange between QUIC and TLS for both client and server. Each arrow is tagged with the encryption level used for that transmission.</p>
<div id="rfc.figure.3"></div>
<div id="exchange-summary"></div>
<pre>
Client Server
Get Handshake
Initial ------------->
Install tx 0-RTT Keys
0-RTT --------------->
Handshake Received
Get Handshake
<------------- Initial
Install rx 0-RTT keys
Install Handshake keys
Get Handshake
<----------- Handshake
Install tx 1-RTT keys
<--------------- 1-RTT
Handshake Received
Install tx Handshake keys
Handshake Received
Get Handshake
Handshake Complete
Handshake ----------->
Install 1-RTT keys
1-RTT --------------->
Handshake Received
Install rx 1-RTT keys
Handshake Complete
Get Handshake
<--------------- 1-RTT
Handshake Received
</pre>
<p class="figure">Figure 3: Interaction Summary between QUIC and TLS</p>
<h2 id="rfc.section.4.2">
<a href="#rfc.section.4.2">4.2.</a> <a href="#tls-version" id="tls-version">TLS Version</a>
</h2>
<p id="rfc.section.4.2.p.1">This document describes how TLS 1.3 <a href="#TLS13" class="xref">[TLS13]</a> is used with QUIC.</p>
<p id="rfc.section.4.2.p.2">In practice, the TLS handshake will negotiate a version of TLS to use. This could result in a newer version of TLS than 1.3 being negotiated if both endpoints support that version. This is acceptable provided that the features of TLS 1.3 that are used by QUIC are supported by the newer version.</p>
<p id="rfc.section.4.2.p.3">A badly configured TLS implementation could negotiate TLS 1.2 or another older version of TLS. An endpoint MUST terminate the connection if a version of TLS older than 1.3 is negotiated.</p>
<h2 id="rfc.section.4.3">
<a href="#rfc.section.4.3">4.3.</a> <a href="#clienthello-size" id="clienthello-size">ClientHello Size</a>
</h2>
<p id="rfc.section.4.3.p.1">QUIC requires that the first Initial packet from a client contain an entire cryptographic handshake message, which for TLS is the ClientHello. Though a packet larger than 1200 bytes might be supported by the path, a client improves the likelihood that a packet is accepted if it ensures that the first ClientHello message is small enough to stay within this limit.</p>
<p id="rfc.section.4.3.p.2">QUIC packet and framing add at least 36 bytes of overhead to the ClientHello message. That overhead increases if the client chooses a connection ID without zero length. Overheads also do not include the token or a connection ID longer than 8 bytes, both of which might be required if a server sends a Retry packet.</p>
<p id="rfc.section.4.3.p.3">A typical TLS ClientHello can easily fit into a 1200 byte packet. However, in addition to the overheads added by QUIC, there are several variables that could cause this limit to be exceeded. Large session tickets, multiple or large key shares, and long lists of supported ciphers, signature algorithms, versions, QUIC transport parameters, and other negotiable parameters and extensions could cause this message to grow.</p>
<p id="rfc.section.4.3.p.4">For servers, in addition to connection IDs and tokens, the size of TLS session tickets can have an effect on a client’s ability to connect. Minimizing the size of these values increases the probability that they can be successfully used by a client.</p>
<p id="rfc.section.4.3.p.5">A client is not required to fit the ClientHello that it sends in response to a HelloRetryRequest message into a single UDP datagram.</p>
<p id="rfc.section.4.3.p.6">The TLS implementation does not need to ensure that the ClientHello is sufficiently large. QUIC PADDING frames are added to increase the size of the packet as necessary.</p>
<h2 id="rfc.section.4.4">
<a href="#rfc.section.4.4">4.4.</a> <a href="#peer-authentication" id="peer-authentication">Peer Authentication</a>
</h2>
<p id="rfc.section.4.4.p.1">The requirements for authentication depend on the application protocol that is in use. TLS provides server authentication and permits the server to request client authentication.</p>
<p id="rfc.section.4.4.p.2">A client MUST authenticate the identity of the server. This typically involves verification that the identity of the server is included in a certificate and that the certificate is issued by a trusted entity (see for example <a href="#RFC2818" class="xref">[RFC2818]</a>).</p>
<p id="rfc.section.4.4.p.3">A server MAY request that the client authenticate during the handshake. A server MAY refuse a connection if the client is unable to authenticate when requested. The requirements for client authentication vary based on application protocol and deployment.</p>
<p id="rfc.section.4.4.p.4">A server MUST NOT use post-handshake client authentication (see Section 4.6.2 of <a href="#TLS13" class="xref">[TLS13]</a>).</p>
<h2 id="rfc.section.4.5">
<a href="#rfc.section.4.5">4.5.</a> <a href="#enable-0rtt" id="enable-0rtt">Enabling 0-RTT</a>
</h2>
<p id="rfc.section.4.5.p.1">In order to be usable for 0-RTT, TLS MUST provide a NewSessionTicket message that contains the “early_data” extension with a max_early_data_size of 0xffffffff; the amount of data which the client can send in 0-RTT is controlled by the “initial_max_data” transport parameter supplied by the server. A client MUST treat receipt of a NewSessionTicket that contains an “early_data” extension with any other value as a connection error of type PROTOCOL_VIOLATION.</p>
<h2 id="rfc.section.4.6">
<a href="#rfc.section.4.6">4.6.</a> <a href="#rejecting-0-rtt" id="rejecting-0-rtt">Rejecting 0-RTT</a>
</h2>
<p id="rfc.section.4.6.p.1">A server rejects 0-RTT by rejecting 0-RTT at the TLS layer. This also prevents QUIC from sending 0-RTT data. A server will always reject 0-RTT if it sends a TLS HelloRetryRequest.</p>
<p id="rfc.section.4.6.p.2">When 0-RTT is rejected, all connection characteristics that the client assumed might be incorrect. This includes the choice of application protocol, transport parameters, and any application configuration. The client therefore MUST reset the state of all streams, including application state bound to those streams.</p>
<p id="rfc.section.4.6.p.3">A client MAY attempt to send 0-RTT again if it receives a Retry or Version Negotiation packet. These packets do not signify rejection of 0-RTT.</p>
<h2 id="rfc.section.4.7">
<a href="#rfc.section.4.7">4.7.</a> <a href="#helloretryrequest" id="helloretryrequest">HelloRetryRequest</a>
</h2>
<p id="rfc.section.4.7.p.1">In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of <a href="#TLS13" class="xref">[TLS13]</a>) can be used to correct a client’s incorrect KeyShare extension as well as for a stateless round-trip check. From the perspective of QUIC, this just looks like additional messages carried in the Initial encryption level. Although it is in principle possible to use this feature for address verification in QUIC, QUIC implementations SHOULD instead use the Retry feature (see Section 8.1 of <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a>). HelloRetryRequest is still used to request key shares.</p>
<h2 id="rfc.section.4.8">
<a href="#rfc.section.4.8">4.8.</a> <a href="#tls-errors" id="tls-errors">TLS Errors</a>
</h2>
<p id="rfc.section.4.8.p.1">If TLS experiences an error, it generates an appropriate alert as defined in Section 6 of <a href="#TLS13" class="xref">[TLS13]</a>.</p>
<p id="rfc.section.4.8.p.2">A TLS alert is turned into a QUIC connection error by converting the one-byte alert description into a QUIC error code. The alert description is added to 0x100 to produce a QUIC error code from the range reserved for CRYPTO_ERROR. The resulting value is sent in a QUIC CONNECTION_CLOSE frame.</p>
<p id="rfc.section.4.8.p.3">The alert level of all TLS alerts is “fatal”; a TLS stack MUST NOT generate alerts at the “warning” level.</p>
<h2 id="rfc.section.4.9">
<a href="#rfc.section.4.9">4.9.</a> <a href="#discarding-unused-keys" id="discarding-unused-keys">Discarding Unused Keys</a>
</h2>
<p id="rfc.section.4.9.p.1">After QUIC moves to a new encryption level, packet protection keys for previous encryption levels can be discarded. This occurs several times during the handshake, as well as when keys are updated; see <a href="#key-update" class="xref">Section 6</a>.</p>
<p id="rfc.section.4.9.p.2">Packet protection keys are not discarded immediately when new keys are available. If packets from a lower encryption level contain CRYPTO frames, frames that retransmit that data MUST be sent at the same encryption level. Similarly, an endpoint generates acknowledgements for packets at the same encryption level as the packet being acknowledged. Thus, it is possible that keys for a lower encryption level are needed for a short time after keys for a newer encryption level are available.</p>
<p id="rfc.section.4.9.p.3">An endpoint cannot discard keys for a given encryption level unless it has both received and acknowledged all CRYPTO frames for that encryption level and when all CRYPTO frames for that encryption level have been acknowledged by its peer. However, this does not guarantee that no further packets will need to be received or sent at that encryption level because a peer might not have received all the acknowledgements necessary to reach the same state.</p>
<p id="rfc.section.4.9.p.4">Though an endpoint might retain older keys, new data MUST be sent at the highest currently-available encryption level. Only ACK frames and retransmissions of data in CRYPTO frames are sent at a previous encryption level. These packets MAY also include PADDING frames.</p>
<h3 id="rfc.section.4.9.1">
<a href="#rfc.section.4.9.1">4.9.1.</a> <a href="#discarding-initial-keys" id="discarding-initial-keys">Discarding Initial Keys</a>
</h3>
<p id="rfc.section.4.9.1.p.1">Packets protected with Initial secrets (<a href="#initial-secrets" class="xref">Section 5.2</a>) are not authenticated, meaning that an attacker could spoof packets with the intent to disrupt a connection. To limit these attacks, Initial packet protection keys can be discarded more aggressively than other keys.</p>
<p id="rfc.section.4.9.1.p.2">The successful use of Handshake packets indicates that no more Initial packets need to be exchanged, as these keys can only be produced after receiving all CRYPTO frames from Initial packets. Thus, a client MUST discard Initial keys when it first sends a Handshake packet and a server MUST discard Initial keys when it first successfully processes a Handshake packet. Endpoints MUST NOT send Initial packets after this point.</p>
<p id="rfc.section.4.9.1.p.3">This results in abandoning loss recovery state for the Initial encryption level and ignoring any outstanding Initial packets.</p>
<h3 id="rfc.section.4.9.2">
<a href="#rfc.section.4.9.2">4.9.2.</a> <a href="#discarding-handshake-keys" id="discarding-handshake-keys">Discarding Handshake Keys</a>
</h3>
<p id="rfc.section.4.9.2.p.1">An endpoint MUST NOT discard its handshake keys until the TLS handshake is confirmed (<a href="#handshake-confirmed" class="xref">Section 4.1.2</a>). An endpoint SHOULD discard its handshake keys as soon as it has confirmed the handshake. Most application protocols will send data after the handshake, resulting in acknowledgements that allow both endpoints to discard their handshake keys promptly. Endpoints that do not have reason to send immediately after completing the handshake MAY send ack-eliciting frames, such as PING, which will cause the handshake to be confirmed when they are acknowledged.</p>
<h3 id="rfc.section.4.9.3">
<a href="#rfc.section.4.9.3">4.9.3.</a> <a href="#discarding-0-rtt-keys" id="discarding-0-rtt-keys">Discarding 0-RTT Keys</a>
</h3>
<p id="rfc.section.4.9.3.p.1">0-RTT and 1-RTT packets share the same packet number space, and clients do not send 0-RTT packets after sending a 1-RTT packet (<a href="#using-early-data" class="xref">Section 5.6</a>).</p>
<p id="rfc.section.4.9.3.p.2">Therefore, a client SHOULD discard 0-RTT keys as soon as it installs 1-RTT keys, since they have no use after that moment.</p>
<p id="rfc.section.4.9.3.p.3">Additionally, a server MAY discard 0-RTT keys as soon as it receives a 1-RTT packet. However, due to packet reordering, a 0-RTT packet could arrive after a 1-RTT packet. Servers MAY temporarily retain 0-RTT keys to allow decrypting reordered packets without requiring their contents to be retransmitted with 1-RTT keys. After receiving a 1-RTT packet, servers MUST discard 0-RTT keys within a short time; the RECOMMENDED time period is three times the Probe Timeout (PTO, see <a href="#QUIC-RECOVERY" class="xref">[QUIC-RECOVERY]</a>). A server MAY discard 0-RTT keys earlier if it determines that it has received all 0-RTT packets, which can be done by keeping track of missing packet numbers.</p>
<h1 id="rfc.section.5">
<a href="#rfc.section.5">5.</a> <a href="#packet-protection" id="packet-protection">Packet Protection</a>
</h1>
<p id="rfc.section.5.p.1">As with TLS over TCP, QUIC protects packets with keys derived from the TLS handshake, using the AEAD algorithm negotiated by TLS.</p>
<h2 id="rfc.section.5.1">
<a href="#rfc.section.5.1">5.1.</a> <a href="#protection-keys" id="protection-keys">Packet Protection Keys</a>
</h2>
<p id="rfc.section.5.1.p.1">QUIC derives packet protection keys in the same way that TLS derives record protection keys.</p>
<p id="rfc.section.5.1.p.2">Each encryption level has separate secret values for protection of packets sent in each direction. These traffic secrets are derived by TLS (see Section 7.1 of <a href="#TLS13" class="xref">[TLS13]</a>) and are used by QUIC for all encryption levels except the Initial encryption level. The secrets for the Initial encryption level are computed based on the client’s initial Destination Connection ID, as described in <a href="#initial-secrets" class="xref">Section 5.2</a>.</p>
<p id="rfc.section.5.1.p.3">The keys used for packet protection are computed from the TLS secrets using the KDF provided by TLS. In TLS 1.3, the HKDF-Expand-Label function described in Section 7.1 of <a href="#TLS13" class="xref">[TLS13]</a> is used, using the hash function from the negotiated cipher suite. Other versions of TLS MUST provide a similar function in order to be used with QUIC.</p>
<p id="rfc.section.5.1.p.4">The current encryption level secret and the label “quic key” are input to the KDF to produce the AEAD key; the label “quic iv” is used to derive the IV; see <a href="#aead" class="xref">Section 5.3</a>. The header protection key uses the “quic hp” label; see <a href="#header-protect" class="xref">Section 5.4</a>. Using these labels provides key separation between QUIC and TLS; see <a href="#key-diversity" class="xref">Section 9.5</a>.</p>
<p id="rfc.section.5.1.p.5">The KDF used for initial secrets is always the HKDF-Expand-Label function from TLS 1.3 (see <a href="#initial-secrets" class="xref">Section 5.2</a>).</p>
<h2 id="rfc.section.5.2">
<a href="#rfc.section.5.2">5.2.</a> <a href="#initial-secrets" id="initial-secrets">Initial Secrets</a>
</h2>
<p id="rfc.section.5.2.p.1">Initial packets are protected with a secret derived from the Destination Connection ID field from the client’s first Initial packet of the connection. Specifically:</p>
<pre>
initial_salt = 0x7fbcdb0e7c66bbe9193a96cd21519ebd7a02644a
initial_secret = HKDF-Extract(initial_salt,
client_dst_connection_id)
client_initial_secret = HKDF-Expand-Label(initial_secret,
"client in", "",
Hash.length)
server_initial_secret = HKDF-Expand-Label(initial_secret,
"server in", "",
Hash.length)
</pre>
<p id="rfc.section.5.2.p.2">The hash function for HKDF when deriving initial secrets and keys is SHA-256 <a href="#SHA" class="xref">[SHA]</a>.</p>
<p id="rfc.section.5.2.p.3">The connection ID used with HKDF-Expand-Label is the Destination Connection ID in the Initial packet sent by the client. This will be a randomly-selected value unless the client creates the Initial packet after receiving a Retry packet, where the Destination Connection ID is selected by the server.</p>
<p id="rfc.section.5.2.p.4">The value of initial_salt is a 20 byte sequence shown in the figure in hexadecimal notation. Future versions of QUIC SHOULD generate a new salt value, thus ensuring that the keys are different for each version of QUIC. This prevents a middlebox that only recognizes one version of QUIC from seeing or modifying the contents of packets from future versions.</p>
<p id="rfc.section.5.2.p.5">The HKDF-Expand-Label function defined in TLS 1.3 MUST be used for Initial packets even where the TLS versions offered do not include TLS 1.3.</p>
<p id="rfc.section.5.2.p.6">The secrets used for protecting Initial packets changes when a server sends a Retry packet to use the connection ID value selected by the server.</p>
<p></p>
<dl>
<dt>Note:</dt>
<dd style="margin-left: 8">The Destination Connection ID is of arbitrary length, and it could be zero length if the server sends a Retry packet with a zero-length Source Connection ID field. In this case, the Initial keys provide no assurance to the client that the server received its packet; the client has to rely on the exchange that included the Retry packet for that property.</dd>
</dl>
<p><a href="#test-vectors-initial" class="xref">Appendix A</a> contains test vectors for the initial packet encryption.</p>
<h2 id="rfc.section.5.3">
<a href="#rfc.section.5.3">5.3.</a> <a href="#aead" id="aead">AEAD Usage</a>
</h2>
<p id="rfc.section.5.3.p.1">The Authentication Encryption with Associated Data (AEAD) <a href="#AEAD" class="xref">[AEAD]</a> function used for QUIC packet protection is the AEAD that is negotiated for use with the TLS connection. For example, if TLS is using the TLS_AES_128_GCM_SHA256, the AEAD_AES_128_GCM function is used.</p>
<p id="rfc.section.5.3.p.2">Packets are protected prior to applying header protection (<a href="#header-protect" class="xref">Section 5.4</a>). The unprotected packet header is part of the associated data (A). When removing packet protection, an endpoint first removes the header protection.</p>
<p id="rfc.section.5.3.p.3">All QUIC packets other than Version Negotiation and Retry packets are protected with an AEAD algorithm <a href="#AEAD" class="xref">[AEAD]</a>. Prior to establishing a shared secret, packets are protected with AEAD_AES_128_GCM and a key derived from the Destination Connection ID in the client’s first Initial packet (see <a href="#initial-secrets" class="xref">Section 5.2</a>). This provides protection against off-path attackers and robustness against QUIC version unaware middleboxes, but not against on-path attackers.</p>
<p id="rfc.section.5.3.p.4">QUIC can use any of the ciphersuites defined in <a href="#TLS13" class="xref">[TLS13]</a> with the exception of TLS_AES_128_CCM_8_SHA256. A ciphersuite MUST NOT be negotiated unless a header protection scheme is defined for the ciphersuite. This document defines a header protection scheme for all ciphersuites defined in <a href="#TLS13" class="xref">[TLS13]</a> aside from TLS_AES_128_CCM_8_SHA256. These ciphersuites have a 16-byte authentication tag and produce an output 16 bytes larger than their input.</p>
<p></p>
<dl>
<dt>Note:</dt>
<dd style="margin-left: 8">An endpoint MUST NOT reject a ClientHello that offers a ciphersuite that it does not support, or it would be impossible to deploy a new ciphersuite. This also applies to TLS_AES_128_CCM_8_SHA256.</dd>
</dl>
<p id="rfc.section.5.3.p.6">The key and IV for the packet are computed as described in <a href="#protection-keys" class="xref">Section 5.1</a>. The nonce, N, is formed by combining the packet protection IV with the packet number. The 62 bits of the reconstructed QUIC packet number in network byte order are left-padded with zeros to the size of the IV. The exclusive OR of the padded packet number and the IV forms the AEAD nonce.</p>
<p id="rfc.section.5.3.p.7">The associated data, A, for the AEAD is the contents of the QUIC header, starting from the flags byte in either the short or long header, up to and including the unprotected packet number.</p>
<p id="rfc.section.5.3.p.8">The input plaintext, P, for the AEAD is the payload of the QUIC packet, as described in <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a>.</p>
<p id="rfc.section.5.3.p.9">The output ciphertext, C, of the AEAD is transmitted in place of P.</p>
<p id="rfc.section.5.3.p.10">Some AEAD functions have limits for how many packets can be encrypted under the same key and IV (see for example <a href="#AEBounds" class="xref">[AEBounds]</a>). This might be lower than the packet number limit. An endpoint MUST initiate a key update (<a href="#key-update" class="xref">Section 6</a>) prior to exceeding any limit set for the AEAD that is in use.</p>
<h2 id="rfc.section.5.4">
<a href="#rfc.section.5.4">5.4.</a> <a href="#header-protect" id="header-protect">Header Protection</a>
</h2>
<p id="rfc.section.5.4.p.1">Parts of QUIC packet headers, in particular the Packet Number field, are protected using a key that is derived separate to the packet protection key and IV. The key derived using the “quic hp” label is used to provide confidentiality protection for those fields that are not exposed to on-path elements.</p>
<p id="rfc.section.5.4.p.2">This protection applies to the least-significant bits of the first byte, plus the Packet Number field. The four least-significant bits of the first byte are protected for packets with long headers; the five least significant bits of the first byte are protected for packets with short headers. For both header forms, this covers the reserved bits and the Packet Number Length field; the Key Phase bit is also protected for packets with a short header.</p>
<p id="rfc.section.5.4.p.3">The same header protection key is used for the duration of the connection, with the value not changing after a key update (see <a href="#key-update" class="xref">Section 6</a>). This allows header protection to be used to protect the key phase.</p>
<p id="rfc.section.5.4.p.4">This process does not apply to Retry or Version Negotiation packets, which do not contain a protected payload or any of the fields that are protected by this process.</p>
<h3 id="rfc.section.5.4.1">
<a href="#rfc.section.5.4.1">5.4.1.</a> <a href="#header-protection-application" id="header-protection-application">Header Protection Application</a>
</h3>
<p id="rfc.section.5.4.1.p.1">Header protection is applied after packet protection is applied (see <a href="#aead" class="xref">Section 5.3</a>). The ciphertext of the packet is sampled and used as input to an encryption algorithm. The algorithm used depends on the negotiated AEAD.</p>
<p id="rfc.section.5.4.1.p.2">The output of this algorithm is a 5 byte mask which is applied to the protected header fields using exclusive OR. The least significant bits of the first byte of the packet are masked by the least significant bits of the first mask byte, and the packet number is masked with the remaining bytes. Any unused bytes of mask that might result from a shorter packet number encoding are unused.</p>
<p><a href="#pseudo-hp" class="xref">Figure 4</a> shows a sample algorithm for applying header protection. Removing header protection only differs in the order in which the packet number length (pn_length) is determined.</p>
<div id="rfc.figure.4"></div>
<div id="pseudo-hp"></div>
<pre>
mask = header_protection(hp_key, sample)
pn_length = (packet[0] & 0x03) + 1
if (packet[0] & 0x80) == 0x80:
# Long header: 4 bits masked
packet[0] ^= mask[0] & 0x0f