4 INTERNET-DRAFT Stanford University
5 <draft-rescorla-dtls-04.txt> April 2004 (Expires October 2005)
7 Datagram Transport Layer Security
11 By submitting this Internet-Draft, each author represents that any
12 applicable patent or other IPR claims of which he or she is aware
13 have been or will be disclosed, and any of which he or she becomes
14 aware will be disclosed, in accordance with Section 6 of BCP 79.
16 Internet-Drafts are working documents of the Internet Engineering
17 Task Force (IETF), its areas, and its working groups. Note that
18 other groups may also distribute working documents as
21 Internet-Drafts are draft documents valid for a maximum of six months
22 and may be updated, replaced, or obsoleted by other documents at any
23 time. It is inappropriate to use Internet-Drafts as reference
24 material or to cite them other than as "work in progress."
26 The list of current Internet-Drafts can be accessed at
27 http://www.ietf.org/1id-abstracts.html
29 The list of Internet-Draft Shadow Directories can be accessed at
30 http://www.ietf.org/shadow.html
34 Copyright (C) The Internet Society (1999-2004). All Rights Reserved.
41 Rescorla, Modadugu [Page 1]
\f
46 This document specifies Version 1.0 of the Datagram Transport
47 Layer Security (DTLS) protocol. The DTLS protocol provides
48 communications privacy for datagram protocols. The protocol
49 allows client/server applications to communicate in a way that
50 is designed to prevent eavesdropping, tampering, or message
51 forgery. The DTLS protocol is based on the TLS protocol and
52 provides equivalent security guarantees. Datagram semantics of
53 the underlying transport are preserved by the DTLS protocol.
59 1.1 Requirements Terminology 3
62 3.1 Loss-insensitive messaging 4
63 3.2 Providing Reliability for Handshake 5
67 3.3 Replay Detection 6
68 4 Differences from TLS 6
70 4.1.1 Transport Layer Mapping 8
71 4.1.1.1 PMTU Discovery 8
72 4.1.2 Record payload protection 9
74 4.1.2.2 Null or standard stream cipher 9
75 4.1.2.3 Block Cipher 10
76 4.1.2.4 New Cipher Suites 10
77 4.1.2.5 Anti-Replay 10
78 4.2 The DTLS Handshake Protocol 11
79 4.2.1 Denial of Service Countermeasures 11
80 4.2.2 Handshake Message Format 13
81 4.2.3 Message Fragmentation and Reassembly 15
82 4.2.4 Timeout and Retransmission 16
83 4.2.4.1 Timer Values 19
84 4.2.5 ChangeCipherSpec 20
85 4.2.6 Finished messages 20
86 4.2.7 Alert Messages 20
88 4.3 Handshake Protocol 21
89 5 Security Considerations 22
90 6 IANA Considerations 22
95 Rescorla, Modadugu [Page 2]
\f
100 TLS [TLS] is the most widely deployed protocol for securing
101 network traffic. It is widely used for protecting Web traffic
102 and for e-mail protocols such as IMAP [IMAP] and POP [POP].
103 The primary advantage of TLS is that it provides a transparent
104 connection-oriented channel. Thus, it is easy to secure an
105 application protocol by inserting TLS between the application
106 layer and the transport layer. However, TLS must run over a
107 reliable transport channel--typically TCP [TCP]. It therefore
108 cannot be used to secure unreliable datagram traffic.
110 However, over the past few years an increasing number of
111 application layer protocols have been designed which UDP
112 transport. In particular such protocols as the Session
113 Initiation Protocol (SIP) [SIP], and electronic gaming
114 protocols are increasingly popular. (Note that SIP can run
115 over both TCP and UDP, but that there are situations in which
116 UDP is preferable). Currently, designers of these applications
117 are faced with a number of unsatisfactory choices. First, they
118 can use IPsec [RFC2401]. However, for a number of reasons
119 detailed in [WHYIPSEC], this is only suitable for some
120 applications. Second, they can design a custom application
121 layer security protocol. SIP, for instance, uses a subsert of
122 S/MIME to secure its traffic. Unfortunately, while application
123 layer security protocols generally provide superior security
124 properties (e.g., end-to-end security in the case of S/MIME)
125 it typically require a large amount of effort to design--by
126 contrast to the relatively small amount of effort required to
127 run the protocol over TLS.
129 In many cases, the most desirable way to secure client/server
130 applications would be to use TLS; however the requirement for
131 datagram semantics automatically prohibits use of TLS. Thus, a
132 datagram-compatible variant of TLS would be very desirable.
133 This memo describes such a protocol: Datagram Transport Layer
134 Security (DTLS). DTLS is deliberately designed to be as
135 similar to to TLS as possible, both to minimize new security
136 invention and to maximize the amount of code and
137 infrastructure reuse.
140 1.1. Requirements Terminology
142 Keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD
143 NOT" and "MAY" that appear in this document are to be
144 interpreted as described in RFC 2119 [REQ].
149 Rescorla, Modadugu [Page 3]
\f
154 The DTLS protocol is designed to secure data between
155 communicating applications. It is designed to run in
156 application space, without requiring any kernel modifications.
158 Datagram transport does not require or provide reliable or in-
159 order delivery of data. The DTLS protocol preserves this
160 property for payload data. Applications such as media
161 streaming, Internet telephony and online gaming use datagram
162 transport for communication due to the delay-sensitive nature
163 of transported data. The behavior of such applications is
164 unchanged when the DTLS protocol is used to secure
165 communication, since the DTLS protocol does not compensate for
166 lost or re-ordered data traffic.
170 The basic design philosophy of DTLS is to construct "TLS over
171 datagram". The reason that TLS cannot be used directly in
172 datagram environments is simply that packets may be lost or
173 reordered. TLS has no internal facilities to handle this kind
174 of unreliability and therefore TLS implementations break when
175 rehosted on datagram transport. The purpose of DTLS is to make
176 only the minimal changes to TLS required to fix this problem.
177 To the greatest extent possible, DTLS is identical to TLS.
178 Whenever we need to invent new mechanisms, we attempt to do so
179 in such a way that it preserves the style of TLS.
181 Unreliability creates problems for TLS at two levels:
183 1. TLS's traffic encryption layer does not allow
184 independent decryption of individual records. If record N
185 is not received, then record N+1 cannot be decrypted.
187 2. The TLS handshake layer assumes that handshake messages
188 are delivered reliably and breaks if those messages are
191 The rest of this section describes the approach that DTLS uses
192 to solve these problems.
194 3.1. Loss-insensitive messaging
196 In TLS's traffic encryption layer (called the TLS Record
197 Layer), records are not independent. There are two kinds of
198 inter-record dependency:
203 Rescorla, Modadugu [Page 4]
\f
206 1. Cryptographic context (CBC state, stream cipher key
207 stream) is chained between records.
209 2. Anti-replay and message reordering protection are
210 provided by a MAC which includes a sequence number, but the
211 sequence numbers are implicit in the records.
213 The fix for both of these problems is straightforward and
214 well-known from IPsec ESP [ESP]: add explicit state to the
215 records. TLS 1.1 [TLS11] is already adding explicit CBC state
216 to TLS records. DTLS borrows that mechanism and adds explicit
219 3.2. Providing Reliability for Handshake
221 The TLS handshake is a lockstep cryptographic handshake.
222 Messages must be transmitted and received in a defined order
223 and any other order is an error. Clearly, this is incompatible
224 with reordering and message loss. In addition, TLS handshake
225 messages are potentially larger than any given datagram, thus
226 creating the problem of fragmentation. DTLS must provide fixes
227 for both these problems.
231 DTLS uses a simple retransmission timer to handle packet loss.
232 The following figure demonstrates the basic concept using the
233 first phase of the DTLS handshake:
239 X<-- HelloVerifyRequest
247 Once the client has transmitted the ClientHello message, it
248 expects to see a HelloVerifyRequest from the server. However,
249 if the server's message is lost the client knows that either
250 the ClientHello or the HelloVerifyRequest has been lost and
251 retransmits. When the server receives the retransmission, it
252 knows to retransmit. The server also maintains a
253 retransmission timer and retransmits when that timer expires.
257 Rescorla, Modadugu [Page 5]
\f
260 Note: timeout and retransmission do not apply to the
261 HelloVerifyRequest, because this requires creating state on
266 In DTLS, each handshake message is assigned a specific
267 sequence number within that handshake. When a peer receives a
268 handshake message, it can quickly determine whether that
269 message is the next message it expects. If it is, then it
270 processes it. If not, it queues it up for future handling once
271 all previous messages have been received.
275 TLS and DTLS handshake messages can be quite large (in theory
276 up to 2^24-1 bytes, in practice many kilobytes). By contrast,
277 UDP datagrams are often limited to <1500 bytes if
278 fragmentation is not desired. In order to compensate for this
279 limitation, each DTLS handshake message may be fragmented over
280 several DTLS records. Each DTLS handshake message contains
281 both a fragment offset and a fragment length. Thus, a
282 recipient in possession of all bytes of a handshake message
283 can reassemble the original unfragmented message.
285 3.3. Replay Detection
287 DTLS optionally supports record replay detection. The
288 technique used is the same as in IPsec AH/ESP, by maintaining
289 a bitmap window of received records. Records that are too old
290 to fit in the window and records that have been previously
291 received are silently discarded. The replay detection feature
292 is optional, since packet duplication is not always malicious,
293 but can also occur due to routing errors. Applications may
294 conceivably detect duplicate packets and accordingly modify
295 their data transmission strategy.
297 4. Differences from TLS
299 As mentioned in Section 3., DTLS is intentionally very similar
300 to TLS. Therefore, instead of presenting DTLS as a new
301 protocol, we instead present it as a series of deltas from TLS
302 1.1 [TLS11]. Where we do not explicitly call out differences,
303 DTLS is the same as TLS.
311 Rescorla, Modadugu [Page 6]
\f
316 The DTLS record layer is extremely similar to that of TLS 1.1.
317 The only change is the inclusion of an explicit sequence
318 number in the record. This sequence number allows the
319 recipient to correctly verify the TLS MAC. The DTLS record
320 format is shown below:
324 ProtocolVersion version;
325 uint16 epoch; // New field
326 uint48 sequence_number; // New field
328 opaque fragment[DTLSPlaintext.length];
332 Equivalent to the type field in a TLS 1.1 record.
335 The version of the protocol being employed. This document
336 describes DTLS Version 1.0, which uses the version { 254, 255
337 }. The version value of 254.255 is the 1's complement of DTLS
338 Version 1.0. This maximal spacing between TLS and DTLS version
339 numbers ensures that records from the two protocols can be
340 easily distinguished.
343 A counter value that is incremented on every cipher state
347 The sequence number for this record.
350 Identical to the length field in a TLS 1.1 record. As in TLS
351 1.1, the length should not exceed 2^14.
354 Identical to the fragment field of a TLS 1.1 record.
356 DTLS uses an explicit rather than implicit sequence number,
357 carried in the sequence_number field of the record. As with
358 TLS, the sequence number is set to zero after each
359 ChangeCipherSpec message is sent.
365 Rescorla, Modadugu [Page 7]
\f
368 If several handshakes are performed in close succession, there
369 might be multiple records on the wire with the same sequence
370 number but from different cipher states. The epoch field
371 allows recipients to distinguish such packets. The epoch
372 number is initially zero and is incremented each time the
373 ChangeCipherSpec messages is sent. In order to ensure that any
374 given sequence/epoch pair is unique, implementations MUST NOT
375 allow the same epoch value to be reused within two times the
376 TCP maximum segment lifetime. In practice, TLS implementations
377 rehandshake rarely and we therefore do not expect this to be a
380 4.1.1. Transport Layer Mapping
382 Each DTLS record MUST fit within a single datagram. In order
383 to avoid IP fragmentation [MOGUL], DTLS implementations SHOULD
384 determine the MTU and send records smaller than the MTU. DTLS
385 implementations SHOULD provide a way for applications to
386 determine the value of the PMTU (or alternately the maximum
387 application datagram size, which is the PMTU minus the DTLS
388 per-record overhead). If the application attempts to send a
389 record larger than the MTU the DTLS implementation SHOULD
390 generate an error, thus avoiding sending a packet which will
393 Note that unlike IPsec, DTLS records do not contain any
394 association identifiers. Applications must arrange to
395 multiplex between associations. With UDP, this is presumably
396 done with host/port number.
398 Multiple DTLS records may be placed in a single datagram. hey
399 are simply encoded consecutively. The DTLS record framing is
400 sufficient to determine the boundaries. Note, however, that
401 the first byte of the datagram payload must be the beginning
402 of a record. Records may not span datagrams.
404 4.1.1.1. PMTU Discovery
406 In general, DTLS's philosophy is to avoid dealing with PMTU
407 issues. The general strategy is to start with a conservative
408 MTU and then update it if events require it, but not actively
409 probe for MTU values. PMTU discovery is left to the
412 The PMTU SHOULD be initialized from the interface MTU that
413 will be used to send packets. If the DTLS implementation
414 receives an RFC 1191 [RFC1191] ICMP Destination Unreachable
415 message with the "fragmentation needed and DF set" Code
419 Rescorla, Modadugu [Page 8]
\f
422 (otherwise known as Datagram Too Big) it should decrease its
423 PMTU estimate to that given in the ICMP message. A DTLS
424 implementation SHOULD allow the application to occasionally
425 reset its PMTU estimate. The DTLS implementation SHOULD also
426 allow applications to control the status of the DF bit. These
427 controls allow the application to perform PMTU discovery.
429 One special case is the DTLS handshake system. Handshake
430 messages should be set with DF set. Because some firewalls and
431 routers screen out ICMP messages, it is difficult for the
432 handshake layer to distinguish packet loss from an overlarge
433 PMTU estimate. In order to allow connections under these
434 circumstances, DTLS implementations SHOULD back off handshake
435 packet size during the retransmit backoff described in Section
436 4.2.4.. For instance, if a large packet is being sent, after 3
437 retransmits the handshake layer might choose to fragment the
438 handshake message on retransmission. In general, choice of a
439 conservative initial MTU will avoid this problem.
441 4.1.2. Record payload protection
443 Like TLS, DTLS transmits data as a series of protected
444 records. The rest of this section describes the details of
449 The DTLS MAC is the same as that of TLS 1.1. However, rather
450 than using TLS's implicit sequence number, the sequence number
451 used to compute the MAC is the 64-bit value formed by
452 concatenating the epoch and the sequence number in the order
453 they appear on the wire. Note that the DTLS epoch + sequence
454 number is the same length as the TLS sequence number.
456 Note that one important difference between DTLS and TLS MAC
457 handling is that in TLS MAC errors must result in connection
458 termination. In DTLS, the receiving implementation MAY simply
459 discard the offending record and continue with the connection.
460 This change is possible because DTLS records are not dependent
461 on each other the way that TLS records are.
464 4.1.2.2. Null or standard stream cipher
466 The DTLS NULL cipher is performed exactly as the TLS 1.1 NULL
473 Rescorla, Modadugu [Page 9]
\f
476 The only stream cipher described in TLS 1.1 is RC4, which
477 cannot be randomly accessed. RC4 MUST NOT be used with DTLS.
479 4.1.2.3. Block Cipher
481 DTLS block cipher encryption and decryption are performed
482 exactly as with TLS 1.1.
484 4.1.2.4. New Cipher Suites
486 Upon registration, new TLS cipher suites MUST indicate whether
487 they are suitable for DTLS usage and what, if any, adaptations
492 DTLS records contain a sequence number to provide replay
493 protection. Sequence number verification SHOULD be performed
494 using the following sliding, window procedure, borrowed from
495 Section 3.4.3 of [RFC 2402]
497 The receiver packet counter for this session MUST be
498 initialized to zero when the session is established. For each
499 received record, the receiver MUST verify that the record
500 contains a Sequence Number that does not duplicate the
501 Sequence Number of any other record received during the life
502 of this session. This SHOULD be the first check applied to a
503 packet after it has been matched to a session, to speed
504 rejection of duplicate records.
506 Duplicates are rejected through the use of a sliding receive
507 window. (How the window is implemented is a local matter, but
508 the following text describes the functionality that the
509 implementation must exhibit.) A minimum window size of 32 MUST
510 be supported; but a window size of 64 is preferred and SHOULD
511 be employed as the default. Another window size (larger than
512 the minimum) MAY be chosen by the receiver. (The receiver does
513 not notify the sender of the window size.)
515 The "right" edge of the window represents the highest,
516 validated Sequence Number value received on this session.
517 Records that contain Sequence Numbers lower than the "left"
518 edge of the window are rejected. Packets falling within the
519 window are checked against a list of received packets within
520 the window. An efficient means for performing this check,
521 based on the use of a bit mask, is described in Appendix C of
527 Rescorla, Modadugu [Page 10]
\f
530 If the received record falls within the window and is new, or
531 if the packet is to the right of the window, then the receiver
532 proceeds to MAC verification. If the MAC validation fails, the
533 receiver MUST discard the received record as invalid. The
534 receive window is updated only if the MAC verification
537 4.2. The DTLS Handshake Protocol
539 DTLS uses all of the same handshake messages and flows as TLS,
540 with three principal changes:
542 1. A stateless cookie exchange has been added to prevent
543 denial of service attacks.
545 2. Modifications to the handshake header to handle message
546 loss, reordering and fragmentation.
548 3. Retransmission timers to handle message loss.
550 With these exceptions, the DTLS message formats, flows, and
551 logic are the same as those of TLS 1.1.
553 4.2.1. Denial of Service Countermeasures
555 Datagram security protocols are extremely susceptible to a
556 variety of denial of service (DoS) attacks. Two attacks are of
559 1. An attacker can consume excessive resources on the
560 server by transmitting a series of handshake initiation
561 requests, causing the server to allocate state and
562 potentially perform expensive cryptographic operations.
564 2. An attacker can use the server as an amplifier by
565 sending connection initiation messages with a forged source
566 of the victim. The server then sends its next message (in
567 DTLS, a Certificate message, which can be quite large) to
568 the victim machine, thus flooding it.
570 In order to counter both of these attacks, DTLS borrows the
571 stateless cookie technique used by Photuris [PHOTURIS] and IKE
572 [IKE]. When the client sends its ClientHello message to the
573 server, the server MAY respond with a HelloVerifyRequest
574 message. This message contains a stateless cookie generated
575 using the technique of [PHOTURIS]. The client MUST retransmit
576 the ClientHello with the cookie added. The server then
577 verifies the cookie and proceeds with the handshake only if it
581 Rescorla, Modadugu [Page 11]
\f
584 is valid. This mechanism forces the attacker/client to be able
585 to receive the cookie, which makes DoS attacks with spoofed IP
586 addresses difficult. This mechanism does not provide any
587 defense against DoS attacks mounted from valid IP addresses.
589 The exchange is shown below:
595 <----- HelloVerifyRequest
603 DTLS therefore modifies the ClientHello message to add the
607 ProtocolVersion client_version;
609 SessionID session_id;
610 opaque cookie<0..32>; // New field
611 CipherSuite cipher_suites<2..2^16-1>;
612 CompressionMethod compression_methods<1..2^8-1>;
615 When sending the first ClientHello, the client does not have a
616 cookie yet; in this case, the Cookie field is left empty (zero
619 The definition of HelloVerifyRequest is as follows:
622 Cookie cookie<0..32>;
623 } HelloVerifyRequest;
625 The HelloVerifyRequest message type is
626 hello_verify_request(3).
628 When responding to a HelloVerifyRequest the client MUST use
629 the same parameter values (version, random, session_id,
630 cipher_suites, compression_method) as in the original
631 ClientHello. The server SHOULD use those values to generate
635 Rescorla, Modadugu [Page 12]
\f
638 its cookie and verify that they are correct upon cookie
639 receipt. The DTLS server SHOULD generate cookies in such a way
640 that they can be verified without retaining any per-client
641 state on the server. One technique is to have a randomly
642 generated secret and generate cookies as:
643 Cookie = HMAC(Secret, Client-IP, Client-Parameters)
645 When the second ClientHello is received, the server can verify
646 that the Cookie is valid and that the client can receive
647 packets at the given IP address.
648 One potential attack on this scheme is for the attacker to
649 collect a number of cookies from different addresses and then
650 reuse them to attack the server. The server can defend against
651 this attack by changing the Secret value frequently, thus
652 invalidating those cookies. If the server wishes legitimate
653 clients to be able to handshake through the transition (e.g.,
654 they received a cookie with Secret 1 and then sent the second
655 ClientHello after the server has changed to Secret 2), the
656 server can have a limited window during which it accepts both
657 secrets. [IKEv2] suggests adding a version number to cookies
658 to detect this case. An alternative approach is simply to try
659 verifying with both secrets.
661 Although DTLS servers are not required to do a cookie
662 exchange, they SHOULD do so whenever a new handshake is
663 performed in order to avoid being used as amplifiers. If the
664 server is being operated in an environment where amplification
665 is not a problem, the server MAY choose not to perform a
666 cookie exchange. In addition, the server MAY choose not do to
667 a cookie exchange when a session is resumed. Clients MUST be
668 prepared to do a cookie exchange with every handshake.
670 If HelloVerifyRequest is used, the initial ClientHello and
671 HelloVerifyRequest are not included in the calculation of the
672 verify_data for the Finished message.
674 4.2.2. Handshake Message Format
676 In order to support message loss, reordering, and
677 fragmentation DTLS modifies the TLS 1.1 handshake header:
680 HandshakeType msg_type;
682 uint16 message_seq; // New field
683 uint24 fragment_offset; // New field
684 uint24 fragment_length; // New field
685 select (HandshakeType) {
689 Rescorla, Modadugu [Page 13]
\f
692 case hello_request: HelloRequest;
693 case client_hello: ClientHello;
694 case hello_verify_request: HelloVerifyRequest; // New type
695 case server_hello: ServerHello;
696 case certificate:Certificate;
697 case server_key_exchange: ServerKeyExchange;
698 case certificate_request: CertificateRequest;
699 case server_hello_done:ServerHelloDone;
700 case certificate_verify: CertificateVerify;
701 case client_key_exchange: ClientKeyExchange;
702 case finished:Finished;
706 The first message each side transmits in each handshake always
707 has message_seq = 0. Whenever each new message is generated,
708 the message_seq value is incremented by one. When a message is
709 retransmitted, the same message_seq value is used. For
714 ClientHello (seq=0) ------>
716 X<-- HelloVerifyRequest (seq=0)
721 ClientHello (seq=0) ------>
724 <------ HelloVerifyRequest (seq=0)
726 ClientHello (seq=1) ------>
729 <------ ServerHello (seq=1)
730 <------ Certificate (seq=2)
731 <------ ServerHelloDone (seq=3)
735 Note, however, that from the perspective of the DTLS record
736 layer, the retransmission is a new record. This record will
737 have a new DTLSPlaintext.sequence_number value.
743 Rescorla, Modadugu [Page 14]
\f
746 DTLS implementations maintain (at least notionally) a
747 next_receive_seq counter. This counter is initially set to
748 zero. When a message is received, if its sequence number
749 matches next_receive_seq, next_receive_seq is incremented and
750 the message is processed. If the sequence number is less than
751 next_receive_seq the message MUST be discarded. If the
752 sequence number is greater than next_receive_seq, the
753 implementation SHOULD queue the message but MAY discard it.
754 (This is a simple space/bandwidth tradeoff).
756 4.2.3. Message Fragmentation and Reassembly
758 As noted in Section 4.1.1., each DTLS message MUST fit within
759 a single transport layer datagram. However, handshake messages
760 are potentially bigger than the maximum record size. Therefore
761 DTLS provides a mechanism for fragmenting a handshake message
762 over a number of records.
764 When transmitting the handshake message, the sender divides
765 the message into a series of N contiguous data ranges. These
766 range MUST NOT be larger than the maximum handshake fragment
767 size and MUST jointly contain the entire handshake message.
768 The ranges SHOULD NOT overlap. The sender then creates N
769 handshake messages, all with the same message_seq value as the
770 original handshake message. Each new message is labelled with
771 the fragment_offset (the number of bytes contained in previous
772 fragments) and the fragment_length (the length of this
773 fragment). The length field in all messages is the same as the
774 length field of the original message. An unfragmented message
775 is a degenerate case with fragment_offset=0 and
776 fragment_length=length.
778 When a DTLS implementation receives a handshake message
779 fragment, it MUST buffer it until it has the entire handshake
780 message. DTLS implementations MUST be able to handle
781 overlapping fragment ranges. This allows senders to retransmit
782 handshake messages with smaller fragment sizes during path MTU
785 Note that as with TLS, multiple handshake messages may be
786 placed in the same DTLS record, provided that there is room
787 and that they are part of the same flight. Thus, there are two
788 acceptable ways to pack two DTLS messages into the same
789 datagram: in the same record or in separate records.
797 Rescorla, Modadugu [Page 15]
\f
800 4.2.4. Timeout and Retransmission
802 DTLS messages are grouped into a series of message flights,
803 according the diagrams below. Although each flight of messages
804 may consist of a number of messages, they should be viewed as
805 monolithic for the purpose of timeout and retransmission.
810 ClientHello --------> Flight 1
812 <------- HelloVerifyRequest Flight 2
814 ClientHello --------> Flight 3
818 ServerKeyExchange* Flight 4
819 CertificateRequest* /
820 <-------- ServerHelloDone /
824 CertificateVerify* Flight 5
828 [ChangeCipherSpec] \ Flight 6
830 Figure 1: Message flights for full handshake
836 ClientHello --------> Flight 1
839 [ChangeCipherSpec] Flight 2
842 [ChangeCipherSpec] \Flight 3
844 Figure 2: Message flights for session resuming handshake (no
851 Rescorla, Modadugu [Page 16]
\f
854 DTLS uses a simple timeout and retransmission scheme with the
855 following state machine. Because DTLS clients send the first
856 message (ClientHello) they start in the PREPARING state. DTLS
857 servers start in the WAITING state, but with empty buffers and
905 Rescorla, Modadugu [Page 17]
\f
915 | | Buffer next flight
920 | | SENDING |<------------------+
924 next | | Send flight |
925 flight | +--------+ |
926 | | | Set retransmit timer |
930 +--)--| WAITING |-------------------+
931 | | | | Timer expires |
935 | | +------------------------+
949 Figure 3: DTLS timeout and retransmission state machine
952 The state machine has three basic states.
954 In the PREPARING state the implementation does whatever
955 computations are necessary to prepare the next flight of
959 Rescorla, Modadugu [Page 18]
\f
962 messages. It then buffers them up for transmission (emptying
963 the buffer first) and enters the SENDING state.
965 In the SENDING state, the implementation transmits the
966 buffered flight of messages. Once the messages have been sent,
967 the implementation then enters the FINISHED state if this is
968 the last flight in the handshake, or, if the implementation
969 expects to receive more messages, sets a retransmit timer and
970 then enters the WAITING state.
972 There are three ways to exit the WAITING state:
974 1. The retransmit timer expires: the implementation
975 transitions to the SENDING state, where it retransmits the
976 flight, resets the retransmit timer, and returns to the
979 2. The implementation reads a retransmitted flight from the
980 peer: the implementation transitions to the SENDING state,
981 where it retransmits the flight, resets the retransmit
982 timer, and returns to the WAITING state. The rationale here
983 is that the receipt of a duplicate message is the likely
984 result of timer expiry on the peer and therefore suggests
985 that part of one's previous flight was lost.
987 3. The implementation receives the next flight of messages:
988 if this is the final flight of messages the implementation
989 transitions to FINISHED. If the implementation needs to
990 send a new flight, it transitions to the PREPARING state.
991 Partial reads (whether partial messages or only some of the
992 messages in the flight) do not cause state transitions or
995 Because DTLS clients send the first message (ClientHello) they
996 start in the PREPARING state. DTLS servers start in the
997 WAITING state, but with empty buffers and no retransmit timer.
999 4.2.4.1. Timer Values
1001 Timer value choices are a local matter. Implementations SHOULD
1002 use an initial timer value of 500 ms and double the value at
1003 each retransmission, up to twice the TCP maximum segment
1004 lifetime [TCP] (if the recommendations in [TCP] are followed,
1005 this will be 240 seconds). Implementations SHOULD start the
1006 timer value at the initial value with each new flight of
1013 Rescorla, Modadugu [Page 19]
\f
1016 4.2.5. ChangeCipherSpec
1018 As with TLS, the ChangeCipherSpec message is not technically a
1019 handshake message but MUST be treated as part of the same
1020 flight as the associated Finished message for the purposes of
1021 timeout and retransmission.
1023 4.2.6. Finished messages
1025 Finished messages have the same format as in TLS. However, in
1026 order to remove sensitivity to fragmentation, the Finished MAC
1027 MUST be computed as if each handshake message had been sent as
1028 a single fragment. Note that in cases where the cookie
1029 exchange is used, the initial ClientHello and
1030 HelloVerifyRequest MUST BE included in the Finished MAC.
1032 4.2.7. Alert Messages
1034 Note that Alert messages are not retransmitted at all, even
1035 when they occur in the context of a handshake. However, a DTLS
1036 implementation SHOULD generate a new alert message if the
1037 offending record is received again (e.g., as a retransmitted
1042 A.1
\bSummary of new syntax
1044 This section includes specifications for the data structures
1045 that have changed between TLS 1.1 and DTLS.
1050 ProtocolVersion version;
1051 uint16 epoch; // New field
1052 uint48 sequence_number; // New field
1054 opaque fragment[DTLSPlaintext.length];
1059 ProtocolVersion version;
1060 uint16 epoch; // New field
1061 uint48 sequence_number; // New field
1063 opaque fragment[DTLSCompressed.length];
1067 Rescorla, Modadugu [Page 20]
\f
1074 ProtocolVersion version;
1075 uint16 epoch; // New field
1076 uint48 sequence_number; // New field
1078 select (CipherSpec.cipher_type) {
1079 case block: GenericBlockCipher;
1083 4.3. Handshake Protocol
1086 hello_request(0), client_hello(1), server_hello(2),
1087 hello_verify_request(3), // New field
1088 certificate(11), server_key_exchange (12),
1089 certificate_request(13), server_hello_done(14),
1090 certificate_verify(15), client_key_exchange(16),
1095 HandshakeType msg_type;
1097 uint16 message_seq; // New field
1098 uint24 fragment_offset; // New field
1099 uint24 fragment_length; // New field
1100 select (HandshakeType) {
1101 case hello_request: HelloRequest;
1102 case client_hello: ClientHello;
1103 case server_hello: ServerHello;
1104 case hello_verify_request: HelloVerifyRequest; // New field
1105 case certificate:Certificate;
1106 case server_key_exchange: ServerKeyExchange;
1107 case certificate_request: CertificateRequest;
1108 case server_hello_done:ServerHelloDone;
1109 case certificate_verify: CertificateVerify;
1110 case client_key_exchange: ClientKeyExchange;
1111 case finished:Finished;
1116 ProtocolVersion client_version;
1121 Rescorla, Modadugu [Page 21]
\f
1124 SessionID session_id;
1125 opaque cookie<0..32>; // New field
1126 CipherSuite cipher_suites<2..2^16-1>;
1127 CompressionMethod compression_methods<1..2^8-1>;
1131 Cookie cookie<0..32>;
1132 } HelloVerifyRequest;
1134 5. Security Considerations
1136 This document describes a variant of TLS 1.1 and therefore
1137 most of the security considerations are the same as those of
1138 TLS 1.1 [TLS11], described in Appendices D, E, and F.
1140 The primary additional security consideration raised by DTLS
1141 is that of denial of service. DTLS includes a cookie exchange
1142 designed to protect against denial of service. However,
1143 implementations which do not use this cookie exchange are
1144 still vulnerable to DoS. In particular, DTLS servers which do
1145 not use the cookie exchange may be used as attack amplifiers
1146 even if they themselves are not experiencing DoS. Therefore
1147 DTLS servers SHOULD use the cookie exchange unless there is
1148 good reason to believe that amplification is not a threat in
1151 6. IANA Considerations
1153 This document uses the same identifier space as TLS [TLS11],
1154 so no new IANA registries are required. When new identifiers
1155 are assigned for TLS, authors MUST specify whether they are
1158 This document defines a new handshake message,
1159 hello_verify_request, whose value is to be allocated from the
1160 TLS HandshakeType registry defined in [TLS11]. The value "3"
1165 Normative References
1167 [RFC1191] Mogul, J. C., Deering, S.E., "Path MTU Discovery",
1168 RFC 1191, November 1990.
1170 [RFC2401] Kent, S., Atkinson, R., "Security Architecture for the
1171 Internet Protocol", RFC2401, November 1998.
1175 Rescorla, Modadugu [Page 22]
\f
1178 [TCP] Postel, J., "Transmission Control Protocol",
1179 RFC 793, September 1981.
1181 [TLS11] Dierks, T., Rescorla, E., "The TLS Protocol Version 1.1",
1182 draft-ietf-tls-rfc2246-bis-05.txt, July 2003.
1185 Informative References
1187 [AH] Kent, S., and Atkinson, R., "IP Authentication Header",
1188 RFC 2402, November 1998.
1190 [DCCP] Kohler, E., Handley, M., Floyd, S., Padhye, J., "Datagram
1191 Congestion Control Protocol", draft-ietf-dccp-spec-11.txt,
1194 [DNS] Mockapetris, P.V., "Domain names - implementation and
1195 specification", RFC 1035, November 1987.
1197 [DTLS] Modadugu, N., Rescorla, E., "The Design and Implementation
1198 of Datagram TLS", Proceedings of ISOC NDSS 2004, February 2004.
1200 [ESP] Kent, S., and Atkinson, R., "IP Encapsulating Security
1201 Payload (ESP)", RFC 2406, November 1998.
1204 [IKE] Harkins, D., Carrel, D., "The Internet Key Exchange (IKE)",
1205 RFC 2409, November 1998.
1207 [IKEv2] Kaufman, C., "Internet Key Exchange (IKEv2) Protocol",
1208 draft-ietf-ipsec-ikev2-17.txt, September 2004.
1210 [IMAP] Crispin, M., "Internet Message Access Protocol - Version
1211 4rev1", RFC 3501, March 2003.
1213 [PHOTURIS] Karn, P., Simpson, W., "Photuris: Session-Key Management
1214 Protocol", RFC 2521, March 1999.
1217 [POP] Myers, J., and Rose, M., "Post Office Protocol -
1218 Version 3", RFC 1939, May 1996.
1221 [REQ] Bradner, S., "Key words for use in RFCs to Indicate
1222 Requirement Levels", BCP 14, RFC 2119, March 1997.
1225 [SIP] Rosenberg, J., Schulzrinne, Camarillo, G., Johnston, A.,
1229 Rescorla, Modadugu [Page 23]
\f
1232 Peterson, J., Sparks, R., Handley, M., Schooler, E.,
1233 "SIP: Session Initiation Protocol", RFC 3261,
1236 [TLS] Dierks, T., and Allen, C., "The TLS Protocol Version 1.0",
1237 RFC 2246, January 1999.
1239 [WHYIPSEC] Bellovin, S., "Guidelines for Mandating the Use of IPsec",
1240 draft-bellovin-useipsec-02.txt, October 2003
1244 Eric Rescorla <ekr@rtfm.com>
1249 Nagendra Modadugu <nagendra@cs.stanford.edu>
1250 Computer Science Department
1259 The authors would like to thank Dan Boneh, Eu-Jin Goh, Russ
1260 Housley, Constantine Sapuntzakis, and Hovav Shacham for
1261 discussions and comments on the design of DTLS. Thanks to the
1262 anonymous NDSS reviewers of our original NDSS paper on DTLS
1263 [DTLS] for their comments. Also, thanks to Steve Kent for
1264 feedback that helped clarify many points. The section on PMTU
1265 was cribbed from the DCCP specification [DCCP]. Pasi Eronen
1266 provided a detailed review of this specification.
1283 Rescorla, Modadugu [Page 24]
\f
1286 Full Copyright Statement
1288 The IETF takes no position regarding the validity or scope of any
1289 Intellectual Property Rights or other rights that might be claimed to
1290 pertain to the implementation or use of the technology described in
1291 this document or the extent to which any license under such rights
1292 might or might not be available; nor does it represent that it has
1293 made any independent effort to identify any such rights. Information
1294 on the procedures with respect to rights in RFC documents can be
1295 found in BCP 78 and BCP 79.
1297 Copies of IPR disclosures made to the IETF Secretariat and any
1298 assurances of licenses to be made available, or the result of an
1299 attempt made to obtain a general license or permission for the use of
1300 such proprietary rights by implementers or users of this
1301 specification can be obtained from the IETF on-line IPR repository at
1302 http://www.ietf.org/ipr.
1304 The IETF invites any interested party to bring to its attention any
1305 copyrights, patents or patent applications, or other proprietary
1306 rights that may cover technology that may be required to implement
1307 this standard. Please address the information to the IETF at ietf-
1311 Copyright (C) The Internet Society (2003). This document is subject
1312 to the rights, licenses and restrictions contained in BCP 78, and
1313 except as set forth therein, the authors retain all their rights.
1315 This document and the information contained herein are provided on an
1316 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
1317 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
1318 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
1319 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
1320 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
1321 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1337 Rescorla, Modadugu [Page 25]
\f