7 Network Working Group D. Eastlake
8 Request for Comments: 2539 IBM
9 Category: Standards Track March 1999
12 Storage of Diffie-Hellman Keys in the Domain Name System (DNS)
16 This document specifies an Internet standards track protocol for the
17 Internet community, and requests discussion and suggestions for
18 improvements. Please refer to the current edition of the "Internet
19 Official Protocol Standards" (STD 1) for the standardization state
20 and status of this protocol. Distribution of this memo is unlimited.
24 Copyright (C) The Internet Society (1999). All Rights Reserved.
28 A standard method for storing Diffie-Hellman keys in the Domain Name
29 System is described which utilizes DNS KEY resource records.
33 Part of the format for Diffie-Hellman keys and the description
34 thereof was taken from a work in progress by:
36 Ashar Aziz <ashar.aziz@eng.sun.com>
37 Tom Markson <markson@incog.com>
38 Hemma Prafullchandra <hemma@eng.sun.com>
40 In addition, the following person provided useful comments that have
43 Ran Atkinson <rja@inet.org>
44 Thomas Narten <narten@raleigh.ibm.com>
58 Eastlake Standards Track [Page 1]
60 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
65 Abstract...................................................1
66 Acknowledgements...........................................1
67 1. Introduction............................................2
68 1.1 About This Document....................................2
69 1.2 About Diffie-Hellman...................................2
70 2. Diffie-Hellman KEY Resource Records.....................3
71 3. Performance Considerations..............................4
72 4. IANA Considerations.....................................4
73 5. Security Considerations.................................4
74 References.................................................5
75 Author's Address...........................................5
76 Appendix A: Well known prime/generator pairs...............6
77 A.1. Well-Known Group 1: A 768 bit prime..................6
78 A.2. Well-Known Group 2: A 1024 bit prime.................6
79 Full Copyright Notice......................................7
83 The Domain Name System (DNS) is the current global hierarchical
84 replicated distributed database system for Internet addressing, mail
85 proxy, and similar information. The DNS has been extended to include
86 digital signatures and cryptographic keys as described in [RFC 2535].
87 Thus the DNS can now be used for secure key distribution.
89 1.1 About This Document
91 This document describes how to store Diffie-Hellman keys in the DNS.
92 Familiarity with the Diffie-Hellman key exchange algorithm is assumed
95 1.2 About Diffie-Hellman
97 Diffie-Hellman requires two parties to interact to derive keying
98 information which can then be used for authentication. Since DNS SIG
99 RRs are primarily used as stored authenticators of zone information
100 for many different resolvers, no Diffie-Hellman algorithm SIG RR is
101 defined. For example, assume that two parties have local secrets "i"
102 and "j". Assume they each respectively calculate X and Y as follows:
104 X = g**i ( mod p ) Y = g**j ( mod p )
106 They exchange these quantities and then each calculates a Z as
109 Zi = Y**i ( mod p ) Zj = X**j ( mod p )
114 Eastlake Standards Track [Page 2]
116 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
119 shared secret between the two parties that an adversary who does not
120 know i or j will not be able to learn from the exchanged messages
121 (unless the adversary can derive i or j by performing a discrete
122 logarithm mod p which is hard for strong p and g).
124 The private key for each party is their secret i (or j). The public
125 key is the pair p and g, which must be the same for the parties, and
126 their individual X (or Y).
128 2. Diffie-Hellman KEY Resource Records
130 Diffie-Hellman keys are stored in the DNS as KEY RRs using algorithm
131 number 2. The structure of the RDATA portion of this RR is as shown
132 below. The first 4 octets, including the flags, protocol, and
133 algorithm fields are common to all KEY RRs as described in [RFC
134 2535]. The remainder, from prime length through public value is the
135 "public key" part of the KEY RR. The period of key validity is not in
136 the KEY RR but is indicated by the SIG RR(s) which signs and
137 authenticates the KEY RR(s) at that domain name.
139 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
140 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
141 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
142 | KEY flags | protocol | algorithm=2 |
143 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
144 | prime length (or flag) | prime (p) (or special) /
145 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
146 / prime (p) (variable length) | generator length |
147 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
148 | generator (g) (variable length) |
149 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
150 | public value length | public value (variable length)/
151 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
152 / public value (g^i mod p) (variable length) |
153 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
155 Prime length is length of the Diffie-Hellman prime (p) in bytes if it
156 is 16 or greater. Prime contains the binary representation of the
157 Diffie-Hellman prime with most significant byte first (i.e., in
158 network order). If "prime length" field is 1 or 2, then the "prime"
159 field is actually an unsigned index into a table of 65,536
160 prime/generator pairs and the generator length SHOULD be zero. See
161 Appedix A for defined table entries and Section 4 for information on
162 allocating additional table entries. The meaning of a zero or 3
163 through 15 value for "prime length" is reserved.
170 Eastlake Standards Track [Page 3]
172 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
175 Generator length is the length of the generator (g) in bytes.
176 Generator is the binary representation of generator with most
177 significant byte first. PublicValueLen is the Length of the Public
178 Value (g**i (mod p)) in bytes. PublicValue is the binary
179 representation of the DH public value with most significant byte
182 The corresponding algorithm=2 SIG resource record is not used so no
183 format for it is defined.
185 3. Performance Considerations
187 Current DNS implementations are optimized for small transfers,
188 typically less than 512 bytes including overhead. While larger
189 transfers will perform correctly and work is underway to make larger
190 transfers more efficient, it is still advisable to make reasonable
191 efforts to minimize the size of KEY RR sets stored within the DNS
192 consistent with adequate security. Keep in mind that in a secure
193 zone, an authenticating SIG RR will also be returned.
195 4. IANA Considerations
197 Assignment of meaning to Prime Lengths of 0 and 3 through 15 requires
200 Well known prime/generator pairs number 0x0000 through 0x07FF can
201 only be assigned by an IETF standards action and this Proposed
202 Standard assigns 0x0001 through 0x0002. Pairs number 0s0800 through
203 0xBFFF can be assigned based on RFC documentation. Pairs number
204 0xC000 through 0xFFFF are available for private use and are not
205 centrally coordinated. Use of such private pairs outside of a closed
206 environment may result in conflicts.
208 5. Security Considerations
210 Many of the general security consideration in [RFC 2535] apply. Keys
211 retrieved from the DNS should not be trusted unless (1) they have
212 been securely obtained from a secure resolver or independently
213 verified by the user and (2) this secure resolver and secure
214 obtainment or independent verification conform to security policies
215 acceptable to the user. As with all cryptographic algorithms,
216 evaluating the necessary strength of the key is important and
217 dependent on local policy.
219 In addition, the usual Diffie-Hellman key strength considerations
220 apply. (p-1)/2 should also be prime, g should be primitive mod p, p
221 should be "large", etc. [Schneier]
226 Eastlake Standards Track [Page 4]
228 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
233 [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
234 Facilities", STD 13, RFC 1034, November 1987.
236 [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
237 Specification", STD 13, RFC 1035, November 1987.
239 [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
240 RFC 2535, March 1999.
242 [Schneier] Bruce Schneier, "Applied Cryptography: Protocols,
243 Algorithms, and Source Code in C", 1996, John Wiley and
248 Donald E. Eastlake 3rd
250 65 Shindegan Hill Road, RR #1
253 Phone: +1-914-276-2668(h)
255 Fax: +1-914-784-3833(w)
256 EMail: dee3@us.ibm.com
282 Eastlake Standards Track [Page 5]
284 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
287 Appendix A: Well known prime/generator pairs
289 These numbers are copied from the IPSEC effort where the derivation
290 of these values is more fully explained and additional information is
291 available. Richard Schroeppel performed all the mathematical and
292 computational work for this appendix.
294 A.1. Well-Known Group 1: A 768 bit prime
296 The prime is 2^768 - 2^704 - 1 + 2^64 * { [2^638 pi] + 149686 }. Its
298 155251809230070893513091813125848175563133404943451431320235
299 119490296623994910210725866945387659164244291000768028886422
300 915080371891804634263272761303128298374438082089019628850917
301 0691316593175367469551763119843371637221007210577919
303 Prime modulus: Length (32 bit words): 24, Data (hex):
304 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
305 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
306 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
307 E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF
309 Generator: Length (32 bit words): 1, Data (hex): 2
311 A.2. Well-Known Group 2: A 1024 bit prime
313 The prime is 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.
315 179769313486231590770839156793787453197860296048756011706444
316 423684197180216158519368947833795864925541502180565485980503
317 646440548199239100050792877003355816639229553136239076508735
318 759914822574862575007425302077447712589550957937778424442426
319 617334727629299387668709205606050270810842907692932019128194
322 Prime modulus: Length (32 bit words): 32, Data (hex):
323 FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1
324 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD
325 EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245
326 E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED
327 EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381
330 Generator: Length (32 bit words): 1, Data (hex): 2
338 Eastlake Standards Track [Page 6]
340 RFC 2539 Diffie-Hellman Keys in the DNS March 1999
343 Full Copyright Statement
345 Copyright (C) The Internet Society (1999). All Rights Reserved.
347 This document and translations of it may be copied and furnished to
348 others, and derivative works that comment on or otherwise explain it
349 or assist in its implementation may be prepared, copied, published
350 and distributed, in whole or in part, without restriction of any
351 kind, provided that the above copyright notice and this paragraph are
352 included on all such copies and derivative works. However, this
353 document itself may not be modified in any way, such as by removing
354 the copyright notice or references to the Internet Society or other
355 Internet organizations, except as needed for the purpose of
356 developing Internet standards in which case the procedures for
357 copyrights defined in the Internet Standards process must be
358 followed, or as required to translate it into languages other than
361 The limited permissions granted above are perpetual and will not be
362 revoked by the Internet Society or its successors or assigns.
364 This document and the information contained herein is provided on an
365 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
366 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
367 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
368 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
369 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
394 Eastlake Standards Track [Page 7]