home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 2000s / rfc2065.txt < prev    next >
Text File  |  1996-12-29  |  98KB  |  2,300 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                   D. Eastlake, 3rd
  8. Request for Comments: 2065                                     CyberCash
  9. Updates: 1034, 1035                                           C. Kaufman
  10. Category: Standards Track                                           Iris
  11.                                                             January 1997
  12.  
  13.  
  14.                  Domain Name System Security Extensions
  15.  
  16. Status of this Memo
  17.  
  18.    This document specifies an Internet standards track protocol for the
  19.    Internet community, and requests discussion and suggestions for
  20.    improvements.  Please refer to the current edition of the "Internet
  21.    Official Protocol Standards" (STD 1) for the standardization state
  22.    and status of this protocol.  Distribution of this memo is unlimited.
  23.  
  24. Abstract
  25.  
  26.    The Domain Name System (DNS) has become a critical operational part
  27.    of the Internet infrastructure yet it has no strong security
  28.    mechanisms to assure data integrity or authentication.  Extensions to
  29.    the DNS are described that provide these services to security aware
  30.    resolvers or applications through the use of cryptographic digital
  31.    signatures.  These digital signatures are included in secured zones
  32.    as resource records.  Security can still be provided even through
  33.    non-security aware DNS servers in many cases.
  34.  
  35.    The extensions also provide for the storage of authenticated public
  36.    keys in the DNS.  This storage of keys can support general public key
  37.    distribution service as well as DNS security.  The stored keys enable
  38.    security aware resolvers to learn the authenticating key of zones in
  39.    addition to those for which they are initially configured.  Keys
  40.    associated with DNS names can be retrieved to support other
  41.    protocols.  Provision is made for a variety of key types and
  42.    algorithms.
  43.  
  44.    In addition, the security extensions provide for the optional
  45.    authentication of DNS protocol transactions.
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Eastlake & Kaufman          Standards Track                     [Page 1]
  59.  
  60. RFC 2065                DNS Security Extensions             January 1997
  61.  
  62.  
  63. Acknowledgments
  64.  
  65.    The significant contributions of the following persons (in alphabetic
  66.    order) to this document are gratefully acknowledged:
  67.  
  68.            Harald T. Alvestrand
  69.            Madelyn Badger
  70.            Scott Bradner
  71.            Matt Crawford
  72.            James M. Galvin
  73.            Olafur Gudmundsson
  74.            Edie Gunter
  75.            Sandy Murphy
  76.            Masataka Ohta
  77.            Michael A. Patton
  78.            Jeffrey I. Schiller
  79.  
  80. Table of Contents
  81.  
  82.    1. Overview of Contents....................................3
  83.    2.  Overview of the DNS Extensions.........................4
  84.    2.1 Services Not Provided..................................4
  85.    2.2 Key Distribution.......................................5
  86.    2.3 Data Origin Authentication and Integrity...............5
  87.    2.3.1 The SIG Resource Record..............................6
  88.    2.3.2 Authenticating Name and Type Non-existence...........7
  89.    2.3.3 Special Considerations With Time-to-Live.............7
  90.    2.3.4 Special Considerations at Delegation Points..........7
  91.    2.3.5 Special Considerations with CNAME RRs................8
  92.    2.3.6 Signers Other Than The Zone..........................8
  93.    2.4 DNS Transaction and Request Authentication.............8
  94.    3. The KEY Resource Record.................................9
  95.    3.1 KEY RDATA format......................................10
  96.    3.2 Object Types, DNS Names, and Keys.....................10
  97.    3.3 The KEY RR Flag Field.................................11
  98.    3.4 The Protocol Octet....................................13
  99.    3.5 The KEY Algorithm Number and the MD5/RSA Algorithm....13
  100.    3.6 Interaction of Flags, Algorithm, and Protocol Bytes...14
  101.    3.7 KEY RRs in the Construction of Responses..............15
  102.    3.8 File Representation of KEY RRs........................16
  103.    4. The SIG Resource Record................................16
  104.    4.1 SIG RDATA Format......................................17
  105.    4.1.1 Signature Data......................................19
  106.    4.1.2 MD5/RSA Algorithm Signature Calculation.............20
  107.    4.1.3 Zone Transfer (AXFR) SIG............................21
  108.    4.1.4 Transaction and Request SIGs........................22
  109.    4.2 SIG RRs in the Construction of Responses..............23
  110.    4.3 Processing Responses and SIG RRs......................24
  111.  
  112.  
  113.  
  114. Eastlake & Kaufman          Standards Track                     [Page 2]
  115.  
  116. RFC 2065                DNS Security Extensions             January 1997
  117.  
  118.  
  119.    4.4 Signature Expiration, TTLs, and Validity..............24
  120.    4.5 File Representation of SIG RRs........................25
  121.    5. Non-existent Names and Types...........................26
  122.    5.1 The NXT Resource Record...............................26
  123.    5.2 NXT RDATA Format......................................27
  124.    5.3 Example...............................................28
  125.    5.4 Interaction of NXT RRs and Wildcard RRs...............28
  126.    5.5 Blocking NXT Pseudo-Zone Transfers....................29
  127.    5.6 Special Considerations at Delegation Points...........29
  128.    6. The AD and CD Bits and How to Resolve Securely.........30
  129.    6.1 The AD and CD Header Bits.............................30
  130.    6.2 Boot File Format......................................32
  131.    6.3 Chaining Through Zones................................32
  132.    6.4 Secure Time...........................................33
  133.    7. Operational Considerations.............................33
  134.    7.1 Key Size Considerations...............................34
  135.    7.2 Key Storage...........................................34
  136.    7.3 Key Generation........................................35
  137.    7.4 Key Lifetimes.........................................35
  138.    7.5 Signature Lifetime....................................36
  139.    7.6 Root..................................................36
  140.    8. Conformance............................................36
  141.    8.1 Server Conformance....................................36
  142.    8.2 Resolver Conformance..................................37
  143.    9. Security Considerations................................37
  144.    References................................................38
  145.    Authors' Addresses........................................39
  146.    Appendix: Base 64 Encoding................................40
  147.  
  148. 1. Overview of Contents
  149.  
  150.    This document describes extensions of the Domain Name System (DNS)
  151.    protocol to support DNS security and public key distribution.  It
  152.    assumes that the reader is familiar with the Domain Name System,
  153.    particularly as described in RFCs 1033, 1034, and 1035.
  154.  
  155.    Section 2 provides an overview of the extensions and the key
  156.    distribution, data origin authentication, and transaction and request
  157.    security they provide.
  158.  
  159.    Section 3 discusses the KEY resource record, its structure, use in
  160.    DNS responses, and file representation.  These resource records
  161.    represent the public keys of entities named in the DNS and are used
  162.    for key distribution.
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Eastlake & Kaufman          Standards Track                     [Page 3]
  171.  
  172. RFC 2065                DNS Security Extensions             January 1997
  173.  
  174.  
  175.    Section 4 discusses the SIG digital signature resource record, its
  176.    structure, use in DNS responses, and file representation.  These
  177.    resource records are used to authenticate other resource records in
  178.    the DNS and optionally to authenticate DNS transactions and requests.
  179.  
  180.    Section 5 discusses the NXT resource record and its use in DNS
  181.    responses.  The NXT RR permits authenticated denial in the DNS of the
  182.    existence of a name or of a particular type for an existing name.
  183.  
  184.    Section 6 discusses how a resolver can be configured with a starting
  185.    key or keys and proceed to securely resolve DNS requests.
  186.    Interactions between resolvers and servers are discussed for all
  187.    combinations of security aware and security non-aware.  Two
  188.    additional query header bits are defined for signaling between
  189.    resolvers and servers.
  190.  
  191.    Section 7 reviews a variety of operational considerations including
  192.    key generation, lifetime, and storage.
  193.  
  194.    Section 8 defines levels of conformance for resolvers and servers.
  195.  
  196.    Section 9 provides a few paragraphs on overall security
  197.    considerations.
  198.  
  199.    An Appendix is provided that gives details of base 64 encoding which
  200.    is used in the file representation of some RR's defined in this
  201.    document.
  202.  
  203. 2.  Overview of the DNS Extensions
  204.  
  205.    The Domain Name System (DNS) protocol security extensions provide
  206.    three distinct services: key distribution as described in Section 2.2
  207.    below, data origin authentication as described in Section 2.3 below,
  208.    and transaction and request authentication, described in Section 2.4
  209.    below.
  210.  
  211.    Special considerations related to "time to live", CNAMEs, and
  212.    delegation points are also discussed in Section 2.3.
  213.  
  214. 2.1 Services Not Provided
  215.  
  216.    It is part of the design philosophy of the DNS that the data in it is
  217.    public and that the DNS gives the same answers to all inquirers.
  218.  
  219.    Following this philosophy, no attempt has been made to include any
  220.    sort of access control lists or other means to differentiate
  221.    inquirers.
  222.  
  223.  
  224.  
  225.  
  226. Eastlake & Kaufman          Standards Track                     [Page 4]
  227.  
  228. RFC 2065                DNS Security Extensions             January 1997
  229.  
  230.  
  231.    In addition, no effort has been made to provide for any
  232.    confidentiality for queries or responses.  (This service may be
  233.    available via IPSEC [RFC 1825].)
  234.  
  235. 2.2 Key Distribution
  236.  
  237.    Resource records (RRs) are defined to associate keys with DNS names.
  238.    This permits the DNS to be used as a public key distribution
  239.    mechanism in support of the DNS data origin authentication and other
  240.    security services.
  241.  
  242.    The syntax of a KEY resource record (RR) is described in Section 3.
  243.    It includes an algorithm identifier, the actual public key
  244.    parameters, and a variety of flags including those indicating the
  245.    type of entity the key is associated with and/or asserting that there
  246.    is no key associated with that entity.
  247.  
  248.    Under conditions described in Section 3.7, security aware DNS servers
  249.    will automatically attempt to return KEY resources as additional
  250.    information, along with those resource records actually requested, to
  251.    minimize the number of queries needed.
  252.  
  253. 2.3 Data Origin Authentication and Integrity
  254.  
  255.    Authentication is provided by associating with resource records in
  256.    the DNS cryptographically generated digital signatures.  Commonly,
  257.    there will be a single private key that signs for an entire zone. If
  258.    a security aware resolver reliably learns the public key of the zone,
  259.    it can verify, for signed data read from that zone, that it was
  260.    properly authorized and is reasonably current.  The expected
  261.    implementation is for the zone private key to be kept off-line and
  262.    used to re-sign all of the records in the zone periodically.
  263.  
  264.    This data origin authentication key belongs to the zone and not to
  265.    the servers that store copies of the data.  That means compromise of
  266.    a server or even all servers for a zone will not necessarily affect
  267.    the degree of assurance that a resolver has that it can determine
  268.    whether data is genuine.
  269.  
  270.    A resolver can learn the public key of a zone either by reading it
  271.    from DNS or by having it staticly configured.  To reliably learn the
  272.    public key by reading it from DNS, the key itself must be signed.
  273.    Thus, to provide a reasonable degree of security, the resolver must
  274.    be configured with at least the public key of one zone that it can
  275.    use to authenticate signatures.  From there, it can securely read the
  276.    public keys of other zones, if the intervening zones in the DNS tree
  277.    are secure and their signed keys accessible.  (It is in principle
  278.    more secure to have the resolver manually configured with the public
  279.  
  280.  
  281.  
  282. Eastlake & Kaufman          Standards Track                     [Page 5]
  283.  
  284. RFC 2065                DNS Security Extensions             January 1997
  285.  
  286.  
  287.    keys of multiple zones, since then the compromise of a single zone
  288.    would not permit the faking of information from other zones.  It is
  289.    also more administratively cumbersome, however, particularly when
  290.    public keys change.)
  291.  
  292.    Adding data origin authentication and integrity requires no change to
  293.    the "on-the-wire" DNS protocol beyond the addition of the signature
  294.    resource type and, as a practical matter, the key resource type
  295.    needed for key distribution. This service can be supported by
  296.    existing resolver and server implementations so long as they can
  297.    support the additional resource types (see Section 8). The one
  298.    exception is that CNAME referrals from a secure zone can not be
  299.    authenticated if they are from non-security aware servers (see
  300.    Section 2.3.5).
  301.  
  302.    If signatures are always separately retrieved and verified when
  303.    retrieving the information they authenticate, there will be more
  304.    trips to the server and performance will suffer.  To avoid this,
  305.    security aware servers mitigate that degradation by always attempting
  306.    to send the signature(s) needed.
  307.  
  308. 2.3.1 The SIG Resource Record
  309.  
  310.    The syntax of a SIG resource record (signature) is described in
  311.    Section 4.  It includes the type of the RR(s) being signed, the name
  312.    of the signer, the time at which the signature was created, the time
  313.    it expires (when it is no longer to be believed), its original time
  314.    to live (which may be longer than its current time to live but cannot
  315.    be shorter), the cryptographic algorithm in use, and the actual
  316.    signature.
  317.  
  318.    Every name in a secured zone will have associated with it at least
  319.    one SIG resource record for each resource type under that name except
  320.    for glue RRs and delgation point NS RRs.  A security aware server
  321.    supporting the performance enhanced version of the DNS protocol
  322.    security extensions will attempt to return, with RRs retrieved, the
  323.    corresponding SIGs.  If a server does not support the protocol, the
  324.    resolver must retrieve all the SIG records for a name and select the
  325.    one or ones that sign the resource record(s) that resolver is
  326.    interested in.
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Eastlake & Kaufman          Standards Track                     [Page 6]
  339.  
  340. RFC 2065                DNS Security Extensions             January 1997
  341.  
  342.  
  343. 2.3.2 Authenticating Name and Type Non-existence
  344.  
  345.    The above security mechanism provides only a way to sign existing RRs
  346.    in a zone.  "Data origin" authentication is not obviously provided
  347.    for the non-existence of a domain name in a zone or the non-existence
  348.    of a type for an existing name.  This gap is filled by the NXT RR
  349.    which authenticatably asserts a range of non-existent names in a zone
  350.    and the non-existence of types for the name just before that range.
  351.  
  352.    Section 5 below covers the NXT RR.
  353.  
  354. 2.3.3 Special Considerations With Time-to-Live
  355.  
  356.    A digital signature will fail to verify if any change has occurred to
  357.    the data between the time it was originally signed and the time the
  358.    signature is verified.  This conflicts with our desire to have the
  359.    time-to-live field tick down when resource records are cached.
  360.  
  361.    This could be avoided by leaving the time-to-live out of the digital
  362.    signature, but that would allow unscrupulous servers to set
  363.    arbitrarily long time to live values undetected.  Instead, we include
  364.    the "original" time-to-live in the signature and communicate that
  365.    data in addition to the current time-to-live. Unscrupulous servers
  366.    under this scheme can manipulate the time to live but a security
  367.    aware resolver will bound the TTL value it uses at the original
  368.    signed value.  Separately, signatures include a time signed and an
  369.    expiration time.  A resolver that knows the absolute time can
  370.    determine securely whether a signature has expired.  It is not
  371.    possible to rely solely on the signature expiration as a substitute
  372.    for the TTL, however, since the TTL is primarily a database
  373.    consistency mechanism and, in any case, non-security aware servers
  374.    that depend on TTL must still be supported.
  375.  
  376. 2.3.4 Special Considerations at Delegation Points
  377.  
  378.    DNS security would like to view each zone as a unit of data
  379.    completely under the control of the zone owner and signed by the
  380.    zone's key.  But the operational DNS views the leaf nodes in a zone,
  381.    which are also the apex nodes of a subzone (i.e., delegation points),
  382.    as "really" belonging to the subzone.  These nodes occur in two
  383.    master files and may have RRs signed by both the upper and lower
  384.    zone's keys.  A retrieval could get a mixture of these RRs and SIGs,
  385.    especially since one server could be serving both the zone above and
  386.    below a delegation point.
  387.  
  388.    In general, there must be a zone KEY RR for the subzone in the
  389.    superzone and the copy signed in the superzone is controlling.  For
  390.    all but one other RR type that should appearing in both the superzone
  391.  
  392.  
  393.  
  394. Eastlake & Kaufman          Standards Track                     [Page 7]
  395.  
  396. RFC 2065                DNS Security Extensions             January 1997
  397.  
  398.  
  399.    and subzone, the data from the subzone is more authoritative.  To
  400.    avoid conflicts, only the KEY RR in the superzone should be signed
  401.    and the NS and any A (glue) RRs should only be signed in the subzone.
  402.    The SOA and any other RRs that have the zone name as owner should
  403.    appear only in the subzone and thus are signed there. The NXT RR type
  404.    is an exceptional case that will always appear differently and
  405.    authoritatively in both the superzone and subzone, if both are
  406.    secure, as described in Section 5.
  407.  
  408. 2.3.5 Special Considerations with CNAME RRs
  409.  
  410.    There is a significant problem when security related RRs with the
  411.    same owner name as a CNAME RR are retrieved from a non-security-aware
  412.    server.  In particular, an initial retrieval for the CNAME or any
  413.    other type will not retrieve any associated signature, key, or NXT
  414.    RR. For types other than CNAME, it will retrieve that type at the
  415.    target name of the CNAME (or chain of CNAMEs) and will return the
  416.    CNAME as additional information.  In particular, a specific retrieval
  417.    for type SIG will not get the SIG, if any, at the original CNAME
  418.    domain name but rather a SIG at the target name.
  419.  
  420.    In general, security aware servers MUST be used to securely CNAME in
  421.    DNS.  Security aware servers must (1) allow KEY, SIG, and NXT RRs
  422.    along with CNAME RRs, (2) suppress CNAME processing on retrieval of
  423.    these types as well as on retrieval of the type CNAME, and (3)
  424.    automatically return SIG RRs authenticating the CNAME or CNAMEs
  425.    encountered in resolving a query.  This is a change from the previous
  426.    DNS standard which prohibited any other RR type at a node where a
  427.    CNAME RR was present.
  428.  
  429. 2.3.6 Signers Other Than The Zone
  430.  
  431.    There are two cases where a SIG resource record is signed by other
  432.    than the zone private key.  One is for support of dynamic update
  433.    where an entity is permitted to authenticate/update its own records.
  434.    The public key of the entity must be present in the DNS and be
  435.    appropriately signed but the other RR(s) may be signed with the
  436.    entity's key.  The other is for support of transaction and request
  437.    authentication as described in Section 2.4 immediately below.
  438.  
  439. 2.4 DNS Transaction and Request Authentication
  440.  
  441.    The data origin authentication service described above protects
  442.    retrieved resource records but provides no protection for DNS
  443.    requests or for message headers.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Eastlake & Kaufman          Standards Track                     [Page 8]
  451.  
  452. RFC 2065                DNS Security Extensions             January 1997
  453.  
  454.  
  455.    If header bits are falsely set by a server, there is little that can
  456.    be done.  However, it is possible to add transaction authentication.
  457.    Such authentication means that a resolver can be sure it is at least
  458.    getting messages from the server it thinks it queried, that the
  459.    response is from the query it sent, and that these messages have not
  460.    been diddled in transit.  This is accomplished by optionally adding a
  461.    special SIG resource record at the end of the reply which digitally
  462.    signs the concatenation of the server's response and the resolver's
  463.    query.
  464.  
  465.    Requests can also be authenticated by including a special SIG RR at
  466.    the end of the request.  Authenticating requests serves no function
  467.    in the current DNS and requests with a non-empty additional
  468.    information section are ignored by almost all current DNS servers.
  469.    However, this syntax for signing requests is defined in connection
  470.    with authenticating future secure dynamic update requests or the
  471.    like.
  472.  
  473.    The private keys used in transaction and request security belongs to
  474.    the host composing the request or reply message, not to the zone
  475.    involved.  The corresponding public key is normally stored in and
  476.    retrieved from the DNS.
  477.  
  478.    Because requests and replies are highly variable, message
  479.    authentication SIGs can not be pre-calculated.  Thus it will be
  480.    necessary to keep the private key on-line, for example in software or
  481.    in a directly connected piece of hardware.
  482.  
  483. 3. The KEY Resource Record
  484.  
  485.    The KEY resource record (RR) is used to document a key that is
  486.    associated with a Domain Name System (DNS) name.  It will be a public
  487.    key as only public keys are stored in the DNS.  This can be the
  488.    public key of a zone, a host or other end entity, or a user.  A KEY
  489.    RR is, like any other RR, authenticated by a SIG RR. Security aware
  490.    DNS implementations MUST be designed to handle at least two
  491.    simultaneously valid keys of the same type associated with a name.
  492.  
  493.    The type number for the KEY RR is 25.
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Eastlake & Kaufman          Standards Track                     [Page 9]
  507.  
  508. RFC 2065                DNS Security Extensions             January 1997
  509.  
  510.  
  511. 3.1 KEY RDATA format
  512.  
  513.    The RDATA for a KEY RR consists of flags, a protocol octet, the
  514.    algorithm number, and the public key itself.  The format is as
  515.    follows:
  516.  
  517.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  518.     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
  519.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  520.    |             flags             |    protocol   |   algorithm   |
  521.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  522.    |                                                               /
  523.    /                          public key                           /
  524.    /                                                               /
  525.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
  526.  
  527.    The meaning of the KEY RR owner name, flags, and protocol octet are
  528.    described in Sections 3.2, 3.3 and 3.4 below respectively.  The flags
  529.    and algorithm must be examined before any data following the
  530.    algorithm octet as they control the format and even whether there is
  531.    any following data.  The algorithm and public key fields are
  532.    described in Section 3.5.  The format of the public key is algorithm
  533.    dependent.
  534.  
  535. 3.2 Object Types, DNS Names, and Keys
  536.  
  537.    The public key in a KEY RR belongs to the object named in the owner
  538.    name.
  539.  
  540.    This DNS name may refer to up to three different categories of
  541.    things.  For example, dee.cybercash.com could be (1) a zone, (2) a
  542.    host or other end entity , and (3) the mapping into a DNS name of the
  543.    user or account dee@cybercash.com.  Thus, there are flags, as
  544.    described below, in the KEY RR to indicate with which of these roles
  545.    the owner name and public key are associated.  Note that an
  546.    appropriate zone KEY RR MUST occur at the apex node of a secure zone
  547.    and at every leaf node which is a delegation point (and thus the same
  548.    owner name as the apex of a subzone) within a secure zone.
  549.  
  550.    Although the same name can be used for up to all three of these
  551.    categories, such overloading of a name is discouraged.  It is also
  552.    possible to use the same key for different things with the same name
  553.    or even different names, but this is strongly discouraged.  In
  554.    particular, the use of a zone key as a non-zone key will usually
  555.    require that the corresponding private key be kept on line and
  556.    thereby become more vulnerable.
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Eastlake & Kaufman          Standards Track                    [Page 10]
  563.  
  564. RFC 2065                DNS Security Extensions             January 1997
  565.  
  566.  
  567.    In addition to the name type bits, there are additional flag bits
  568.    including the "type" field, "experimental" bit, "signatory" field,
  569.    etc., as described below.
  570.  
  571. 3.3 The KEY RR Flag Field
  572.  
  573.    In the "flags" field:
  574.  
  575.         Bit 0 and 1 are the key "type" field.  Bit 0 a one indicates
  576.    that use of the key is prohibited for authentication.  Bit 1 a one
  577.    indicates that use of the key is prohibited for confidentiality. If
  578.    this field is zero, then use of the key for authentication and/or
  579.    confidentiality is permitted. Note that DNS security makes use of
  580.    keys for authentication only. Confidentiality use flagging is
  581.    provided for use of keys in other protocols.  Implementations not
  582.    intended to support key distribution for confidentiality MAY require
  583.    that the confidentiality use prohibited bit be on for keys they
  584.    serve.  If both bits of this field are one, the "no key" value, there
  585.    is no key information and the RR stops after the algorithm octet.  By
  586.    the use of this "no key" value, a signed KEY RR can authenticatably
  587.    assert that, for example, a zone is not secured.
  588.  
  589.         Bit 2 is the "experimental" bit.  It is ignored if the type
  590.    field indicates "no key" and the following description assumes that
  591.    type field to be non-zero.  Keys may be associated with zones,
  592.    entities, or users for experimental, trial, or optional use, in which
  593.    case this bit will be one.  If this bit is a zero, it means that the
  594.    use or availability of security based on the key is "mandatory".
  595.    Thus, if this bit is off for a zone key, the zone should be assumed
  596.    secured by SIG RRs and any responses indicating the zone is not
  597.    secured should be considered bogus.  If this bit is a one for a host
  598.    or end entity, it might sometimes operate in a secure mode and at
  599.    other times operate without security.  The experimental bit, like all
  600.    other aspects of the KEY RR, is only effective if the KEY RR is
  601.    appropriately signed by a SIG RR.  The experimental bit must be zero
  602.    for safe secure operation and should only be a one for a minimal
  603.    transition period.
  604.  
  605.         Bits 3-4 are reserved and must be zero.
  606.  
  607.         Bit 5 on indicates that this is a key associated with a "user"
  608.    or "account" at an end entity, usually a host.  The coding of the
  609.    owner name is that used for the responsible individual mailbox in the
  610.    SOA and RP RRs: The owner name is the user name as the name of a node
  611.    under the entity name.  For example, "j.random_user" on
  612.    host.subdomain.domain could have a public key associated through a
  613.    KEY RR with name j\.random_user.host.subdomain.domain and the user
  614.    bit a one.  It could be used in an security protocol where
  615.  
  616.  
  617.  
  618. Eastlake & Kaufman          Standards Track                    [Page 11]
  619.  
  620. RFC 2065                DNS Security Extensions             January 1997
  621.  
  622.  
  623.    authentication of a user was desired.  This key might be useful in IP
  624.    or other security for a user level service such a telnet, ftp,
  625.    rlogin, etc.
  626.  
  627.         Bit 6 on indicates that this is a key associated with the non-
  628.    zone "entity" whose name is the RR owner name.  This will commonly be
  629.    a host but could, in some parts of the DNS tree, be some other type
  630.    of entity such as a telephone number [RFC 1530].  This is the public
  631.    key used in connection with the optional DNS transaction
  632.    authentication service if the owner name is a DNS server host.  It
  633.    could also be used in an IP-security protocol where authentication of
  634.    at the host, rather than user, level was desired, such as routing,
  635.    NTP, etc.
  636.  
  637.         Bit 7 is the "zone" bit and indicates that this is a zone key
  638.    for the zone whose name is the KEY RR owner name.  This is the public
  639.    key used for DNS data origin authentication.
  640.  
  641.         Bit 8 is reserved to be the IPSEC [RFC 1825] bit and indicates
  642.    that this key is valid for use in conjunction with that security
  643.    standard.  This key could be used in connection with secured
  644.    communication on behalf of an end entity or user whose name is the
  645.    owner name of the KEY RR if the entity or user bits are on.  The
  646.    presence of a KEY resource with the IPSEC and entity bits on and
  647.    experimental and no-key bits off is an assertion that the host speaks
  648.    IPSEC.
  649.  
  650.         Bit 9 is reserved to be the "email" bit and indicate that this
  651.    key is valid for use in conjunction with MIME security multiparts.
  652.    This key could be used in connection with secured communication on
  653.    behalf of an end entity or user whose name is the owner name of the
  654.    KEY RR if the entity or user bits are on.
  655.  
  656.         Bits 10-11 are reserved and must be zero.
  657.  
  658.         Bits 12-15 are the "signatory" field.  If non-zero, they
  659.    indicate that the key can validly sign RRs or updates of the same
  660.    name.  If the owner name is a wildcard, then RRs or updates with any
  661.    name which is in the wildcard's scope can be signed.  Fifteen
  662.    different non-zero values are possible for this field and any
  663.    differences in their meaning are reserved for definition in
  664.    connection with DNS dynamic update or other new DNS commands.  Zone
  665.    keys always have authority to sign any RRs in the zone regardless of
  666.    the value of this field.  The signatory field, like all other aspects
  667.    of the KEY RR, is only effective if the KEY RR is appropriately
  668.    signed by a SIG RR.
  669.  
  670.  
  671.  
  672.  
  673.  
  674. Eastlake & Kaufman          Standards Track                    [Page 12]
  675.  
  676. RFC 2065                DNS Security Extensions             January 1997
  677.  
  678.  
  679. 3.4 The Protocol Octet
  680.  
  681.    It is anticipated that some keys stored in DNS will be used in
  682.    conjunction with Internet protocols other than DNS (keys with zone
  683.    bit or signatory field non-zero) and IPSEC/email (keys with IPSEC
  684.    and/or email bit set).  The protocol octet is provided to indicate
  685.    that a key is valid for such use and, for end entity keys or the host
  686.    part of user keys, that the secure version of that protocol is
  687.    implemented on that entity or host.
  688.  
  689.    Values between 1 and 191 decimal inclusive are available for
  690.    assignment by IANA for such protocols.  The 63 values between 192 and
  691.    254 inclusive will not be assigned to a specific protocol and are
  692.    available for experimental use under bilateral agreement. Value 0
  693.    indicates, for a particular key, that it is not valid for any
  694.    particular additional protocol beyond those indicated in the flag
  695.    field. And value 255 indicates that the key is valid for all assigned
  696.    protocols (those in the 1 to 191 range).
  697.  
  698.    It is intended that new uses of DNS stored keys would initially be
  699.    implemented, and operational experience gained, using the
  700.    experimental range of the protocol octet.  If demand for widespread
  701.    deployment for the indefinite future warrants, a value in the
  702.    assigned range would then be designated for the protocol.  Finally,
  703.    (1) should the protocol become so widespread in conjunction with
  704.    other protocols and with which it shares key values that duplicate
  705.    RRs are a serious burden and (2) should the protocol provide
  706.    substantial facilities not available in any protocol for which a
  707.    flags field bit has been allocated, then one of the remaining flag
  708.    field bits may be allocated to the protocol. When such a bit has been
  709.    allocated, a key can be simultaneously indicated as valid for that
  710.    protocol and the entity or host can be simultaneously flagged as
  711.    implementing the secure version of that protocol, along with other
  712.    protocols for which flag field bits have been assigned.
  713.  
  714. 3.5 The KEY Algorithm Number and the MD5/RSA Algorithm
  715.  
  716.    This octet is the key algorithm parallel to the same field for the
  717.    SIG resource.  The MD5/RSA algorithm described in this document is
  718.    number 1. Numbers 2 through 252 are available for assignment should
  719.    sufficient reason arise.  However, the designation of a new algorithm
  720.    could have a major impact on interoperability and requires an IETF
  721.    standards action.  Number 254 is reserved for private use and will
  722.    never be assigned a specific algorithm.  For number 254, the public
  723.    key area shown in the packet diagram above will actually begin with a
  724.    length byte followed by an Object Identifier (OID) of that length.
  725.    The OID indicates the private algorithm in use and the remainder of
  726.    the area is whatever is required by that algorithm. Number 253 is
  727.  
  728.  
  729.  
  730. Eastlake & Kaufman          Standards Track                    [Page 13]
  731.  
  732. RFC 2065                DNS Security Extensions             January 1997
  733.  
  734.  
  735.    reserved as the "expiration date algorithm" for use where the
  736.    expiration date or other labeling fields of SIGs are desired without
  737.    any actual security. It is anticipated that this algorithm will only
  738.    be used in connection with some modes of DNS dynamic update.  For
  739.    number 253, the public key area is null. Values 0 and 255 are
  740.    reserved.
  741.  
  742.    If the type field does not have the "no key" value and the algorithm
  743.    field is 1, indicating the MD5/RSA algorithm, the public key field is
  744.    structured as follows:
  745.  
  746.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  747.     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
  748.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  749.    | pub exp length|        public key exponent                    /
  750.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  751.    |                                                               /
  752.    +-                           modulus                            /
  753.    |                                                               /
  754.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-/
  755.  
  756.    To promote interoperability, the exponent and modulus are each
  757.    limited to 2552 bits in length.  The public key exponent is a
  758.    variable length unsigned integer.  Its length in octets is
  759.    represented as one octet if it is in the range of 1 to 255 and by a
  760.    zero octet followed by a two octet unsigned length if it is longer
  761.    than 255 bytes.  The public key modulus field is a multiprecision
  762.    unsigned integer.  The length of the modulus can be determined from
  763.    the RDLENGTH and the preceding RDATA fields including the exponent.
  764.    Leading zero bytes are prohibited in the exponent and modulus.
  765.  
  766. 3.6 Interaction of Flags, Algorithm, and Protocol Bytes
  767.  
  768.    Various combinations of the no-key type value, algorithm byte,
  769.    protocol byte, and any protocol indicating flags (such as the
  770.    reserved IPSEC flag) are possible.  (Note that the zone flag bit
  771.    being on or the signatory field being non-zero is effectively a DNS
  772.    protocol flag on.)  The meaning of these combinations is indicated
  773.    below:
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786. Eastlake & Kaufman          Standards Track                    [Page 14]
  787.  
  788. RFC 2065                DNS Security Extensions             January 1997
  789.  
  790.  
  791.       NK = no key type value
  792.       AL = algorithm byte
  793.       PR = protocols indicated by protocol byte or protocol flags
  794.  
  795.       x represents any valid non-zero value(s).
  796.  
  797.        AL  PR   NK  Meaning
  798.         0   0   0   Illegal, claims key but has bad algorithm field.
  799.         0   0   1   Specifies total lack of security for owner.
  800.         0   x   0   Illegal, claims key but has bad algorithm field.
  801.         0   x   1   Specified protocols insecure, others may be secure.
  802.         x   0   0   Useless.  Gives key but no protocols to use it.
  803.         x   0   1   Useless.  Denies key but for no protocols.
  804.         x   x   0   Specifies key for protocols and asserts that
  805.                       those protocols are implemented with security.
  806.         x   x   1   Algorithm not understood for protocol.
  807.  
  808.       (remember, in reference to the above table, that a protocol
  809.        byte of 255 means all protocols with protocol byte values
  810.        assigned)
  811.  
  812. 3.7 KEY RRs in the Construction of Responses
  813.  
  814.    An explicit request for KEY RRs does not cause any special additional
  815.    information processing except, of course, for the corresponding SIG
  816.    RR from a security aware server.
  817.  
  818.    Security aware DNS servers MUST include KEY RRs as additional
  819.    information in responses where appropriate including the following:
  820.  
  821.    (1) On the retrieval of NS RRs, the zone key KEY RR(s) for the zone
  822.    served by these name servers MUST be included as additional
  823.    information if space is avilable.  There will always be at least one
  824.    such KEY RR in a secure zone, even if it has the no-key type value to
  825.    indicate that the subzone is insecure.  If not all additional
  826.    information will fit, the KEY RR(s) have higher priority than type A
  827.    or AAAA glue RRs.  If such a KEY RR does not fit on a retrieval, the
  828.    retrieval must be considered truncated.
  829.  
  830.    (2) On retrieval of type A or AAAA RRs, the end entity KEY RR(s) MUST
  831.    be included if space is available.  On inclusion of A or AAAA RRs as
  832.    additional information, their KEY RRs will also be included but with
  833.    lower priority than the relevant A or AAAA RRs.
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Eastlake & Kaufman          Standards Track                    [Page 15]
  843.  
  844. RFC 2065                DNS Security Extensions             January 1997
  845.  
  846.  
  847. 3.8 File Representation of KEY RRs
  848.  
  849.    KEY RRs may appear as lines in a zone data master file.
  850.  
  851.    The flag field, protocol, and algorithm number octets are then
  852.    represented as unsigned integers.  Note that if the type field has
  853.    the "no key" value or the algorithm specified is 253, nothing appears
  854.    after the algorithm octet.
  855.  
  856.    The remaining public key portion is represented in base 64 (see
  857.    Appendix) and may be divided up into any number of white space
  858.    separated substrings, down to single base 64 digits, which are
  859.    concatenated to obtain the full signature.  These substrings can span
  860.    lines using the standard parenthesis.
  861.  
  862.    Note that the public key may have internal sub-fields but these do
  863.    not appear in the master file representation.  For example, with
  864.    algorithm 1 there is a public exponent size, then a public exponent,
  865.    and then a modulus.  With algorithm 254, there will be an OID size,
  866.    an OID, and algorithm dependent information. But in both cases only a
  867.    single logical base 64 string will appear in the master file.
  868.  
  869. 4. The SIG Resource Record
  870.  
  871.    The SIG or "signature" resource record (RR) is the fundamental way
  872.    that data is authenticated in the secure Domain Name System (DNS). As
  873.    such it is the heart of the security provided.
  874.  
  875.    The SIG RR unforgably authenticates other RRs of a particular type,
  876.    class, and name and binds them to a time interval and the signer's
  877.    domain name.  This is done using cryptographic techniques and the
  878.    signer's private key.  The signer is frequently the owner of the zone
  879.    from which the RR originated.
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Eastlake & Kaufman          Standards Track                    [Page 16]
  899.  
  900. RFC 2065                DNS Security Extensions             January 1997
  901.  
  902.  
  903. 4.1 SIG RDATA Format
  904.  
  905.    The RDATA portion of a SIG RR is as shown below.  The integrity of
  906.    the RDATA information is protected by the signature field.
  907.  
  908.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  909.     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
  910.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  911.    |        type covered           |  algorithm    |     labels    |
  912.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  913.    |                         original TTL                          |
  914.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  915.    |                      signature expiration                     |
  916.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  917.    |                         time signed                           |
  918.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  919.    |         key footprint         |                               /
  920.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+         signer's name         /
  921.    /                                                               /
  922.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  923.    |                                                               /
  924.    +-                          signature                           /
  925.    /                                                               /
  926.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  927.  
  928.    The value of the SIG RR type is 24.
  929.  
  930.    The "type covered" is the type of the other RRs covered by this SIG.
  931.  
  932.    The algorithm number is an octet specifying the digital signature
  933.    algorithm used parallel to the algorithm octet for the KEY RR.  The
  934.    MD5/RSA algorithm described in this document is number 1.  Numbers 2
  935.    through 252 are available for assignment should sufficient reason
  936.    arise to allocate them.  However, the designation of a new algorithm
  937.    could have a major impact on the interoperability of the global DNS
  938.    system and requires an IETF standards action.  Number 254 is reserved
  939.    for private use and will not be assigned a specific algorithm.  For
  940.    number 254, the "signature" area shown above will actually begin with
  941.    a length byte followed by an Object Identifier (OID) of that length.
  942.    The OID indicates the private algorithm in use and the remainder of
  943.    the area is whatever is required by that algorithm.  Number 253,
  944.    known as the "expiration date algorithm", is used when the expiration
  945.    date or other non-signature fields of the SIG are desired without any
  946.    actual security.  It is anticipated that this algorithm will only be
  947.    used in connection with some modes of DNS dynamic update.  For number
  948.    253, the signature field will be null.  Values 0 and 255 are
  949.    reserved.
  950.  
  951.  
  952.  
  953.  
  954. Eastlake & Kaufman          Standards Track                    [Page 17]
  955.  
  956. RFC 2065                DNS Security Extensions             January 1997
  957.  
  958.  
  959.    The "labels" octet is an unsigned count of how many labels there are
  960.    in the original SIG RR owner name not counting the null label for
  961.    root and not counting any initial "*" for a wildcard.  If a secured
  962.    retrieval is the result of wild card substitution, it is necessary
  963.    for the resolver to use the original form of the name in verifying
  964.    the digital signature.  This field helps optimize the determination
  965.    of the original form thus reducing the effort in authenticating
  966.    signed data.
  967.  
  968.    If, on retrieval, the RR appears to have a longer name than indicated
  969.    by "labels", the resolver can tell it is the result of wildcard
  970.    substitution.  If the RR owner name appears to be shorter than the
  971.    labels count, the SIG RR must be considered corrupt and ignored.  The
  972.    maximum number of labels allowed in the current DNS is 127 but the
  973.    entire octet is reserved and would be required should DNS names ever
  974.    be expanded to 255 labels.  The following table gives some examples.
  975.    The value of "labels" is at the top, the retrieved owner name on the
  976.    left, and the table entry is the name to use in signature
  977.    verification except that "bad" means the RR is corrupt.
  978.  
  979.         labels= |  0  |   1  |    2   |      3   |      4   |
  980.         --------+-----+------+--------+----------+----------+
  981.                .|   . | bad  |  bad   |    bad   |    bad   |
  982.               d.|  *. |   d. |  bad   |    bad   |    bad   |
  983.             c.d.|  *. | *.d. |   c.d. |    bad   |    bad   |
  984.           b.c.d.|  *. | *.d. | *.c.d. |   b.c.d. |    bad   |
  985.         a.b.c.d.|  *. | *.d. | *.c.d. | *.b.c.d. | a.b.c.d. |
  986.  
  987.    The "original TTL" field is included in the RDATA portion to avoid
  988.    (1) authentication problems that caching servers would otherwise
  989.    cause by decrementing the real TTL field and (2) security problems
  990.    that unscrupulous servers could otherwise cause by manipulating the
  991.    real TTL field.  This original TTL is protected by the signature
  992.    while the current TTL field is not.
  993.  
  994.    NOTE:  The "original TTL" must be restored into the covered RRs when
  995.    the signature is verified.  This implies that all RRs for a
  996.    particular type, name, and class must have the same TTL to start
  997.    with.
  998.  
  999.    The SIG is valid until the "signature expiration" time which is an
  1000.    unsigned number of seconds since the start of 1 January 1970, GMT,
  1001.    ignoring leap seconds.  (See also Section 4.4.)  SIG RRs should not
  1002.    have a date signed significantly in the future.  To prevent
  1003.    misordering of network requests to update a zone dynamically,
  1004.    monotonically increasing "time signed" dates may be necessary.
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Eastlake & Kaufman          Standards Track                    [Page 18]
  1011.  
  1012. RFC 2065                DNS Security Extensions             January 1997
  1013.  
  1014.  
  1015.    The "time signed" field is an unsigned number of seconds since the
  1016.    start of 1 January 1970, GMT, ignoring leap seconds.
  1017.  
  1018.    A SIG RR with an expiration date before the time signed must be
  1019.    considered corrupt and ignored.
  1020.  
  1021.    The "key footprint" is a 16 bit quantity that is used to help
  1022.    efficiently select between multiple keys which may be applicable and
  1023.    as a quick check that a public key about to be used for the
  1024.    computationally expensive effort to check the signature is possibly
  1025.    valid.  Its exact meaning is algorithm dependent.  For the MD5/RSA
  1026.    algorithm, it is the next to the bottom two octets of the public key
  1027.    modulus needed to decode the signature field.  That is to say, the
  1028.    most significant 16 of the lest significant 24 bits of the modulus in
  1029.    network order.
  1030.  
  1031.    The "signer's name" field is the domain name of the signer generating
  1032.    the SIG RR.  This is the owner of the public KEY RR that can be used
  1033.    to verify the signature.  It is frequently the zone which contained
  1034.    the RR(s) being authenticated.  The signer's name may be compressed
  1035.    with standard DNS name compression when being transmitted over the
  1036.    network.
  1037.  
  1038.    The structure of the "signature" field is described below.
  1039.  
  1040. 4.1.1 Signature Data
  1041.  
  1042.    Except for algorithm number 253 where it is null, the actual
  1043.    signature portion of the SIG RR binds the other RDATA fields to all
  1044.    of the "type covered" RRs with that owner name and class.  These
  1045.    covered RRs are thereby authenticated.  To accomplish this, a data
  1046.    sequence is constructed as follows:
  1047.  
  1048.            data = RDATA | RR(s)...
  1049.  
  1050.    where "|" is concatenation, RDATA is all the RDATA fields in the SIG
  1051.    RR itself before and not including the signature, and RR(s) are all
  1052.    the RR(s) of the type covered with the same owner name and class as
  1053.    the SIG RR in canonical form and order.  How this data sequence is
  1054.    processed into the signature is algorithm dependent.
  1055.  
  1056.    For purposes of DNS security, the canonical form for an RR is the RR
  1057.    with domain names (1) fully expanded (no name compression via
  1058.    pointers), (2) all domain name letters set to lower case, and (3) the
  1059.    original TTL substituted for the current TTL.
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Eastlake & Kaufman          Standards Track                    [Page 19]
  1067.  
  1068. RFC 2065                DNS Security Extensions             January 1997
  1069.  
  1070.  
  1071.    For purposes of DNS security, the canonical order for RRs is to sort
  1072.    them in ascending order by name, considering labels as a left
  1073.    justified unsigned octet sequence in network (transmission) order
  1074.    where a missing octet sorts before a zero octet.  (See also ordering
  1075.    discussion in Section 5.1.)  Within any particular name they are
  1076.    similarly sorted by type and then RDATA as a left justified unsigned
  1077.    octet sequence. EXCEPT that the type SIG RR(s) covering any
  1078.    particular type appear immediately after the other RRs of that type.
  1079.    (This special consideration for SIG RR(s) in ordering really only
  1080.    applies to calculating the AXFR SIG RR as explained in section 4.1.3
  1081.    below.)  Thus if at name a.b there are two A RRs and one KEY RR,
  1082.    their order with SIGs for concatenating the "data" to be signed would
  1083.    be as follows:
  1084.  
  1085.            a.b.  A ....
  1086.            a.b.  A ....
  1087.            a.b.  SIG A ...
  1088.            a.b.  KEY ...
  1089.            a.b.  SIG KEY ...
  1090.  
  1091.    SIGs covering type ANY should not be included in a zone.
  1092.  
  1093. 4.1.2 MD5/RSA Algorithm Signature Calculation
  1094.  
  1095.    For the MD5/RSA algorithm, the signature is as follows
  1096.  
  1097.       hash = MD5 ( data )
  1098.  
  1099.       signature = ( 01 | FF* | 00 | prefix | hash ) ** e (mod n)
  1100.  
  1101.    where MD5 is the message digest algorithm documented in RFC 1321, "|"
  1102.    is concatenation, "e" is the private key exponent of the signer, and
  1103.    "n" is the modulus of the signer's public key.  01, FF, and 00 are
  1104.    fixed octets of the corresponding hexadecimal value. "prefix" is the
  1105.    ASN.1 BER MD5 algorithm designator prefix specified in PKCS1, that
  1106.    is,
  1107.            hex 3020300c06082a864886f70d020505000410 [NETSEC].
  1108.    This prefix is included to make it easier to use RSAREF or similar
  1109.    packages.  The FF octet is repeated the maximum number of times such
  1110.    that the value of the quantity being exponentiated is one octet
  1111.    shorter than the value of n.
  1112.  
  1113.    (The above specifications are identical to the corresponding part of
  1114.    Public Key Cryptographic Standard #1 [PKCS1].)
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Eastlake & Kaufman          Standards Track                    [Page 20]
  1123.  
  1124. RFC 2065                DNS Security Extensions             January 1997
  1125.  
  1126.  
  1127.    The size of n, including most and least significant bits (which will
  1128.    be 1) SHALL be not less than 512 bits and not more than 2552 bits.  n
  1129.    and e SHOULD be chosen such that the public exponent is small.
  1130.  
  1131.    Leading zeros bytes are not permitted in the MD5/RSA algorithm
  1132.    signature.
  1133.  
  1134.    A public exponent of 3 minimizes the effort needed to decode a
  1135.    signature.  Use of 3 as the public exponent may be weak for
  1136.    confidentiality uses since, if the same data can be collected
  1137.    encrypted under three different keys with an exponent of 3 then,
  1138.    using the Chinese Remainder Theorem, the original plain text can be
  1139.    easily recovered.  This weakness is not significant for DNS because
  1140.    we seek only authentication, not confidentiality.
  1141.  
  1142. 4.1.3 Zone Transfer (AXFR) SIG
  1143.  
  1144.    The above SIG mechanisms assure the authentication of all zone signed
  1145.    RRs of a particular name, class and type.  However, to efficiently
  1146.    assure the completeness and security of zone transfers, a SIG RR
  1147.    owned by the zone name must be created with a type covered of AXFR
  1148.    that covers all zone signed RRs in the zone and their zone SIGs but
  1149.    not the SIG AXFR itself.  The RRs are ordered and concatenated for
  1150.    hashing as described in Section 4.1.1.  (See also ordering discussion
  1151.    in Section 5.1.)
  1152.  
  1153.    The AXFR SIG must be calculated last of all zone key signed SIGs in
  1154.    the zone.  In effect, when signing the zone, you order, as described
  1155.    above, all RRs to be signed by the zone, and all associated glue RRs
  1156.    and delegation point NS RRs.  You can then make one pass inserting
  1157.    all the zone SIGs.  As you proceed you hash RRs to be signed into
  1158.    both an RRset hash and the zone hash.  When the name or type changes
  1159.    you calculate and insert the RRset zone SIG, clear the RRset hash,
  1160.    and hash that SIG into the zone hash (note that glue RRs and
  1161.    delegation point NSs are not zone signed but zone apex NSs are).
  1162.    When you have finished processing all the starting RRs as described
  1163.    above, you can then use the cumulative zone hash RR to calculate and
  1164.    insert an AXFR SIG covering the zone.  Of course any computational
  1165.    technique producing the same results as above is permitted.
  1166.  
  1167.    The AXFR SIG really belongs to the zone as a whole, not to the zone
  1168.    name.  Although it should be correct for the zone name, the labels
  1169.    field of an AXFR SIG is otherwise meaningless. The AXFR SIG is only
  1170.    retrieved as part of a zone transfer.  After validation of the AXFR
  1171.    SIG, the zone MAY be considered valid without verification of the
  1172.    internal zone signed SIGs in the zone; however, any RRs authenticated
  1173.    by SIGs signed by entity keys or the like MUST still be validated.
  1174.    The AXFR SIG SHOULD be transmitted first in a zone transfer so the
  1175.  
  1176.  
  1177.  
  1178. Eastlake & Kaufman          Standards Track                    [Page 21]
  1179.  
  1180. RFC 2065                DNS Security Extensions             January 1997
  1181.  
  1182.  
  1183.    receiver can tell immediately that they may be able to avoid
  1184.    verifying other zone signed SIGs.
  1185.  
  1186.    RRs which are authenticated by a dynamic update key and not by the
  1187.    zone key (see Section 3.2) are not included in the AXFR SIG. They may
  1188.    originate in the network and might not, in general, be migrated to
  1189.    the recommended off line zone signing procedure (see Section 7.2).
  1190.    Thus, such RRs are not directly signed by the zone, are not included
  1191.    in the AXFR SIG, and are protected against omission from zone
  1192.    transfers only to the extent that the server and communication can be
  1193.    trusted.
  1194.  
  1195. 4.1.4 Transaction and Request SIGs
  1196.  
  1197.    A response message from a security aware server may optionally
  1198.    contain a special SIG as the last item in the additional information
  1199.    section to authenticate the transaction.
  1200.  
  1201.    This SIG has a "type covered" field of zero, which is not a valid RR
  1202.    type.  It is calculated by using a "data" (see Section 4.1.2) of the
  1203.    entire preceding DNS reply message, including DNS header but not the
  1204.    IP header, concatenated with the entire DNS query message that
  1205.    produced this response, including the query's DNS header but not its
  1206.    IP header.  That is
  1207.  
  1208.         data = full response (less final transaction SIG) | full query
  1209.  
  1210.    Verification of the transaction SIG (which is signed by the server
  1211.    host key, not the zone key) by the requesting resolver shows that the
  1212.    query and response were not tampered with in transit, that the
  1213.    response corresponds to the intended query, and that the response
  1214.    comes from the queried server.
  1215.  
  1216.    A DNS request may be optionally signed by including one or more SIGs
  1217.    at the end of the query. Such SIGs are identified by having a "type
  1218.    covered" field of zero. They sign the preceding DNS request message
  1219.    including DNS header but not including the IP header or at the
  1220.    begining or any preceding request SIGs at the end. Such request SIGs
  1221.    are included in the "data" used to form any optional response
  1222.    transaction SIG.
  1223.  
  1224.    WARNING: Request SIGs are unnecessary for currently defined queries
  1225.    and will cause almost all existing DNS servers to completely ignore a
  1226.    query.  However, such SIGs may be needed to authenticate future DNS
  1227.    secure dynamic update or other requests.
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Eastlake & Kaufman          Standards Track                    [Page 22]
  1235.  
  1236. RFC 2065                DNS Security Extensions             January 1997
  1237.  
  1238.  
  1239. 4.2 SIG RRs in the Construction of Responses
  1240.  
  1241.    Security aware DNS servers MUST, for every authoritative RR the query
  1242.    will return, attempt to send the available SIG RRs which authenticate
  1243.    the requested RR.  The following rules apply to the inclusion of SIG
  1244.    RRs in responses:
  1245.  
  1246.    1. when an RR set is placed in a response, its SIG RR has a higher
  1247.       priority for inclusion than other additional RRs that may need to
  1248.       be included.  If space does not permit its inclusion, the response
  1249.       MUST be considered truncated except as provided in 2 below.
  1250.  
  1251.    2. when a SIG RR is present in the zone for an additional information
  1252.       section RR, the response MUST NOT be considered truncated merely
  1253.       because space does not permit the inclusion of its SIG RR.
  1254.  
  1255.    3. SIGs to authenticate non-authoritative data (glue records and NS
  1256.       RRs for subzones) are unnecessary and MUST NOT be sent.  (Note
  1257.       that KEYs for subzones are controlling in a superzone so the
  1258.       superzone's signature on the KEY MUST be included (unless the KEY
  1259.       was additional information and the SIG did not fit).)
  1260.  
  1261.    4. If a SIG covers any RR that would be in the answer section of the
  1262.       response, its automatic inclusion MUST be the answer section.  If
  1263.       it covers an RR that would appear in the authority section, its
  1264.       automatic inclusion MUST be in the authority section.  If it
  1265.       covers an RR that would appear in the additional information
  1266.       section it MUST appear in the additional information section.
  1267.       This is a change in the existing standard which contemplates only
  1268.       NS and SOA RRs in the authority section.
  1269.  
  1270.    5. Optionally, DNS transactions may be authenticated by a SIG RR at
  1271.       the end of the response in the additional information section
  1272.       (Section 4.1.4).  Such SIG RRs are signed by the DNS server
  1273.       originating the response.  Although the signer field MUST be the
  1274.       name of the originating server host, the owner name, class, TTL,
  1275.       and original TTL, are meaningless.  The class and TTL fields
  1276.       SHOULD be zero.  To conserve space, the owner name SHOULD be root
  1277.       (a single zero octet).  If transaction authentication is desired,
  1278.       that SIG RR must be considered higher priority for inclusion than
  1279.       any other RR in the response.
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Eastlake & Kaufman          Standards Track                    [Page 23]
  1291.  
  1292. RFC 2065                DNS Security Extensions             January 1997
  1293.  
  1294.  
  1295. 4.3 Processing Responses and SIG RRs
  1296.  
  1297.    The following rules apply to the processing of SIG RRs included in a
  1298.    response:
  1299.  
  1300.    1. a security aware resolver that receives a response from what it
  1301.       believes to be a security aware server via a secure communication
  1302.       with the AD bit (see Section 6.1) set, MAY choose to accept the
  1303.       RRs as received without verifying the zone SIG RRs.
  1304.  
  1305.    2. in other cases, a security aware resolver SHOULD verify the SIG
  1306.       RRs for the RRs of interest.  This may involve initiating
  1307.       additional queries for SIG or KEY RRs, especially in the case of
  1308.       getting a response from an insecure server.  (As explained in 4.2
  1309.       above, it will not be possible to secure CNAMEs being served up by
  1310.       non-secure resolvers.)
  1311.  
  1312.       NOTE: Implementers might expect the above SHOULD to be a MUST.
  1313.       However, local policy or the calling application may not require
  1314.       the security services.
  1315.  
  1316.    3. If SIG RRs are received in response to a user query explicitly
  1317.       specifying the SIG type, no special processing is required.
  1318.  
  1319.    If the message does not pass reasonable checks or the SIG does not
  1320.    check against the signed RRs, the SIG RR is invalid and should be
  1321.    ignored.  If all of the SIG RR(s) purporting to authenticate a set of
  1322.    RRs are invalid, then the set of RR(s) is not authenticated.
  1323.  
  1324.    If the SIG RR is the last RR in a response in the additional
  1325.    information section and has a type covered of zero, it is a
  1326.    transaction signature of the response and the query that produced the
  1327.    response.  It MAY be optionally checked and the message rejected if
  1328.    the checks fail.  But even if the checks succeed, such a transaction
  1329.    authentication SIG does NOT authenticate any RRs in the message.
  1330.    Only a proper SIG RR signed by the zone or a key tracing its
  1331.    authority to the zone or to static resolver configuration can
  1332.    authenticate RRs.  If a resolver does not implement transaction
  1333.    and/or request SIGs, it MUST ignore them without error.
  1334.  
  1335.    If all reasonable checks indicate that the SIG RR is valid then RRs
  1336.    verified by it should be considered authenticated.
  1337.  
  1338. 4.4 Signature Expiration, TTLs, and Validity
  1339.  
  1340.    Security aware servers must not consider SIG RRs to authenticate
  1341.    anything after their expiration time and not consider any RR to be
  1342.    authenticated after its signatures have expired.  Within that
  1343.  
  1344.  
  1345.  
  1346. Eastlake & Kaufman          Standards Track                    [Page 24]
  1347.  
  1348. RFC 2065                DNS Security Extensions             January 1997
  1349.  
  1350.  
  1351.    constraint, servers should continue to follow DNS TTL aging.  Thus
  1352.    authoritative servers should continue to follow the zone refresh and
  1353.    expire parameters and a non-authoritative server should count down
  1354.    the TTL and discard RRs when the TTL is zero.  In addition, when RRs
  1355.    are transmitted in a query response, the TTL should be trimmed so
  1356.    that current time plus the TTL does not extend beyond the signature
  1357.    expiration time.  Thus, in general, the TTL on an transmitted RR
  1358.    would be
  1359.  
  1360.          min(sigExpTim,max(zoneMinTTL,min(originalTTL,currentTTL)))
  1361.  
  1362. 4.5 File Representation of SIG RRs
  1363.  
  1364.    A SIG RR can be represented as a single logical line in a zone data
  1365.    file [RFC1033] but there are some special considerations as described
  1366.    below.  (It does not make sense to include a transaction or request
  1367.    authenticating SIG RR in a file as they are a transient
  1368.    authentication that covers data including an ephemeral transaction
  1369.    number and so must be calculated in real time.)
  1370.  
  1371.    There is no particular problem with the signer, covered type, and
  1372.    times.  The time fields appears in the form YYYYMMDDHHMMSS where YYYY
  1373.    is the year, the first MM is the month number (01-12), DD is the day
  1374.    of the month (01-31), HH is the hour in 24 hours notation (00-23),
  1375.    the second MM is the minute (00-59), and SS is the second (00-59).
  1376.  
  1377.    The original TTL and algorithm fields appear as unsigned integers.
  1378.  
  1379.    If the original TTL, which applies to the type signed, is the same as
  1380.    the TTL of the SIG RR itself, it may be omitted.  The date field
  1381.    which follows it is larger than the maximum possible TTL so there is
  1382.    no ambiguity.
  1383.  
  1384.    The "labels" field does not appear in the file representation as it
  1385.    can be calculated from the owner name.
  1386.  
  1387.    The key footprint appears as an unsigned decimal number.
  1388.  
  1389.    However, the signature itself can be very long.  It is the last data
  1390.    field and is represented in base 64 (see Appendix) and may be divided
  1391.    up into any number of white space separated substrings, down to
  1392.    single base 64 digits, which are concatenated to obtain the full
  1393.    signature.  These substrings can be split between lines using the
  1394.    standard parenthesis.
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Eastlake & Kaufman          Standards Track                    [Page 25]
  1403.  
  1404. RFC 2065                DNS Security Extensions             January 1997
  1405.  
  1406.  
  1407. 5. Non-existent Names and Types
  1408.  
  1409.    The SIG RR mechanism described in Section 4 above provides strong
  1410.    authentication of RRs that exist in a zone.  But is it not clear
  1411.    above how to authenticatably deny the existence of a name in a zone
  1412.    or a type for an existent name.
  1413.  
  1414.    The nonexistence of a name in a zone is indicated by the NXT ("next")
  1415.    RR for a name interval containing the nonexistent name. A NXT RR and
  1416.    its SIG are returned in the authority section, along with the error,
  1417.    if the server is security aware.  The same is true for a non-existent
  1418.    type under an existing name.  This is a change in the existing
  1419.    standard which contemplates only NS and SOA RRs in the authority
  1420.    section. NXT RRs will also be returned if an explicit query is made
  1421.    for the NXT type.
  1422.  
  1423.    The existence of a complete set of NXT records in a zone means that
  1424.    any query for any name and any type to a security aware server
  1425.    serving the zone will always result in an reply containing at least
  1426.    one signed RR.
  1427.  
  1428.    NXT RRs do not appear in zone master files since they can be derived
  1429.    from the rest of the zone.
  1430.  
  1431. 5.1 The NXT Resource Record
  1432.  
  1433.    The NXT resource record is used to securely indicate that RRs with an
  1434.    owner name in a certain name interval do not exist in a zone and to
  1435.    indicate what zone signed RR types are present for an existing name.
  1436.  
  1437.    The owner name of the NXT RR is an existing name in the zone.  It's
  1438.    RDATA is a "next" name and a type bit map. The presence of the NXT RR
  1439.    means that generally no name between its owner name and the name in
  1440.    its RDATA area exists and that no other zone signed types exist under
  1441.    its owner name.  This implies a canonical ordering of all domain
  1442.    names in a zone.
  1443.  
  1444.    The ordering is to sort labels as unsigned left justified octet
  1445.    strings where the absence of a octet sorts before a zero value octet
  1446.    and upper case letters are treated as lower case letters.  Names are
  1447.    then sorted by sorting on the highest level label and then, within
  1448.    those names with the same highest level label by the next lower
  1449.    label, etc. down to leaf node labels.  Since we are talking about a
  1450.    zone, the zone name itself always exists and all other names are the
  1451.    zone name with some prefix of lower level labels.  Thus the zone name
  1452.    itself always sorts first.
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Eastlake & Kaufman          Standards Track                    [Page 26]
  1459.  
  1460. RFC 2065                DNS Security Extensions             January 1997
  1461.  
  1462.  
  1463.    There is a potential problem with the last NXT in a zone as it wants
  1464.    to have an owner name which is the last existing name in canonical
  1465.    order, which is easy, but it is not obvious what name to put in its
  1466.    RDATA to indicate the entire remainder of the name space.  This is
  1467.    handled by treating the name space as circular and putting the zone
  1468.    name in the RDATA of the last NXT in a zone.
  1469.  
  1470.    There are special considerations due to interaction with wildcards as
  1471.    explained below.
  1472.  
  1473.    The NXT RRs for a zone SHOULD be automatically calculated and added
  1474.    to the zone by the same recommended off-line process that signs the
  1475.    zone (see Section 7.2).  The NXT RR's TTL SHOULD not exceed the zone
  1476.    minimum TTL.
  1477.  
  1478. 5.2 NXT RDATA Format
  1479.  
  1480.    The RDATA for an NXT RR consists simply of a domain name followed by
  1481.    a bit map.
  1482.  
  1483.    The type number for the NXT RR is 30.
  1484.  
  1485.                            1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  1486.        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
  1487.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1488.       |         next domain name                                      /
  1489.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1490.       |                    type bit map                               /
  1491.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1492.  
  1493.    The NXT RR type bit map is one bit per RR type present for the owner
  1494.    name similar to the WKS socket bit map.  The first bit represents RR
  1495.    type zero (an illegal type which should not be present.) A one bit
  1496.    indicates that at least one RR of that type is present for the owner
  1497.    name.  A zero indicates that no such RR is present.  All bits not
  1498.    specified because they are beyond the end of the bit map are assumed
  1499.    to be zero.  Note that bit 30, for NXT, will always be on so the
  1500.    minimum bit map length is actually four octets.  The NXT bit map
  1501.    should be printed as a list of RR type mnemonics or decimal numbers
  1502.    similar to the WKS RR.
  1503.  
  1504.    The domain name may be compressed with standard DNS name compression
  1505.    when being transmitted over the network.  The size of the bit map can
  1506.    be inferred from the RDLENGTH and the length of the next domain name.
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Eastlake & Kaufman          Standards Track                    [Page 27]
  1515.  
  1516. RFC 2065                DNS Security Extensions             January 1997
  1517.  
  1518.  
  1519. 5.3 Example
  1520.  
  1521.    Assume zone foo.tld has entries for
  1522.  
  1523.                big.foo.tld,
  1524.                medium.foo.tld.
  1525.                small.foo.tld.
  1526.                tiny.foo.tld.
  1527.  
  1528.    Then a query to a security aware server for huge.foo.tld would
  1529.    produce an error reply with the authority section data including
  1530.    something like the following:
  1531.  
  1532.    big.foo.tld. NXT medium.foo.tld. A MX SIG NXT
  1533.    big.foo.tld. SIG NXT 1 3 ( ;type-cov=NXT, alg=1, labels=3
  1534.                     19960102030405 ;signature expiration
  1535.                     19951211100908 ;time signed
  1536.                     21435          ;key footprint
  1537.                     foo.tld.       ;signer
  1538.     MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6VAuHAoNUz4YoU
  1539.     1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY= ;signature (640 bits)
  1540.                           )
  1541.  
  1542.    Note that this response implies that big.foo.tld is an existing name
  1543.    in the zone and thus has other RR types associated with it than NXT.
  1544.    However, only the NXT (and its SIG) RR appear in the response to this
  1545.    query for huge.foo.tld, which is a non-existent name.
  1546.  
  1547. 5.4 Interaction of NXT RRs and Wildcard RRs
  1548.  
  1549.    Since, in some sense, a wildcard RR causes all possible names in an
  1550.    interval to exist, there should not be an NXT RR that would cover any
  1551.    part of this interval.  Thus if *.X.ZONE exists you would expect an
  1552.    NXT RR that ends at X.ZONE and one that starts with the last name
  1553.    covered by *.X.ZONE.  However, this "last name covered" is something
  1554.    very ugly and long like \255\255\255....X.zone.  So the NXT for the
  1555.    interval following is simply given the owner name *.X.ZONE and an
  1556.    RDATA of the next name after the wildcard.  This "*" type owner name
  1557.    is not expanded when the NXT is returned as authority information in
  1558.    connection with a query for a non-existent name.
  1559.  
  1560.    If there could be any wildcard RRs in a zone and thus wildcard NXTs,
  1561.    care must be taken in interpreting the results of explicit NXT
  1562.    retrievals as the owner name may be a wildcard expansion.
  1563.  
  1564.    The existence of one or more wildcard RRs covering a name interval
  1565.    makes it possible for a malicious server to hide any more
  1566.    specifically named RRs in the internal.  The server can just falsely
  1567.  
  1568.  
  1569.  
  1570. Eastlake & Kaufman          Standards Track                    [Page 28]
  1571.  
  1572. RFC 2065                DNS Security Extensions             January 1997
  1573.  
  1574.  
  1575.    return the wildcard match NXT instead of the more specifically named
  1576.    RRs.  If there is a zone wide wildcard, there will be an NXT RR whose
  1577.    owner name is the wild card and whose RDATA is the zone name. In this
  1578.    case a server could conceal the existence of any more specific RRs in
  1579.    the zone.  It would be possible to design a more strict NXT feature
  1580.    which would eliminate this possibility.  But it would be more complex
  1581.    and might be so constraining as to make any dynamic update feature
  1582.    very difficult.
  1583.  
  1584. 5.5 Blocking NXT Pseudo-Zone Transfers
  1585.  
  1586.    In a secure zone, a resolver can query for the initial NXT associated
  1587.    with the zone name.  Using the next domain name RDATA field from that
  1588.    RR, it can query for the next NXT RR.  By repeating this, it can walk
  1589.    through all the NXTs in the zone.  If there are no wildcards, it can
  1590.    use this technique to find all names in a zone. If it does type ANY
  1591.    queries, it can incrementally get all information in the zone and
  1592.    thus defeat attempts to administratively block zone transfers.
  1593.  
  1594.    If there are any wildcards, this NXT walking technique will not find
  1595.    any more specific RR names in the part of the name space the wildcard
  1596.    covers.  By doing explicit retrievals for wildcard names, a resolver
  1597.    could determine what intervals are covered by wildcards but still
  1598.    could not, with these techniques, find any names inside such
  1599.    intervals except by trying every name.
  1600.  
  1601.    If it is desired to block NXT walking, the recommended method is to
  1602.    add a zone wide wildcard of the KEY type with the no-key type value
  1603.    and with no type (zone, entity, or user) bit on.  This will cause
  1604.    there to be one zone covering NXT RR and leak no information about
  1605.    what real names exist in the zone.  This protection from pseudo-zone
  1606.    transfers is bought at the expense of eliminating the data origin
  1607.    authentication of the non-existence of names that NXT RRs can
  1608.    provide.  If an entire zone is covered by a wildcard, a malicious
  1609.    server can return an RR produced by matching the resulting wildcard
  1610.    NXT and can thus hide all the real data and delegations in the zone
  1611.    that have more specific names.
  1612.  
  1613. 5.6 Special Considerations at Delegation Points
  1614.  
  1615.    A name (other than root) which is the head of a zone also appears as
  1616.    the leaf in a superzone.  If both are secure, there will always be
  1617.    two different NXT RRs with the same name.  They can be distinguished
  1618.    by their signers and next domain name fields.  Security aware servers
  1619.    should return the correct NXT automatically when required to
  1620.    authenticate the non-existence of a name and both NXTs, if available,
  1621.    on explicit query for type NXT.
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Eastlake & Kaufman          Standards Track                    [Page 29]
  1627.  
  1628. RFC 2065                DNS Security Extensions             January 1997
  1629.  
  1630.  
  1631.    Insecure servers will never automatically return an NXT and some
  1632.    implementations may only return the NXT from the subzone on explicit
  1633.    queries.
  1634.  
  1635. 6. The AD and CD Bits and How to Resolve Securely
  1636.  
  1637.    Retrieving or resolving authentic data from the Domain Name System
  1638.    (DNS) involves starting with one or more trusted public keys for one
  1639.    or more zones. With trusted keys, a resolver willing to perform
  1640.    cryptography can progress securely through the secure DNS zone
  1641.    structure to the zone of interest as described in Section 6.3. Such
  1642.    trusted public keys would normally be configured in a manner similar
  1643.    to that described in Section 6.2.  However, as a practical matter, a
  1644.    security aware resolver would still gain some confidence in the
  1645.    results it returns even if it was not configured with any keys but
  1646.    trusted what it got from a local well known server as a starting
  1647.    point.
  1648.  
  1649.    Data stored at a security aware server needs to be internally
  1650.    categorized as Authenticated, Pending, or Insecure. There is also a
  1651.    fourth transient state of Bad which indicates that all SIG checks
  1652.    have explicitly failed on the data. Such Bad data is not retained at
  1653.    a security aware server. Authenticated means that the data has a
  1654.    valid SIG under a KEY traceable via a chain of zero or more SIG and
  1655.    KEY RRs to a KEY configured at the resolver via its boot file.
  1656.    Pending data has no authenticated SIGs and at least one additional
  1657.    SIG the resolver is still trying to authenticate.  Insecure data is
  1658.    data which it is known can never be either Authenticated or found Bad
  1659.    because it is in or has been reached via a non-secured zone. Behavior
  1660.    in terms of control of and flagging based on such data labels is
  1661.    described in Section 6.1.
  1662.  
  1663.    The proper validation of signatures requires a reasonably secure
  1664.    shared opinion of the absolute time between resolvers and servers as
  1665.    described in Section 6.4.
  1666.  
  1667. 6.1 The AD and CD Header Bits
  1668.  
  1669.    Two previously unused bits are allocated out of the DNS
  1670.    query/response format header. The AD (authentic data) bit indicates
  1671.    in a response that the data included has been verified by the server
  1672.    providing it.  The CD (checking disabled) bit indicates in a query
  1673.    that non-verified data is acceptable to the resolver sending the
  1674.    query.
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Eastlake & Kaufman          Standards Track                    [Page 30]
  1683.  
  1684. RFC 2065                DNS Security Extensions             January 1997
  1685.  
  1686.  
  1687.    These bits are allocated from the must-be-zero Z field as follows:
  1688.  
  1689.                                           1  1  1  1  1  1
  1690.             0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
  1691.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1692.           |                      ID                       |
  1693.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1694.           |QR|   Opcode  |AA|TC|RD|RA| Z|AD|CD|   RCODE   |
  1695.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1696.           |                    QDCOUNT                    |
  1697.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1698.           |                    ANCOUNT                    |
  1699.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1700.           |                    NSCOUNT                    |
  1701.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1702.           |                    ARCOUNT                    |
  1703.           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  1704.  
  1705.    These bits are zero in old servers and resolvers.  Thus the responses
  1706.    of old servers are not flagged as authenticated to security aware
  1707.    resolvers and queries from non-security aware resolvers do not assert
  1708.    the checking disabled bit and thus will be answered by security aware
  1709.    servers only with authenticated data. Aware resolvers MUST not trust
  1710.    the AD bit unless they trust the server they are talking to and
  1711.    either have a secure path to it or use DNS transaction security.
  1712.  
  1713.    Any security aware resolver willing to do cryptography SHOULD assert
  1714.    the CD bit on all queries to reduce DNS latency time by allowing
  1715.    security aware servers to answer before they have resolved the
  1716.    validity of data.
  1717.  
  1718.    Security aware servers NEVER return Bad data.  For non-security aware
  1719.    resolvers or security aware resolvers requesting service by having
  1720.    the CD bit clear, security aware servers MUST return only
  1721.    Authenticated or Insecure data with the AD bit set in the response.
  1722.    Security aware resolvers will know that if data is Insecure versus
  1723.    Authentic by the absence of SIG RRs.  Security aware servers MAY
  1724.    return Pending data to security aware resolvers requesting the
  1725.    service by clearing the AD bit in the response.  The AD bit MUST NOT
  1726.    be set on a response unless all of the RRs in the response are either
  1727.    Authenticated or Insecure.
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738. Eastlake & Kaufman          Standards Track                    [Page 31]
  1739.  
  1740. RFC 2065                DNS Security Extensions             January 1997
  1741.  
  1742.  
  1743. 6.2 Boot File Format
  1744.  
  1745.    Two boot file directives are added as described in this section.
  1746.  
  1747.    The format for a boot file directive to configure a starting zone key
  1748.    is as follows:
  1749.  
  1750.         pubkey name flags protocol algorithm key-data
  1751.  
  1752.    for a public key.  "name" is the owner name (if the line is
  1753.    translated into a KEY RR).  Flags indicates the type of key and is
  1754.    the same as the flag octet in the KEY RR.  Protocol and algorithm
  1755.    also have the same meaning as they do in the KEY RR.  The material
  1756.    after the algorithm is algorithm dependent and, for private
  1757.    algorithms (algorithm 254), starts with the algorithm's identifying
  1758.    OID and its length.  If the "no key" type value is set in flags or
  1759.    the algorithm is specified as 253, then the key-data after algorithm
  1760.    is null.  When present the key-data is treated as an octet stream and
  1761.    encoded in base 64 (see Appendix).
  1762.  
  1763.    A file of keys for cross certification or other purposes can be
  1764.    configured though the keyfile directive as follows:
  1765.  
  1766.         keyfile filename
  1767.  
  1768.    The file looks like a master file except that it can only contain KEY
  1769.    and SIG RRs with the SIGs signed under a key configured with the
  1770.    pubkey directive.
  1771.  
  1772.    While it might seem logical for everyone to start with the key for
  1773.    the root zone, this has problems.  The logistics of updating every
  1774.    DNS resolver in the world when the root key changes would be
  1775.    excessive.  It may be some time before there even is a root key.
  1776.    Furthermore, many organizations will explicitly wish their "interior"
  1777.    DNS implementations to completely trust only their own zone.  Such
  1778.    interior resolvers can then go through the organization's zone
  1779.    servers to access data outsize the organization's domain and should
  1780.    only be configured with the key forthe organization's DNS apex.
  1781.  
  1782. 6.3 Chaining Through Zones
  1783.  
  1784.    Starting with one or more trusted keys for a zone, it should be
  1785.    possible to retrieve signed keys for its subzones which have a key
  1786.    and, if the zone is not root, for its superzone. Every authoritative
  1787.    secure zone server MUST also include the KEY RR for a super-zone
  1788.    signed by the secure zone via a keyfile directive. This makes it
  1789.    possible to climb the tree of zones if one starts below root.  A
  1790.    secure sub-zone is indicated by a KEY RR with non-null key
  1791.  
  1792.  
  1793.  
  1794. Eastlake & Kaufman          Standards Track                    [Page 32]
  1795.  
  1796. RFC 2065                DNS Security Extensions             January 1997
  1797.  
  1798.  
  1799.    information appearing with the NS RRs for the sub-zone.  These make
  1800.    it possible to descend within the tree of zones.
  1801.  
  1802.    A resolver should keep track of the number of successive secure zones
  1803.    traversed from a starting point to any secure zone it can reach.  In
  1804.    general, the lower such a distance number is, the greater the
  1805.    confidence in the data.  Data configured via a boot file directive
  1806.    should be given a distance number of zero.  If a query encounters
  1807.    different data for the same query with different distance values,
  1808.    that with a larger value should be ignored.
  1809.  
  1810.    A security conscious resolver should completely refuse to step from a
  1811.    secure zone into a non-secure zone unless the non-secure zone is
  1812.    certified to be non-secure, or only experimentally secure, by the
  1813.    presence of an authenticated KEY RR for the non-secure zone with the
  1814.    no-key type value or the presence of a KEY RR with the experimental
  1815.    bit set.  Otherwise the resolver is getting bogus or spoofed data.
  1816.  
  1817.    If legitimate non-secure zones are encountered in traversing the DNS
  1818.    tree, then no zone can be trusted as secure that can be reached only
  1819.    via information from such non-secure zones. Since the non-secure zone
  1820.    data could have been spoofed, the "secure" zone reach via it could be
  1821.    counterfeit.  The "distance" to data in such zones or zones reached
  1822.    via such zones could be set to 512 or more as this exceeds the
  1823.    largest possible distance through secure zones in the DNS.
  1824.    Nevertheless, continuing to apply secure checks within "secure" zones
  1825.    reached via non-secure zones is a good practice and will, as a
  1826.    practical matter, provide some small increase in security.
  1827.  
  1828. 6.4 Secure Time
  1829.  
  1830.    Coordinated interpretation of the time fields in SIG RRs requires
  1831.    that reasonably consistent time be available to the hosts
  1832.    implementing the DNS security extensions.
  1833.  
  1834.    A variety of time synchronization protocols exist including the
  1835.    Network Time Protocol (NTP, RFC1305).  If such protocols are used,
  1836.    they MUST be used securely so that time can not be spoofed.
  1837.    Otherwise, for example, a host could get its clock turned back and
  1838.    might then believe old SIG and KEY RRs which were valid but no longer
  1839.    are.
  1840.  
  1841. 7. Operational Considerations
  1842.  
  1843.    This section discusses a variety of considerations in secure
  1844.    operation of the Domain Name System (DNS) using these protocol
  1845.    extensions.
  1846.  
  1847.  
  1848.  
  1849.  
  1850. Eastlake & Kaufman          Standards Track                    [Page 33]
  1851.  
  1852. RFC 2065                DNS Security Extensions             January 1997
  1853.  
  1854.  
  1855. 7.1 Key Size Considerations
  1856.  
  1857.    There are a number of factors that effect public key size choice for
  1858.    use in the DNS security extension.  Unfortunately, these factors
  1859.    usually do not all point in the same direction.  Choice of zone key
  1860.    size should generally be made by the zone administrator depending on
  1861.    their local conditions.
  1862.  
  1863.    For most schemes, larger keys are more secure but slower.  Given a
  1864.    small public exponent, verification (the most common operation) for
  1865.    the MD5/RSA algorithm will vary roughly with the square of the
  1866.    modulus length, signing will vary with the cube of the modulus
  1867.    length, and key generation (the least common operation) will vary
  1868.    with the fourth power of the modulus length.  The current best
  1869.    algorithms for factoring a modulus and breaking RSA security vary
  1870.    roughly with the 1.6 power of the modulus itself.  Thus going from a
  1871.    640 bit modulus to a 1280 bit modulus only increases the verification
  1872.    time by a factor of 4 but increases the work factor of breaking the
  1873.    key by over 2^900.  An upper bound of 2552 bits has been established
  1874.    for the MD5/RSA DNS security algorithm for interoperability purposes.
  1875.  
  1876.    However, larger keys increase the size of the KEY and SIG RRs.  This
  1877.    increases the chance of DNS UDP packet overflow and the possible
  1878.    necessity for using higher overhead TCP in responses.
  1879.  
  1880.    The recommended minimum RSA algorithm modulus size, 640 bits, is
  1881.    believed by the authors to be secure at this time but high level
  1882.    zones in the DNS tree may wish to set a higher minimum, perhaps 1000
  1883.    bits, for security reasons.  (Since the United States National
  1884.    Security Agency generally permits export of encryption systems using
  1885.    an RSA modulus of up to 512 bits, use of that small a modulus, i.e.
  1886.    n, must be considered weak.)
  1887.  
  1888.    For a key used only to secure data and not to secure other keys, 640
  1889.    bits should be adequate at this time.
  1890.  
  1891. 7.2 Key Storage
  1892.  
  1893.    It is recommended that zone private keys and the zone file master
  1894.    copy be kept and used in off-line non-network connected physically
  1895.    secure machines only.  Periodically an application can be run to add
  1896.    authentication to a zone by adding SIG and NXT RRs and adding no-key
  1897.    type KEY RRs for subzones where a real KEY RR is not provided. Then
  1898.    the augmented file can be transferred, perhaps by sneaker-net, to the
  1899.    networked zone primary server machine.
  1900.  
  1901.    The idea is to have a one way information flow to the network to
  1902.    avoid the possibility of tampering from the network.  Keeping the
  1903.  
  1904.  
  1905.  
  1906. Eastlake & Kaufman          Standards Track                    [Page 34]
  1907.  
  1908. RFC 2065                DNS Security Extensions             January 1997
  1909.  
  1910.  
  1911.    zone master file on-line on the network and simply cycling it through
  1912.    an off-line signer does not do this.  The on-line version could still
  1913.    be tampered with if the host it resides on is compromised.  For
  1914.    maximum security, the master copy of the zone file should be off net
  1915.    and should not be updated based on an unsecured network mediated
  1916.    communication.
  1917.  
  1918.    Note, however, that secure resolvers must be configured with some
  1919.    trusted on-line public key information (or a secure path to such a
  1920.    resolver) or they will be unable to authenticate.
  1921.  
  1922.    Non-zone private keys, such as host or user keys, generally have to
  1923.    be kept on line to be used for real-time purposes such as DNS
  1924.    transaction security, IPSEC session set-up, or secure mail.
  1925.  
  1926. 7.3 Key Generation
  1927.  
  1928.    Careful key generation is a sometimes overlooked but absolutely
  1929.    essential element in any cryptographically secure system.  The
  1930.    strongest algorithms used with the longest keys are still of no use
  1931.    if an adversary can guess enough to lower the size of the likely key
  1932.    space so that it can be exhaustively searched.  Suggestions will be
  1933.    found in RFC 1750.
  1934.  
  1935.    It is strongly recommended that key generation also occur off-line,
  1936.    perhaps on the machine used to sign zones (see Section 7.2).
  1937.  
  1938. 7.4 Key Lifetimes
  1939.  
  1940.    No key should be used forever.  The longer a key is in use, the
  1941.    greater the probability that it will have been compromised through
  1942.    carelessness, accident, espionage, or cryptanalysis.  Furthermore, if
  1943.    key rollover is a rare event, there is an increased risk that, when
  1944.    the time does come up change the key, no one at the site will
  1945.    remember how to do it or other problems will have developed in the
  1946.    procedures.
  1947.  
  1948.    While key lifetime is a matter of local policy, these considerations
  1949.    suggest that no zone key should have a lifetime significantly over
  1950.    four years.  A reasonable maximum lifetime for zone keys that are
  1951.    kept off-line and carefully guarded is 13 months with the intent that
  1952.    they be replaced every year.  A reasonable maximum lifetime for end
  1953.    entity and useer keys that are used for IP-security or the like and
  1954.    are kept on line is 36 days with the intent that they be replaced
  1955.    monthly or more often.  In some cases, an entity key lifetime of
  1956.    somewhat over a day may be reasonable.
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Eastlake & Kaufman          Standards Track                    [Page 35]
  1963.  
  1964. RFC 2065                DNS Security Extensions             January 1997
  1965.  
  1966.  
  1967. 7.5 Signature Lifetime
  1968.  
  1969.    Signature expiration times must be set far enough in the future that
  1970.    it is quite certain that new signatures can be generated before the
  1971.    old ones expire.  However, setting expiration too far into the future
  1972.    could, if bad data or signatures were ever generated, mean a long
  1973.    time to flush such badness.
  1974.  
  1975.    It is recommended that signature lifetime be a small multiple of the
  1976.    TTL but not less than a reasonable re-signing interval.
  1977.  
  1978. 7.6 Root
  1979.  
  1980.    It should be noted that in DNS the root is a zone unto itself.  Thus
  1981.    the root zone key should only be seen signing itself or signing RRs
  1982.    with names one level below root, such as .aq, .edu, or .arpa.
  1983.    Implementations MAY reject as bogus any purported root signature of
  1984.    records with a name more than one level below root.  The root zone
  1985.    contains the root KEY RR signed by a SIG RR under the root key
  1986.    itself.
  1987.  
  1988. 8. Conformance
  1989.  
  1990.    Levels of server and resolver conformance are defined.
  1991.  
  1992. 8.1 Server Conformance
  1993.  
  1994.    Two levels of server conformance are defined as follows:
  1995.  
  1996.       Minimal server compliance is the ability to store and retrieve
  1997.       (including zone transfer) SIG, KEY, and NXT RRs.  Any secondary,
  1998.       caching, or other server for a secure zone MUST be at least
  1999.       minimally compliant and even then some things, such as secure
  2000.       CNAMEs, will not work without full compliance.
  2001.  
  2002.    Full server compliance adds the following to basic compliance:
  2003.  
  2004.       (1) ability to read SIG, KEY, and NXT RRs in zone files and (2)
  2005.       ability, given a zone file and private key, to add appropriate SIG
  2006.       and NXT RRs, possibly via a separate application, (3) proper
  2007.       automatic inclusion of SIG, KEY, and NXT RRs in responses, (4)
  2008.       suppression of CNAME following on retrieval of the security type
  2009.       RRs, (5) recognize the CD query header bit and set the AD query
  2010.       header bit, as appropriate, and (6) proper handling of the two NXT
  2011.       RRs at delegation points.  Primary servers for secure zones MUST
  2012.       be fully compliant and for completely successful secure operation,
  2013.       all secondary, caching, and other servers handling the zone SHOULD
  2014.       be fully compliant as well.
  2015.  
  2016.  
  2017.  
  2018. Eastlake & Kaufman          Standards Track                    [Page 36]
  2019.  
  2020. RFC 2065                DNS Security Extensions             January 1997
  2021.  
  2022.  
  2023. 8.2 Resolver Conformance
  2024.  
  2025.    Two levels of resolver compliance are defined:
  2026.  
  2027.       A basic compliance resolver can handle SIG, KEY, and NXT RRs when
  2028.       they are explicitly requested.
  2029.  
  2030.       A fully compliant resolver (1) understands KEY, SIG, and NXT RRs,
  2031.       (2) maintains appropriate information in its local caches and
  2032.       database to indicate which RRs have been authenticated and to what
  2033.       extent they have been authenticated, (3) performs additional
  2034.       queries as necessary to attempt to obtain KEY, SIG, or NXT RRs
  2035.       from non-security aware servers, (4) normally sets the CD query
  2036.       header bit on its queries.
  2037.  
  2038. 9. Security Considerations
  2039.  
  2040.    This document describes technical details of extensions to the Domain
  2041.    Name System (DNS) protocol to provide data integrity and origin
  2042.    authentication, public key distribution, and optional transaction and
  2043.    request security.
  2044.  
  2045.    It should be noted that, at most, these extensions guarantee the
  2046.    validity of resource records, including KEY resource records,
  2047.    retrieved from the DNS.  They do not magically solve other security
  2048.    problems.  For example, using secure DNS you can have high confidence
  2049.    in the IP address you retrieve for a host name; however, this does
  2050.    not stop someone for substituting an unauthorized host at that
  2051.    address or capturing packets sent to that address and falsely
  2052.    responding with packets apparently from that address.  Any reasonably
  2053.    complete security system will require the protection of many
  2054.    additional facets of the Internet.
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Eastlake & Kaufman          Standards Track                    [Page 37]
  2075.  
  2076. RFC 2065                DNS Security Extensions             January 1997
  2077.  
  2078.  
  2079. References
  2080.  
  2081.    [NETSEC] -  Network Security: PRIVATE Communications in a PUBLIC
  2082.                World, Charlie Kaufman, Radia Perlman, & Mike Speciner,
  2083.                Prentice Hall Series in Computer Networking and
  2084.                Distributed Communications 1995.
  2085.  
  2086.    [PKCS1] -   PKCS #1: RSA Encryption Standard, RSA Data Security,
  2087.                Inc., 3 June 1991, Version 1.4.
  2088.  
  2089.    [RFC1032] - Stahl, M., "Domain Administrators Guide", RFC 1032,
  2090.                November 1987.
  2091.  
  2092.    [RFC1033] - Lottor, M., "Domain Administrators Operations Guide",
  2093.                RRFC 1033, November 1987.
  2094.  
  2095.    [RFC1034] - Mockapetris, P., "Domain Names - Concepts and
  2096.                Facilities", STD 13, RFC 1034, November 1987.
  2097.  
  2098.    [RFC1035] - Mockapetris, P., "Domain Names - Implementation and
  2099.                Specifications", STD 13, RFC 1035, November 1987.
  2100.  
  2101.    [RFC1305] - Mills, D., "Network Time Protocol (v3)", RFC 1305, March
  2102.                1992.
  2103.  
  2104.    [RFC1321] - Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
  2105.                April 1992.
  2106.  
  2107.    [RFC1530] - Malamud, C., and M. Rose, "Principles of Operation for
  2108.                the TPC.INT Subdomain: General Principles and Policy",
  2109.                RFC 1530, October 1993.
  2110.  
  2111.    [RFC1750] - Eastlake, D., Crocker, S., and J, Schiller, "Randomness
  2112.                Requirements for Security", RFC 1750, December 1994.
  2113.  
  2114.    [RFC1825] - Atkinson, R., "Security Architecture for the Internet
  2115.                Protocol", RFC 1825, August 1995.
  2116.  
  2117.    [RSA FAQ] - RSADSI Frequently Asked Questions periodic posting.
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Eastlake & Kaufman          Standards Track                    [Page 38]
  2131.  
  2132. RFC 2065                DNS Security Extensions             January 1997
  2133.  
  2134.  
  2135. Authors' Addresses
  2136.  
  2137.    Donald E. Eastlake 3rd
  2138.    CyberCash, Inc.
  2139.    318 Acton Street
  2140.    Carlisle, MA 01741 USA
  2141.  
  2142.    Telephone:   +1 508-287-4877
  2143.                 +1 508-371-7148(fax)
  2144.                 +1 703-620-4200(main office, Reston, Virginia, USA)
  2145.    EMail:       dee@cybercash.com
  2146.  
  2147.  
  2148.    Charles W. Kaufman
  2149.    Iris Associates
  2150.    1 Technology Park Drive
  2151.    Westford, MA 01886 USA
  2152.  
  2153.    Telephone:   +1 508-392-5276
  2154.    EMail:       charlie_kaufman@iris.com
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Eastlake & Kaufman          Standards Track                    [Page 39]
  2187.  
  2188. RFC 2065                DNS Security Extensions             January 1997
  2189.  
  2190.  
  2191. Appendix: Base 64 Encoding
  2192.  
  2193.    The following encoding technique is taken from RFC 1521 by N.
  2194.    Borenstein and N. Freed.  It is reproduced here in an edited form for
  2195.    convenience.
  2196.  
  2197.    A 65-character subset of US-ASCII is used, enabling 6 bits to be
  2198.    represented per printable character. (The extra 65th character, "=",
  2199.    is used to signify a special processing function.)
  2200.  
  2201.    The encoding process represents 24-bit groups of input bits as output
  2202.    strings of 4 encoded characters. Proceeding from left to right, a
  2203.    24-bit input group is formed by concatenating 3 8-bit input groups.
  2204.    These 24 bits are then treated as 4 concatenated 6-bit groups, each
  2205.    of which is translated into a single digit in the base 64 alphabet.
  2206.  
  2207.    Each 6-bit group is used as an index into an array of 64 printable
  2208.    characters. The character referenced by the index is placed in the
  2209.    output string.
  2210.  
  2211.                        Table 1: The Base 64 Alphabet
  2212.  
  2213.       Value Encoding  Value Encoding  Value Encoding  Value Encoding
  2214.           0 A            17 R            34 i            51 z
  2215.           1 B            18 S            35 j            52 0
  2216.           2 C            19 T            36 k            53 1
  2217.           3 D            20 U            37 l            54 2
  2218.           4 E            21 V            38 m            55 3
  2219.           5 F            22 W            39 n            56 4
  2220.           6 G            23 X            40 o            57 5
  2221.           7 H            24 Y            41 p            58 6
  2222.           8 I            25 Z            42 q            59 7
  2223.           9 J            26 a            43 r            60 8
  2224.          10 K            27 b            44 s            61 9
  2225.          11 L            28 c            45 t            62 +
  2226.          12 M            29 d            46 u            63 /
  2227.          13 N            30 e            47 v
  2228.          14 O            31 f            48 w         (pad) =
  2229.          15 P            32 g            49 x
  2230.          16 Q            33 h            50 y
  2231.  
  2232.    Special processing is performed if fewer than 24 bits are available
  2233.    at the end of the data being encoded.  A full encoding quantum is
  2234.    always completed at the end of a quantity.  When fewer than 24 input
  2235.    bits are available in an input group, zero bits are added (on the
  2236.    right) to form an integral number of 6-bit groups.  Padding at the
  2237.    end of the data is performed using the '=' character.  Since all base
  2238.    64 input is an integral number of octets, only the following cases
  2239.  
  2240.  
  2241.  
  2242. Eastlake & Kaufman          Standards Track                    [Page 40]
  2243.  
  2244. RFC 2065                DNS Security Extensions             January 1997
  2245.  
  2246.  
  2247.    can arise: (1) the final quantum of encoding input is an integral
  2248.    multiple of 24 bits; here, the final unit of encoded output will be
  2249.    an integral multiple of 4 characters with no "=" padding, (2) the
  2250.    final quantum of encoding input is exactly 8 bits; here, the final
  2251.    unit of encoded output will be two characters followed by two "="
  2252.    padding characters, or (3) the final quantum of encoding input is
  2253.    exactly 16 bits; here, the final unit of encoded output will be three
  2254.    characters followed by one "=" padding character.
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Eastlake & Kaufman          Standards Track                    [Page 41]
  2299.  
  2300.