Network Working Group D. Eastlake, 3rd Request for Comments: 2065 CyberCash Updates: 1034, 1035 C. Kaufman Category: Standards Track Iris January 1997 Domain Name System Security Extensions Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited. Abstract The Domain Name System (DNS) has become a critical operational part of the Internet infrastructure yet it has no strong security mechanisms to assure data integrity or authentication. Extensions to the DNS are described that provide these services to security aware resolvers or applications through the use of cryptographic digital signatures. These digital signatures are included in secured zones as resource records. Security can still be provided even through non-security aware DNS servers in many cases. The extensions also provide for the storage of authenticated public keys in the DNS. This storage of keys can support general public key distribution service as well as DNS security. The stored keys enable security aware resolvers to learn the authenticating key of zones in addition to those for which they are initially configured. Keys associated with DNS names can be retrieved to support other protocols. Provision is made for a variety of key types and algorithms. In addition, the security extensions provide for the optional authentication of DNS protocol transactions. Eastlake & Kaufman Standards Track [Page 1] RFC 2065 DNS Security Extensions January 1997 Acknowledgments The significant contributions of the following persons (in alphabetic order) to this document are gratefully acknowledged: Harald T. Alvestrand Madelyn Badger Scott Bradner Matt Crawford James M. Galvin Olafur Gudmundsson Edie Gunter Sandy Murphy Masataka Ohta Michael A. Patton Jeffrey I. Schiller Table of Contents 1. Overview of Contents....................................3 2. Overview of the DNS Extensions.........................4 2.1 Services Not Provided..................................4 2.2 Key Distribution.......................................5 2.3 Data Origin Authentication and Integrity...............5 2.3.1 The SIG Resource Record..............................6 2.3.2 Authenticating Name and Type Non-existence...........7 2.3.3 Special Considerations With Time-to-Live.............7 2.3.4 Special Considerations at Delegation Points..........7 2.3.5 Special Considerations with CNAME RRs................8 2.3.6 Signers Other Than The Zone..........................8 2.4 DNS Transaction and Request Authentication.............8 3. The KEY Resource Record.................................9 3.1 KEY RDATA format......................................10 3.2 Object Types, DNS Names, and Keys.....................10 3.3 The KEY RR Flag Field.................................11 3.4 The Protocol Octet....................................13 3.5 The KEY Algorithm Number and the MD5/RSA Algorithm....13 3.6 Interaction of Flags, Algorithm, and Protocol Bytes...14 3.7 KEY RRs in the Construction of Responses..............15 3.8 File Representation of KEY RRs........................16 4. The SIG Resource Record................................16 4.1 SIG RDATA Format......................................17 4.1.1 Signature Data......................................19 4.1.2 MD5/RSA Algorithm Signature Calculation.............20 4.1.3 Zone Transfer (AXFR) SIG............................21 4.1.4 Transaction and Request SIGs........................22 4.2 SIG RRs in the Construction of Responses..............23 4.3 Processing Responses and SIG RRs......................24 Eastlake & Kaufman Standards Track [Page 2] RFC 2065 DNS Security Extensions January 1997 4.4 Signature Expiration, TTLs, and Validity..............24 4.5 File Representation of SIG RRs........................25 5. Non-existent Names and Types...........................26 5.1 The NXT Resource Record...............................26 5.2 NXT RDATA Format......................................27 5.3 Example...............................................28 5.4 Interaction of NXT RRs and Wildcard RRs...............28 5.5 Blocking NXT Pseudo-Zone Transfers....................29 5.6 Special Considerations at Delegation Points...........29 6. The AD and CD Bits and How to Resolve Securely.........30 6.1 The AD and CD Header Bits.............................30 6.2 Boot File Format......................................32 6.3 Chaining Through Zones................................32 6.4 Secure Time...........................................33 7. Operational Considerations.............................33 7.1 Key Size Considerations...............................34 7.2 Key Storage...........................................34 7.3 Key Generation........................................35 7.4 Key Lifetimes.........................................35 7.5 Signature Lifetime....................................36 7.6 Root..................................................36 8. Conformance............................................36 8.1 Server Conformance....................................36 8.2 Resolver Conformance..................................37 9. Security Considerations................................37 References................................................38 Authors' Addresses........................................39 Appendix: Base 64 Encoding................................40 1. Overview of Contents This document describes extensions of the Domain Name System (DNS) protocol to support DNS security and public key distribution. It assumes that the reader is familiar with the Domain Name System, particularly as described in RFCs 1033, 1034, and 1035. Section 2 provides an overview of the extensions and the key distribution, data origin authentication, and transaction and request security they provide. Section 3 discusses the KEY resource record, its structure, use in DNS responses, and file representation. These resource records represent the public keys of entities named in the DNS and are used for key distribution. Eastlake & Kaufman Standards Track [Page 3] RFC 2065 DNS Security Extensions January 1997 Section 4 discusses the SIG digital signature resource record, its structure, use in DNS responses, and file representation. These resource records are used to authenticate other resource records in the DNS and optionally to authenticate DNS transactions and requests. Section 5 discusses the NXT resource record and its use in DNS responses. The NXT RR permits authenticated denial in the DNS of the existence of a name or of a particular type for an existing name. Section 6 discusses how a resolver can be configured with a starting key or keys and proceed to securely resolve DNS requests. Interactions between resolvers and servers are discussed for all combinations of security aware and security non-aware. Two additional query header bits are defined for signaling between resolvers and servers. Section 7 reviews a variety of operational considerations including key generation, lifetime, and storage. Section 8 defines levels of conformance for resolvers and servers. Section 9 provides a few paragraphs on overall security considerations. An Appendix is provided that gives details of base 64 encoding which is used in the file representation of some RR's defined in this document. 2. Overview of the DNS Extensions The Domain Name System (DNS) protocol security extensions provide three distinct services: key distribution as described in Section 2.2 below, data origin authentication as described in Section 2.3 below, and transaction and request authentication, described in Section 2.4 below. Special considerations related to "time to live", CNAMEs, and delegation points are also discussed in Section 2.3. 2.1 Services Not Provided It is part of the design philosophy of the DNS that the data in it is public and that the DNS gives the same answers to all inquirers. Following this philosophy, no attempt has been made to include any sort of access control lists or other means to differentiate inquirers. Eastlake & Kaufman Standards Track [Page 4] RFC 2065 DNS Security Extensions January 1997 In addition, no effort has been made to provide for any confidentiality for queries or responses. (This service may be available via IPSEC [RFC 1825].) 2.2 Key Distribution Resource records (RRs) are defined to associate keys with DNS names. This permits the DNS to be used as a public key distribution mechanism in support of the DNS data origin authentication and other security services. The syntax of a KEY resource record (RR) is described in Section 3. It includes an algorithm identifier, the actual public key parameters, and a variety of flags including those indicating the type of entity the key is associated with and/or asserting that there is no key associated with that entity. Under conditions described in Section 3.7, security aware DNS servers will automatically attempt to return KEY resources as additional information, along with those resource records actually requested, to minimize the number of queries needed. 2.3 Data Origin Authentication and Integrity Authentication is provided by associating with resource records in the DNS cryptographically generated digital signatures. Commonly, there will be a single private key that signs for an entire zone. If a security aware resolver reliably learns the public key of the zone, it can verify, for signed data read from that zone, that it was properly authorized and is reasonably current. The expected implementation is for the zone private key to be kept off-line and used to re-sign all of the records in the zone periodically. This data origin authentication key belongs to the zone and not to the servers that store copies of the data. That means compromise of a server or even all servers for a zone will not necessarily affect the degree of assurance that a resolver has that it can determine whether data is genuine. A resolver can learn the public key of a zone either by reading it from DNS or by having it staticly configured. To reliably learn the public key by reading it from DNS, the key itself must be signed. Thus, to provide a reasonable degree of security, the resolver must be configured with at least the public key of one zone that it can use to authenticate signatures. From there, it can securely read the public keys of other zones, if the intervening zones in the DNS tree are secure and their signed keys accessible. (It is in principle more secure to have the resolver manually configured with the public Eastlake & Kaufman Standards Track [Page 5] RFC 2065 DNS Security Extensions January 1997 keys of multiple zones, since then the compromise of a single zone would not permit the faking of information from other zones. It is also more administratively cumbersome, however, particularly when public keys change.) Adding data origin authentication and integrity requires no change to the "on-the-wire" DNS protocol beyond the addition of the signature resource type and, as a practical matter, the key resource type needed for key distribution. This service can be supported by existing resolver and server implementations so long as they can support the additional resource types (see Section 8). The one exception is that CNAME referrals from a secure zone can not be authenticated if they are from non-security aware servers (see Section 2.3.5). If signatures are always separately retrieved and verified when retrieving the information they authenticate, there will be more trips to the server and performance will suffer. To avoid this, security aware servers mitigate that degradation by always attempting to send the signature(s) needed. 2.3.1 The SIG Resource Record The syntax of a SIG resource record (signature) is described in Section 4. It includes the type of the RR(s) being signed, the name of the signer, the time at which the signature was created, the time it expires (when it is no longer to be believed), its original time to live (which may be longer than its current time to live but cannot be shorter), the cryptographic algorithm in use, and the actual signature. Every name in a secured zone will have associated with it at least one SIG resource record for each resource type under that name except for glue RRs and delgation point NS RRs. A security aware server supporting the performance enhanced version of the DNS protocol security extensions will attempt to return, with RRs retrieved, the corresponding SIGs. If a server does not support the protocol, the resolver must retrieve all the SIG records for a name and select the one or ones that sign the resource record(s) that resolver is interested in. Eastlake & Kaufman Standards Track [Page 6] RFC 2065 DNS Security Extensions January 1997 2.3.2 Authenticating Name and Type Non-existence The above security mechanism provides only a way to sign existing RRs in a zone. "Data origin" authentication is not obviously provided for the non-existence of a domain name in a zone or the non-existence of a type for an existing name. This gap is filled by the NXT RR which authenticatably asserts a range of non-existent names in a zone and the non-existence of types for the name just before that range. Section 5 below covers the NXT RR. 2.3.3 Special Considerations With Time-to-Live A digital signature will fail to verify if any change has occurred to the data between the time it was originally signed and the time the signature is verified. This conflicts with our desire to have the time-to-live field tick down when resource records are cached. This could be avoided by leaving the time-to-live out of the digital signature, but that would allow unscrupulous servers to set arbitrarily long time to live values undetected. Instead, we include the "original" time-to-live in the signature and communicate that data in addition to the current time-to-live. Unscrupulous servers under this scheme can manipulate the time to live but a security aware resolver will bound the TTL value it uses at the original signed value. Separately, signatures include a time signed and an expiration time. A resolver that knows the absolute time can determine securely whether a signature has expired. It is not possible to rely solely on the signature expiration as a substitute for the TTL, however, since the TTL is primarily a database consistency mechanism and, in any case, non-security aware servers that depend on TTL must still be supported. 2.3.4 Special Considerations at Delegation Points DNS security would like to view each zone as a unit of data completely under the control of the zone owner and signed by the zone's key. But the operational DNS views the leaf nodes in a zone, which are also the apex nodes of a subzone (i.e., delegation points), as "really" belonging to the subzone. These nodes occur in two master files and may have RRs signed by both the upper and lower zone's keys. A retrieval could get a mixture of these RRs and SIGs, especially since one server could be serving both the zone above and below a delegation point. In general, there must be a zone KEY RR for the subzone in the superzone and the copy signed in the superzone is controlling. For all but one other RR type that should appearing in both the superzone Eastlake & Kaufman Standards Track [Page 7] RFC 2065 DNS Security Extensions January 1997 and subzone, the data from the subzone is more authoritative. To avoid conflicts, only the KEY RR in the superzone should be signed and the NS and any A (glue) RRs should only be signed in the subzone. The SOA and any other RRs that have the zone name as owner should appear only in the subzone and thus are signed there. The NXT RR type is an exceptional case that will always appear differently and authoritatively in both the superzone and subzone, if both are secure, as described in Section 5. 2.3.5 Special Considerations with CNAME RRs There is a significant problem when security related RRs with the same owner name as a CNAME RR are retrieved from a non-security-aware server. In particular, an initial retrieval for the CNAME or any other type will not retrieve any associated signature, key, or NXT RR. For types other than CNAME, it will retrieve that type at the target name of the CNAME (or chain of CNAMEs) and will return the CNAME as additional information. In particular, a specific retrieval for type SIG will not get the SIG, if any, at the original CNAME domain name but rather a SIG at the target name. In general, security aware servers MUST be used to securely CNAME in DNS. Security aware servers must (1) allow KEY, SIG, and NXT RRs along with CNAME RRs, (2) suppress CNAME processing on retrieval of these types as well as on retrieval of the type CNAME, and (3) automatically return SIG RRs authenticating the CNAME or CNAMEs encountered in resolving a query. This is a change from the previous DNS standard which prohibited any other RR type at a node where a CNAME RR was present. 2.3.6 Signers Other Than The Zone There are two cases where a SIG resource record is signed by other than the zone private key. One is for support of dynamic update where an entity is permitted to authenticate/update its own records. The public key of the entity must be present in the DNS and be appropriately signed but the other RR(s) may be signed with the entity's key. The other is for support of transaction and request authentication as described in Section 2.4 immediately below. 2.4 DNS Transaction and Request Authentication The data origin authentication service described above protects retrieved resource records but provides no protection for DNS requests or for message headers. Eastlake & Kaufman Standards Track [Page 8] RFC 2065 DNS Security Extensions January 1997 If header bits are falsely set by a server, there is little that can be done. However, it is possible to add transaction authentication. Such authentication means that a resolver can be sure it is at least getting messages from the server it thinks it queried, that the response is from the query it sent, and that these messages have not been diddled in transit. This is accomplished by optionally adding a special SIG resource record at the end of the reply which digitally signs the concatenation of the server's response and the resolver's query. Requests can also be authenticated by including a special SIG RR at the end of the request. Authenticating requests serves no function in the current DNS and requests with a non-empty additional information section are ignored by almost all current DNS servers. However, this syntax for signing requests is defined in connection with authenticating future secure dynamic update requests or the like. The private keys used in transaction and request security belongs to the host composing the request or reply message, not to the zone involved. The corresponding public key is normally stored in and retrieved from the DNS. Because requests and replies are highly variable, message authentication SIGs can not be pre-calculated. Thus it will be necessary to keep the private key on-line, for example in software or in a directly connected piece of hardware. 3. The KEY Resource Record The KEY resource record (RR) is used to document a key that is associated with a Domain Name System (DNS) name. It will be a public key as only public keys are stored in the DNS. This can be the public key of a zone, a host or other end entity, or a user. A KEY RR is, like any other RR, authenticated by a SIG RR. Security aware DNS implementations MUST be designed to handle at least two simultaneously valid keys of the same type associated with a name. The type number for the KEY RR is 25. Eastlake & Kaufman Standards Track [Page 9] RFC 2065 DNS Security Extensions January 1997 3.1 KEY RDATA format The RDATA for a KEY RR consists of flags, a protocol octet, the algorithm number, and the public key itself. The format is as follows: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | flags | protocol | algorithm | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / public key / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| The meaning of the KEY RR owner name, flags, and protocol octet are described in Sections 3.2, 3.3 and 3.4 below respectively. The flags and algorithm must be examined before any data following the algorithm octet as they control the format and even whether there is any following data. The algorithm and public key fields are described in Section 3.5. The format of the public key is algorithm dependent. 3.2 Object Types, DNS Names, and Keys The public key in a KEY RR belongs to the object named in the owner name. This DNS name may refer to up to three different categories of things. For example, dee.cybercash.com could be (1) a zone, (2) a host or other end entity , and (3) the mapping into a DNS name of the user or account dee@cybercash.com. Thus, there are flags, as described below, in the KEY RR to indicate with which of these roles the owner name and public key are associated. Note that an appropriate zone KEY RR MUST occur at the apex node of a secure zone and at every leaf node which is a delegation point (and thus the same owner name as the apex of a subzone) within a secure zone. Although the same name can be used for up to all three of these categories, such overloading of a name is discouraged. It is also possible to use the same key for different things with the same name or even different names, but this is strongly discouraged. In particular, the use of a zone key as a non-zone key will usually require that the corresponding private key be kept on line and thereby become more vulnerable. Eastlake & Kaufman Standards Track [Page 10] RFC 2065 DNS Security Extensions January 1997 In addition to the name type bits, there are additional flag bits including the "type" field, "experimental" bit, "signatory" field, etc., as described below. 3.3 The KEY RR Flag Field In the "flags" field: Bit 0 and 1 are the key "type" field. Bit 0 a one indicates that use of the key is prohibited for authentication. Bit 1 a one indicates that use of the key is prohibited for confidentiality. If this field is zero, then use of the key for authentication and/or confidentiality is permitted. Note that DNS security makes use of keys for authentication only. Confidentiality use flagging is provided for use of keys in other protocols. Implementations not intended to support key distribution for confidentiality MAY require that the confidentiality use prohibited bit be on for keys they serve. If both bits of this field are one, the "no key" value, there is no key information and the RR stops after the algorithm octet. By the use of this "no key" value, a signed KEY RR can authenticatably assert that, for example, a zone is not secured. Bit 2 is the "experimental" bit. It is ignored if the type field indicates "no key" and the following description assumes that type field to be non-zero. Keys may be associated with zones, entities, or users for experimental, trial, or optional use, in which case this bit will be one. If this bit is a zero, it means that the use or availability of security based on the key is "mandatory". Thus, if this bit is off for a zone key, the zone should be assumed secured by SIG RRs and any responses indicating the zone is not secured should be considered bogus. If this bit is a one for a host or end entity, it might sometimes operate in a secure mode and at other times operate without security. The experimental bit, like all other aspects of the KEY RR, is only effective if the KEY RR is appropriately signed by a SIG RR. The experimental bit must be zero for safe secure operation and should only be a one for a minimal transition period. Bits 3-4 are reserved and must be zero. Bit 5 on indicates that this is a key associated with a "user" or "account" at an end entity, usually a host. The coding of the owner name is that used for the responsible individual mailbox in the SOA and RP RRs: The owner name is the user name as the name of a node under the entity name. For example, "j.random_user" on host.subdomain.domain could have a public key associated through a KEY RR with name j\.random_user.host.subdomain.domain and the user bit a one. It could be used in an security protocol where Eastlake & Kaufman Standards Track [Page 11] RFC 2065 DNS Security Extensions January 1997 authentication of a user was desired. This key might be useful in IP or other security for a user level service such a telnet, ftp, rlogin, etc. Bit 6 on indicates that this is a key associated with the non- zone "entity" whose name is the RR owner name. This will commonly be a host but could, in some parts of the DNS tree, be some other type of entity such as a telephone number [RFC 1530]. This is the public key used in connection with the optional DNS transaction authentication service if the owner name is a DNS server host. It could also be used in an IP-security protocol where authentication of at the host, rather than user, level was desired, such as routing, NTP, etc. Bit 7 is the "zone" bit and indicates that this is a zone key for the zone whose name is the KEY RR owner name. This is the public key used for DNS data origin authentication. Bit 8 is reserved to be the IPSEC [RFC 1825] bit and indicates that this key is valid for use in conjunction with that security standard. This key could be used in connection with secured communication on behalf of an end entity or user whose name is the owner name of the KEY RR if the entity or user bits are on. The presence of a KEY resource with the IPSEC and entity bits on and experimental and no-key bits off is an assertion that the host speaks IPSEC. Bit 9 is reserved to be the "email" bit and indicate that this key is valid for use in conjunction with MIME security multiparts. This key could be used in connection with secured communication on behalf of an end entity or user whose name is the owner name of the KEY RR if the entity or user bits are on. Bits 10-11 are reserved and must be zero. Bits 12-15 are the "signatory" field. If non-zero, they indicate that the key can validly sign RRs or updates of the same name. If the owner name is a wildcard, then RRs or updates with any name which is in the wildcard's scope can be signed. Fifteen different non-zero values are possible for this field and any differences in their meaning are reserved for definition in connection with DNS dynamic update or other new DNS commands. Zone keys always have authority to sign any RRs in the zone regardless of the value of this field. The signatory field, like all other aspects of the KEY RR, is only effective if the KEY RR is appropriately signed by a SIG RR. Eastlake & Kaufman Standards Track [Page 12] RFC 2065 DNS Security Extensions January 1997 3.4 The Protocol Octet It is anticipated that some keys stored in DNS will be used in conjunction with Internet protocols other than DNS (keys with zone bit or signatory field non-zero) and IPSEC/email (keys with IPSEC and/or email bit set). The protocol octet is provided to indicate that a key is valid for such use and, for end entity keys or the host part of user keys, that the secure version of that protocol is implemented on that entity or host. Values between 1 and 191 decimal inclusive are available for assignment by IANA for such protocols. The 63 values between 192 and 254 inclusive will not be assigned to a specific protocol and are available for experimental use under bilateral agreement. Value 0 indicates, for a particular key, that it is not valid for any particular additional protocol beyond those indicated in the flag field. And value 255 indicates that the key is valid for all assigned protocols (those in the 1 to 191 range). It is intended that new uses of DNS stored keys would initially be implemented, and operational experience gained, using the experimental range of the protocol octet. If demand for widespread deployment for the indefinite future warrants, a value in the assigned range would then be designated for the protocol. Finally, (1) should the protocol become so widespread in conjunction with other protocols and with which it shares key values that duplicate RRs are a serious burden and (2) should the protocol provide substantial facilities not available in any protocol for which a flags field bit has been allocated, then one of the remaining flag field bits may be allocated to the protocol. When such a bit has been allocated, a key can be simultaneously indicated as valid for that protocol and the entity or host can be simultaneously flagged as implementing the secure version of that protocol, along with other protocols for which flag field bits have been assigned. 3.5 The KEY Algorithm Number and the MD5/RSA Algorithm This octet is the key algorithm parallel to the same field for the SIG resource. The MD5/RSA algorithm described in this document is number 1. Numbers 2 through 252 are available for assignment should sufficient reason arise. However, the designation of a new algorithm could have a major impact on interoperability and requires an IETF standards action. Number 254 is reserved for private use and will never be assigned a specific algorithm. For number 254, the public key area shown in the packet diagram above will actually begin with a length byte followed by an Object Identifier (OID) of that length. The OID indicates the private algorithm in use and the remainder of the area is whatever is required by that algorithm. Number 253 is Eastlake & Kaufman Standards Track [Page 13] RFC 2065 DNS Security Extensions January 1997 reserved as the "expiration date algorithm" for use where the expiration date or other labeling fields of SIGs are desired without any actual security. It is anticipated that this algorithm will only be used in connection with some modes of DNS dynamic update. For number 253, the public key area is null. Values 0 and 255 are reserved. If the type field does not have the "no key" value and the algorithm field is 1, indicating the MD5/RSA algorithm, the public key field is structured as follows: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | pub exp length| public key exponent / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / +- modulus / | / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-/ To promote interoperability, the exponent and modulus are each limited to 2552 bits in length. The public key exponent is a variable length unsigned integer. Its length in octets is represented as one octet if it is in the range of 1 to 255 and by a zero octet followed by a two octet unsigned length if it is longer than 255 bytes. The public key modulus field is a multiprecision unsigned integer. The length of the modulus can be determined from the RDLENGTH and the preceding RDATA fields including the exponent. Leading zero bytes are prohibited in the exponent and modulus. 3.6 Interaction of Flags, Algorithm, and Protocol Bytes Various combinations of the no-key type value, algorithm byte, protocol byte, and any protocol indicating flags (such as the reserved IPSEC flag) are possible. (Note that the zone flag bit being on or the signatory field being non-zero is effectively a DNS protocol flag on.) The meaning of these combinations is indicated below: Eastlake & Kaufman Standards Track [Page 14] RFC 2065 DNS Security Extensions January 1997 NK = no key type value AL = algorithm byte PR = protocols indicated by protocol byte or protocol flags x represents any valid non-zero value(s). AL PR NK Meaning 0 0 0 Illegal, claims key but has bad algorithm field. 0 0 1 Specifies total lack of security for owner. 0 x 0 Illegal, claims key but has bad algorithm field. 0 x 1 Specified protocols insecure, others may be secure. x 0 0 Useless. Gives key but no protocols to use it. x 0 1 Useless. Denies key but for no protocols. x x 0 Specifies key for protocols and asserts that those protocols are implemented with security. x x 1 Algorithm not understood for protocol. (remember, in reference to the above table, that a protocol byte of 255 means all protocols with protocol byte values assigned) 3.7 KEY RRs in the Construction of Responses An explicit request for KEY RRs does not cause any special additional information processing except, of course, for the corresponding SIG RR from a security aware server. Security aware DNS servers MUST include KEY RRs as additional information in responses where appropriate including the following: (1) On the retrieval of NS RRs, the zone key KEY RR(s) for the zone served by these name servers MUST be included as additional information if space is avilable. There will always be at least one such KEY RR in a secure zone, even if it has the no-key type value to indicate that the subzone is insecure. If not all additional information will fit, the KEY RR(s) have higher priority than type A or AAAA glue RRs. If such a KEY RR does not fit on a retrieval, the retrieval must be considered truncated. (2) On retrieval of type A or AAAA RRs, the end entity KEY RR(s) MUST be included if space is available. On inclusion of A or AAAA RRs as additional information, their KEY RRs will also be included but with lower priority than the relevant A or AAAA RRs. Eastlake & Kaufman Standards Track [Page 15] RFC 2065 DNS Security Extensions January 1997 3.8 File Representation of KEY RRs KEY RRs may appear as lines in a zone data master file. The flag field, protocol, and algorithm number octets are then represented as unsigned integers. Note that if the type field has the "no key" value or the algorithm specified is 253, nothing appears after the algorithm octet. The remaining public key portion is represented in base 64 (see Appendix) and may be divided up into any number of white space separated substrings, down to single base 64 digits, which are concatenated to obtain the full signature. These substrings can span lines using the standard parenthesis. Note that the public key may have internal sub-fields but these do not appear in the master file representation. For example, with algorithm 1 there is a public exponent size, then a public exponent, and then a modulus. With algorithm 254, there will be an OID size, an OID, and algorithm dependent information. But in both cases only a single logical base 64 string will appear in the master file. 4. The SIG Resource Record The SIG or "signature" resource record (RR) is the fundamental way that data is authenticated in the secure Domain Name System (DNS). As such it is the heart of the security provided. The SIG RR unforgably authenticates other RRs of a particular type, class, and name and binds them to a time interval and the signer's domain name. This is done using cryptographic techniques and the signer's private key. The signer is frequently the owner of the zone from which the RR originated. Eastlake & Kaufman Standards Track [Page 16] RFC 2065 DNS Security Extensions January 1997 4.1 SIG RDATA Format The RDATA portion of a SIG RR is as shown below. The integrity of the RDATA information is protected by the signature field. 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | type covered | algorithm | labels | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | original TTL | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | signature expiration | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | time signed | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | key footprint | / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ signer's name / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / +- signature / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The value of the SIG RR type is 24. The "type covered" is the type of the other RRs covered by this SIG. The algorithm number is an octet specifying the digital signature algorithm used parallel to the algorithm octet for the KEY RR. The MD5/RSA algorithm described in this document is number 1. Numbers 2 through 252 are available for assignment should sufficient reason arise to allocate them. However, the designation of a new algorithm could have a major impact on the interoperability of the global DNS system and requires an IETF standards action. Number 254 is reserved for private use and will not be assigned a specific algorithm. For number 254, the "signature" area shown above will actually begin with a length byte followed by an Object Identifier (OID) of that length. The OID indicates the private algorithm in use and the remainder of the area is whatever is required by that algorithm. Number 253, known as the "expiration date algorithm", is used when the expiration date or other non-signature fields of the SIG are desired without any actual security. It is anticipated that this algorithm will only be used in connection with some modes of DNS dynamic update. For number 253, the signature field will be null. Values 0 and 255 are reserved. Eastlake & Kaufman Standards Track [Page 17] RFC 2065 DNS Security Extensions January 1997 The "labels" octet is an unsigned count of how many labels there are in the original SIG RR owner name not counting the null label for root and not counting any initial "*" for a wildcard. If a secured retrieval is the result of wild card substitution, it is necessary for the resolver to use the original form of the name in verifying the digital signature. This field helps optimize the determination of the original form thus reducing the effort in authenticating signed data. If, on retrieval, the RR appears to have a longer name than indicated by "labels", the resolver can tell it is the result of wildcard substitution. If the RR owner name appears to be shorter than the labels count, the SIG RR must be considered corrupt and ignored. The maximum number of labels allowed in the current DNS is 127 but the entire octet is reserved and would be required should DNS names ever be expanded to 255 labels. The following table gives some examples. The value of "labels" is at the top, the retrieved owner name on the left, and the table entry is the name to use in signature verification except that "bad" means the RR is corrupt. labels= | 0 | 1 | 2 | 3 | 4 | --------+-----+------+--------+----------+----------+ .| . | bad | bad | bad | bad | d.| *. | d. | bad | bad | bad | c.d.| *. | *.d. | c.d. | bad | bad | b.c.d.| *. | *.d. | *.c.d. | b.c.d. | bad | a.b.c.d.| *. | *.d. | *.c.d. | *.b.c.d. | a.b.c.d. | The "original TTL" field is included in the RDATA portion to avoid (1) authentication problems that caching servers would otherwise cause by decrementing the real TTL field and (2) security problems that unscrupulous servers could otherwise cause by manipulating the real TTL field. This original TTL is protected by the signature while the current TTL field is not. NOTE: The "original TTL" must be restored into the covered RRs when the signature is verified. This implies that all RRs for a particular type, name, and class must have the same TTL to start with. The SIG is valid until the "signature expiration" time which is an unsigned number of seconds since the start of 1 January 1970, GMT, ignoring leap seconds. (See also Section 4.4.) SIG RRs should not have a date signed significantly in the future. To prevent misordering of network requests to update a zone dynamically, monotonically increasing "time signed" dates may be necessary. Eastlake & Kaufman Standards Track [Page 18] RFC 2065 DNS Security Extensions January 1997 The "time signed" field is an unsigned number of seconds since the start of 1 January 1970, GMT, ignoring leap seconds. A SIG RR with an expiration date before the time signed must be considered corrupt and ignored. The "key footprint" is a 16 bit quantity that is used to help efficiently select between multiple keys which may be applicable and as a quick check that a public key about to be used for the computationally expensive effort to check the signature is possibly valid. Its exact meaning is algorithm dependent. For the MD5/RSA algorithm, it is the next to the bottom two octets of the public key modulus needed to decode the signature field. That is to say, the most significant 16 of the lest significant 24 bits of the modulus in network order. The "signer's name" field is the domain name of the signer generating the SIG RR. This is the owner of the public KEY RR that can be used to verify the signature. It is frequently the zone which contained the RR(s) being authenticated. The signer's name may be compressed with standard DNS name compression when being transmitted over the network. The structure of the "signature" field is described below. 4.1.1 Signature Data Except for algorithm number 253 where it is null, the actual signature portion of the SIG RR binds the other RDATA fields to all of the "type covered" RRs with that owner name and class. These covered RRs are thereby authenticated. To accomplish this, a data sequence is constructed as follows: data = RDATA | RR(s)... where "|" is concatenation, RDATA is all the RDATA fields in the SIG RR itself before and not including the signature, and RR(s) are all the RR(s) of the type covered with the same owner name and class as the SIG RR in canonical form and order. How this data sequence is processed into the signature is algorithm dependent. For purposes of DNS security, the canonical form for an RR is the RR with domain names (1) fully expanded (no name compression via pointers), (2) all domain name letters set to lower case, and (3) the original TTL substituted for the current TTL. Eastlake & Kaufman Standards Track [Page 19] RFC 2065 DNS Security Extensions January 1997 For purposes of DNS security, the canonical order for RRs is to sort them in ascending order by name, considering labels as a left justified unsigned octet sequence in network (transmission) order where a missing octet sorts before a zero octet. (See also ordering discussion in Section 5.1.) Within any particular name they are similarly sorted by type and then RDATA as a left justified unsigned octet sequence. EXCEPT that the type SIG RR(s) covering any particular type appear immediately after the other RRs of that type. (This special consideration for SIG RR(s) in ordering really only applies to calculating the AXFR SIG RR as explained in section 4.1.3 below.) Thus if at name a.b there are two A RRs and one KEY RR, their order with SIGs for concatenating the "data" to be signed would be as follows: a.b. A .... a.b. A .... a.b. SIG A ... a.b. KEY ... a.b. SIG KEY ... SIGs covering type ANY should not be included in a zone. 4.1.2 MD5/RSA Algorithm Signature Calculation For the MD5/RSA algorithm, the signature is as follows hash = MD5 ( data ) signature = ( 01 | FF* | 00 | prefix | hash ) ** e (mod n) where MD5 is the message digest algorithm documented in RFC 1321, "|" is concatenation, "e" is the private key exponent of the signer, and "n" is the modulus of the signer's public key. 01, FF, and 00 are fixed octets of the corresponding hexadecimal value. "prefix" is the ASN.1 BER MD5 algorithm designator prefix speci