idnits 2.17.1 draft-ietf-ntp-autokey-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** The document seems to lack a License Notice according IETF Trust Provisions of 28 Dec 2009, Section 6.b.i or Provisions of 12 Sep 2009 Section 6.b -- however, there's a paragraph with a matching beginning. Boilerplate error? (You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Feb 2009 rather than one of the newer Notices. See https://trustee.ietf.org/license-info/.) Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 2246: '... EXPLICIT Extensions OPTIONAL...' Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (May 29, 2009) is 5446 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Informational ---------------------------------------------------------------------------- == Unused Reference: 'RFC1305' is defined on line 1696, but no explicit reference was found in the text == Outdated reference: A later version (-13) exists of draft-ietf-ntp-ntpv4-proto-11 -- Obsolete informational reference (is this intentional?): RFC 1305 (Obsoleted by RFC 5905) -- Obsolete informational reference (is this intentional?): RFC 2402 (Obsoleted by RFC 4302, RFC 4305) -- Obsolete informational reference (is this intentional?): RFC 2406 (Obsoleted by RFC 4303, RFC 4305) -- Obsolete informational reference (is this intentional?): RFC 2408 (Obsoleted by RFC 4306) -- Obsolete informational reference (is this intentional?): RFC 2510 (Obsoleted by RFC 4210) -- Obsolete informational reference (is this intentional?): RFC 2875 (Obsoleted by RFC 6955) -- Obsolete informational reference (is this intentional?): RFC 3280 (Obsoleted by RFC 5280) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 10 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group B. Haberman, Ed. 3 Internet-Draft JHU/APL 4 Intended status: Informational D. Mills 5 Expires: November 30, 2009 U. Delaware 6 May 29, 2009 8 Network Time Protocol Version 4 Autokey Specification 9 draft-ietf-ntp-autokey-05 11 Status of this Memo 13 This Internet-Draft is submitted to IETF in full conformance with the 14 provisions of BCP 78 and BCP 79. 16 Internet-Drafts are working documents of the Internet Engineering 17 Task Force (IETF), its areas, and its working groups. Note that 18 other groups may also distribute working documents as Internet- 19 Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six months 22 and may be updated, replaced, or obsoleted by other documents at any 23 time. It is inappropriate to use Internet-Drafts as reference 24 material or to cite them other than as "work in progress." 26 The list of current Internet-Drafts can be accessed at 27 http://www.ietf.org/ietf/1id-abstracts.txt. 29 The list of Internet-Draft Shadow Directories can be accessed at 30 http://www.ietf.org/shadow.html. 32 This Internet-Draft will expire on November 30, 2009. 34 Copyright Notice 36 Copyright (c) 2009 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents in effect on the date of 41 publication of this document (http://trustee.ietf.org/license-info). 42 Please review these documents carefully, as they describe your rights 43 and restrictions with respect to this document. 45 Abstract 47 This memo describes the Autokey security model for authenticating 48 servers to clients using the Network Time Protocol (NTP) and public 49 key cryptography. Its design is based on the premise that IPSEC 50 schemes cannot be adopted intact, since that would preclude stateless 51 servers and severely compromise timekeeping accuracy. In addition, 52 PKI schemes presume authenticated time values are always available to 53 enforce certificate lifetimes; however, cryptographically verified 54 timestamps require interaction between the timekeeping and 55 authentication functions. 57 This memo includes the Autokey requirements analysis, design 58 principles and protocol specification. A detailed description of the 59 protocol states, events and transition functions is included. A 60 prototype of the Autokey design based on this memo has been 61 implemented, tested and documented in the NTP Version 4 (NTPv4) 62 software distribution for Unix, Windows and VMS at 63 http://www.ntp.org. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 68 2. NTP Security Model . . . . . . . . . . . . . . . . . . . . . . 4 69 3. Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 70 4. Autokey Cryptography . . . . . . . . . . . . . . . . . . . . . 8 71 5. NTP Secure Groups . . . . . . . . . . . . . . . . . . . . . . 11 72 6. Identity Schemes . . . . . . . . . . . . . . . . . . . . . . . 15 73 7. Timestamps and Filestamps . . . . . . . . . . . . . . . . . . 16 74 8. Autokey Protocol Overview . . . . . . . . . . . . . . . . . . 18 75 9. Autokey Operations . . . . . . . . . . . . . . . . . . . . . . 20 76 10. Autokey Protocol Messages . . . . . . . . . . . . . . . . . . 21 77 10.1. No-Operation . . . . . . . . . . . . . . . . . . . . . . 24 78 10.2. Association Message (ASSOC) . . . . . . . . . . . . . . . 24 79 10.3. Certificate Message (CERT) . . . . . . . . . . . . . . . 24 80 10.4. Cookie Message (COOKIE) . . . . . . . . . . . . . . . . . 24 81 10.5. Autokey Message (AUTO) . . . . . . . . . . . . . . . . . 25 82 10.6. Leapseconds Values Message (LEAP) . . . . . . . . . . . . 25 83 10.7. Sign Message (SIGN) . . . . . . . . . . . . . . . . . . . 25 84 10.8. Identity Messages (IFF, GQ, MV) . . . . . . . . . . . . . 25 85 11. Autokey State Machine . . . . . . . . . . . . . . . . . . . . 25 86 11.1. Status Word . . . . . . . . . . . . . . . . . . . . . . . 25 87 11.2. Host State Variables . . . . . . . . . . . . . . . . . . 27 88 11.3. Client State Variables (all modes) . . . . . . . . . . . 29 89 11.4. Protocol State Transitions . . . . . . . . . . . . . . . 30 90 11.4.1. Server Dance . . . . . . . . . . . . . . . . . . . . 30 91 11.4.2. Broadcast Dance . . . . . . . . . . . . . . . . . . . 31 92 11.4.3. Symmetric Dance . . . . . . . . . . . . . . . . . . . 32 93 11.5. Error Recovery . . . . . . . . . . . . . . . . . . . . . 33 94 11.6. Security Considerations . . . . . . . . . . . . . . . . . 35 95 11.7. Protocol Vulnerability . . . . . . . . . . . . . . . . . 35 96 11.8. Clogging Vulnerability . . . . . . . . . . . . . . . . . 36 97 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 37 98 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 37 99 13.1. Normative References . . . . . . . . . . . . . . . . . . 37 100 13.2. Informative References . . . . . . . . . . . . . . . . . 37 101 Appendix A. Timestamps, Filestamps and Partial Ordering . . . . . 38 102 Appendix B. Identity Schemes . . . . . . . . . . . . . . . . . . 39 103 Appendix C. Private Certificate (PC) Scheme . . . . . . . . . . . 40 104 Appendix D. Trusted Certificate (TC) Scheme . . . . . . . . . . . 40 105 Appendix E. Schnorr (IFF) Identity Scheme . . . . . . . . . . . . 41 106 Appendix F. Guillard-Quisquater (GQ) Identity Scheme . . . . . . 43 107 Appendix G. Mu-Varadharajan (MV) Identity Scheme . . . . . . . . 45 108 Appendix H. ASN.1 Encoding Rules . . . . . . . . . . . . . . . . 47 109 H.1. COOKIE request, IFF response, GQ response, MV response . 48 110 H.2. Certificates . . . . . . . . . . . . . . . . . . . . . . 48 111 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 50 113 1. Introduction 115 A distributed network service requires reliable, ubiquitous and 116 survivable provisions to prevent accidental or malicious attacks on 117 the servers and clients in the network or the values they exchange. 118 Reliability requires that clients can determine that received packets 119 are authentic; that is, were actually sent by the intended server and 120 not manufactured or modified by an intruder. Ubiquity requires that 121 a client can verify the authenticity of a server using only public 122 information. Survivability requires protection from faulty 123 implementations, improper operation and possibly malicious clogging 124 and replay attacks. 126 This memo describes a cryptographically sound and efficient 127 methodology for use in the Network Time Protocol (NTP) 128 [I-D.ietf-ntp-ntpv4-proto]. The various key agreement schemes 129 [RFC2408][RFC2412][RFC2522] proposed require per-association state 130 variables, which contradicts the principles of the remote procedure 131 call (RPC) paradigm in which servers keep no state for a possibly 132 large client population. An evaluation of the PKI model and 133 algorithms as implemented in the OpenSSL library leads to the 134 conclusion that any scheme requiring every NTP packet to carry a PKI 135 digital signature would result in unacceptably poor timekeeping 136 performance. 138 The Autokey protocol is based on a combination of PKI and a pseudo- 139 random sequence generated by repeated hashes of a cryptographic value 140 involving both public and private components. This scheme has been 141 implemented, tested and deployed in the Internet of today. A 142 detailed description of the security model, design principles and 143 implementation is presented in this memo. 145 2. NTP Security Model 147 NTP security requirements are even more stringent than most other 148 distributed services. First, the operation of the authentication 149 mechanism and the time synchronization mechanism are inextricably 150 intertwined. Reliable time synchronization requires cryptographic 151 keys which are valid only over a designated time intervals; but, time 152 intervals can be enforced only when participating servers and clients 153 are reliably synchronized to UTC. In addition, the NTP subnet is 154 hierarchical by nature, so time and trust flow from the primary 155 servers at the root through secondary servers to the clients at the 156 leaves. 158 A client can claim authentic to dependent applications only if all 159 servers on the path to the primary servers are bone-fide authentic. 161 In order to emphasize this requirement, in this memo the notion of 162 "authentic" is replaced by "proventic", a noun new to English and 163 derived from provenance, as in the provenance of a painting. Having 164 abused the language this far, the suffixes fixable to the various 165 derivatives of authentic will be adopted for proventic as well. In 166 NTP each server authenticates the next lower stratum servers and 167 proventicates (authenticates by induction) the lowest stratum 168 (primary) servers. Serious computer linguists would correctly 169 interpret the proventic relation as the transitive closure of the 170 authentic relation. 172 It is important to note that the notion of proventic does not 173 necessarily imply the time is correct. A NTP client mobilizes a 174 number of concurrent associations with different servers and uses a 175 crafted agreement algorithm to pluck truechimers from the population 176 possibly including falsetickers. A particular association is 177 proventic if the server certificate and identity have been verified 178 by the means described in this memo. However, the statement "the 179 client is synchronized to proventic sources" means that the system 180 clock has been set using the time values of one or more proventic 181 associations and according to the NTP mitigation algorithms. 183 Over the last several years the IETF has defined and evolved the 184 IPSEC infrastructure for privacy protection and source authentication 185 in the Internet. The infrastructure includes the Encapsulating 186 Security Payload (ESP) [RFC2406] and Authentication Header (AH) 187 [RFC2402] for IPv4 and IPv6. Cryptographic algorithms that use these 188 headers for various purposes include those developed for the PKI, 189 including MD5 message digests, RSA digital signatures and several 190 variations of Diffie-Hellman key agreements. The fundamental 191 assumption in the security model is that packets transmitted over the 192 Internet can be intercepted by other than the intended recipient, 193 remanufactured in various ways and replayed in whole or part. These 194 packets can cause the client to believe or produce incorrect 195 information, cause protocol operations to fail, interrupt network 196 service or consume precious network and processor resources. 198 In the case of NTP, the assumed goal of the intruder is to inject 199 false time values, disrupt the protocol or clog the network, servers 200 or clients with spurious packets that exhaust resources and deny 201 service to legitimate applications. The mission of the algorithms 202 and protocols described in this memo is to detect and discard 203 spurious packets sent by other than the intended sender or sent by 204 the intended sender, but modified or replayed by an intruder. The 205 cryptographic means of the reference implementation are based on the 206 OpenSSL cryptographic software library available at www.openssl.org, 207 but other libraries with equivalent functionality could be used as 208 well. It is important for distribution and export purposes that the 209 way in which these algorithms are used precludes encryption of any 210 data other than incidental to the construction of digital signatures. 212 There are a number of defense mechanisms already built in the NTP 213 architecture, protocol and algorithms. The on-wire timestamp 214 exchange scheme is inherently resistant to spoofing, packet loss and 215 replay attacks. The engineered clock filter, selection and 216 clustering algorithms are designed to defend against evil cliques of 217 Byzantine traitors. While not necessarily designed to defeat 218 determined intruders, these algorithms and accompanying sanity checks 219 have functioned well over the years to deflect improperly operating 220 but presumably friendly scenarios. However, these mechanisms do not 221 securely identify and authenticate servers to clients. Without 222 specific further protection, an intruder can inject any or all of the 223 following attacks. 225 1. An intruder can intercept and archive packets forever, as well as 226 all the public values ever generated and transmitted over the 227 net. 229 2. An intruder can generate packets faster than the server, network 230 or client can process them, especially if they require expensive 231 cryptographic computations. 233 3. In a wiretap attack the intruder can intercept, modify and replay 234 a packet. However, it cannot permanently prevent onward 235 transmission of the original packet; that is, it cannot break the 236 wire, only tell lies and congest it. Except in unlikely cases 237 considered in Section 11.6, the modified packet cannot arrive at 238 the victim before the original packet, nor does it have the 239 server private keys or identity parameters. 241 4. In a middleman or masquerade attack the intruder is positioned 242 between the server and client, so it can intercept, modify and 243 replay a packet and prevent onward transmission of the original 244 packet. Except in unlikely cases considered in Section 11.6, the 245 middleman does not have the server private keys. 247 The NTP security model assumes the following possible limitations. 249 1. The running times for public key algorithms are relatively long 250 and highly variable. In general, the performance of the time 251 synchronization function is badly degraded if these algorithms 252 must be used for every NTP packet. 254 2. In some modes of operation it is not feasible for a server to 255 retain state variables for every client. It is however feasible 256 to regenerated them for a client upon arrival of a packet from 257 that client. 259 3. The lifetime of cryptographic values must be enforced, which 260 requires a reliable system clock. However, the sources that 261 synchronize the system clock must be cryptographically 262 proventicated. This circular interdependence of the timekeeping 263 and proventication functions requires special handling. 265 4. Client security functions must involve only public values 266 transmitted over the net. Private values must never be disclosed 267 beyond the machine on which they were created, except in the case 268 of a special trusted agent (TA) assigned for this purpose. 270 Unlike the Secure Shell security model, where the client must be 271 securely authenticated to the server, in NTP the server must be 272 securely authenticated to the client. In ssh each different 273 interface address can be bound to a different name, as returned by a 274 reverse-DNS query. In this design separate public/private key pairs 275 may be required for each interface address with a distinct name. A 276 perceived advantage of this design is that the security compartment 277 can be different for each interface. This allows a firewall, for 278 instance, to require some interfaces to authenticate the client and 279 others not. 281 3. Approach 283 The Autokey protocol described in this memo is designed to meet the 284 following objectives. In-depth discussions on these objectives is in 285 the web briefings and will not be elaborated in this memo. Note that 286 here and elsewhere in this memo mention of broadcast mode means 287 multicast mode as well, with exceptions as noted in the NTPv4 288 specification [I-D.ietf-ntp-ntpv4-proto]. 290 1. It must interoperate with the existing NTP architecture model and 291 protocol design. In particular, it must support the symmetric 292 key scheme described in [I-D.ietf-ntp-ntpv4-proto]. As a 293 practical matter, the reference implementation must use the same 294 internal key management system, including the use of 32-bit key 295 IDs and existing mechanisms to store, activate and revoke keys. 297 2. It must provide for the independent collection of cryptographic 298 values and time values. A NTP packet is accepted for processing 299 only when the required cryptographic values have been obtained 300 and verified and the packet has passed all header sanity checks. 302 3. It must not significantly degrade the potential accuracy of the 303 NTP synchronization algorithms. In particular, it must not make 304 unreasonable demands on the network or host processor and memory 305 resources. 307 4. It must be resistant to cryptographic attacks, specifically those 308 identified in the security model above. In particular, it must 309 be tolerant of operational or implementation variances, such as 310 packet loss or disorder, or suboptimal configurations. 312 5. It must build on a widely available suite of cryptographic 313 algorithms, yet be independent of the particular choice. In 314 particular, it must not require data encryption other than 315 incidental to signature and cookie encryption operations. 317 6. It must function in all the modes supported by NTP, including 318 server, symmetric and broadcast modes. 320 4. Autokey Cryptography 322 Autokey cryptography is based on the PKI algorithms commonly used in 323 the Secure Shell and Secure Sockets Layer applications. As in these 324 applications Autokey uses message digests to detect packet 325 modification, digital signatures to verify credentials and public 326 certificates to provide traceable authority. What makes Autokey 327 cryptography unique is the way in which these algorithms are used to 328 deflect intruder attacks while maintaining the integrity and accuracy 329 of the time synchronization function. 331 NTPv3 and NTPv4 symmetric key cryptography uses keyed-MD5 message 332 digests with a 128-bit private key and 32-bit key ID. In order to 333 retain backward compatibility with NTPv3, the NTPv4 key ID space is 334 partitioned in two subspaces at a pivot point of 65536. Symmetric 335 key IDs have values less than the pivot and indefinite lifetime. 336 Autokey key IDs have pseudo-random values equal to or greater than 337 the pivot and are expunged immediately after use. 339 Both symmetric key and public key cryptography authenticate as shown 340 in Figure 1. The server looks up the key associated with the key ID 341 and calculates the message digest from the NTP header and extension 342 fields together with the key value. The key ID and digest form the 343 message authentication code (MAC) included with the message. The 344 client does the same computation using its local copy of the key and 345 compares the result with the digest in the MAC. If the values agree, 346 the message is assumed authentic. 348 +------------------+ 349 | NTP Header and | 350 | Extension Fields | 351 +------------------+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 352 | | | Message Authenticator Code | 353 \|/ \|/ + (MAC) + 354 ******************** | +-------------------------+ | 355 * Compute Hash *<----| Key ID | Message Digest | + 356 ******************** | +-------------------------+ | 357 | +-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+-+ 358 \|/ \|/ 359 +------------------+ +-------------+ 360 | Message Digest |------>| Compare | 361 +------------------+ +-------------+ 363 Figure 1: Message Authentication 365 Autokey uses specially contrived session keys, called autokeys, and a 366 precomputed pseudo-random sequence of autokeys which are saved in the 367 autokey list. The Autokey protocol operates separately for each 368 association, so there may be several autokey sequences operating 369 independently at the same time. 371 +-------------+-------------+--------+--------+ 372 | Src Address | Dst Address | Key ID | Cookie | 373 +-------------+-------------+--------+--------+ 375 Figure 2: NTPv4 Autokey 377 An autokey is computed from four fields in network byte order as 378 shown in Figure 2. The four values are hashed by the MD5 message 379 digest algorithm to produce the 128-bit autokey value, which in the 380 reference implementation is stored along with the key ID in a cache 381 used for symmetric keys as well as autokeys. Keys are retrieved from 382 the cache by key ID using hash tables and a fast lookup algorithm. 384 For use with IPv4 the Src Address and Dst Address fields contain 32 385 bits; for use with IPv6 these fields contain 128 bits. In either 386 case the Key ID and Cookie fields contain 32 bits. Thus, an IPv4 387 autokey has four 32-bit words, while an IPv6 autokey has ten 32-bit 388 words. The source and destination addresses and key ID are public 389 values visible in the packet, while the cookie can be a public value 390 or shared private value, depending on the NTP mode. 392 The NTP packet format has been augmented to include one or more 393 extension fields piggybacked between the original NTP header and the 394 MAC. For packets without extension fields, the cookie is a shared 395 private value. For packets with extension fields, the cookie has a 396 default public value of zero, since these packets are validated 397 independently using digital signatures. 399 There are some scenarios where the use of endpoint IP addresses may 400 be difficult or impossible. These include configurations where 401 network address translation (NAT) devices are in use or when 402 addresses are changed during an association lifetime due to mobility 403 constraints. For Autokey, the only restriction is that the address 404 fields visible in the transmitted packet must be the same as those 405 used to construct the autokey list and that these fields be the same 406 as those visible in the received packet. [The use of alternative 407 means, such as Autokey host names (discussed later) or hashes of 408 these names may be a topic for future study.] 410 +-----------+-----------+------+------+ +---------+ +-----+------+ 411 |Src Address|Dst Address|Key ID|Cookie|-->| | |Final|Final | 412 +-----------+-----------+------+------+ | Session | |Index|Key ID| 413 | | | | | Key ID | +-----+------+ 414 \|/ \|/ \|/ \|/ | List | | | 415 ************************************* +---------+ \|/ \|/ 416 * COMPUTE HASH * ******************* 417 ************************************* *COMPUTE SIGNATURE* 418 | Index n ******************* 419 \|/ | 420 +--------+ | 421 | Next | \|/ 422 | Key ID | +-----------+ 423 +--------+ | Signature | 424 Index n+1 +-----------+ 426 Figure 3: Constructing the Key List 428 Figure 3 shows how the autokey list and autokey values are computed. 429 The key IDs used in the autokey list consists of a sequence starting 430 with a random 32-bit nonce (autokey seed) equal to or greater than 431 the pivot as the first key ID. The first autokey is computed as 432 above using the given cookie and autokey seed and assigned index 0. 433 The first 32 bits of the result in network byte order become the next 434 key ID. The MD5 hash of the autokey is the key value saved in the 435 key cache along with the key ID. The first 32 bits of the key become 436 the key ID for the next autokey assigned index 1. 438 Operations continue to generate the entire list. It may happen that 439 a newly generated key ID is less than the pivot or collides with 440 another one already generated (birthday event). When this happens, 441 which occurs only rarely, the key list is terminated at that point. 442 The lifetime of each key is set to expire one poll interval after its 443 scheduled use. In the reference implementation, the list is 444 terminated when the maximum key lifetime is about one hour, so for 445 poll intervals above one hour a new key list containing only a single 446 entry is regenerated for every poll. 448 +------------------+ 449 | NTP Header and | 450 | Extension Fields | 451 +------------------+ 452 | | 453 \|/ \|/ +---------+ 454 **************** +--------+ | Session | 455 * COMPUTE HASH *<---| Key ID |<---| Key ID | 456 **************** +--------+ | List | 457 | | +---------+ 458 \|/ \|/ 459 +----------------------------------+ 460 | Message Authenticator Code (MAC) | 461 +----------------------------------+ 463 Figure 4: Transmitting Messages 465 The index of the last autokey in the list is saved along with the key 466 ID for that entry, collectively called the autokey values. The 467 autokey values are then signed for use later. The list is used in 468 reverse order as shown in Figure 4, so that the first autokey used is 469 the last one generated. 471 The Autokey protocol includes a message to retrieve the autokey 472 values and verify the signature, so that subsequent packets can be 473 validated using one or more hashes that eventually match the last key 474 ID (valid) or exceed the index (invalid). This is called the autokey 475 test in the following and is done for every packet, including those 476 with and without extension fields. In the reference implementation 477 the most recent key ID received is saved for comparison with the 478 first 32 bits in network byte order of the next following key value. 479 This minimizes the number of hash operations in case a single packet 480 is lost. 482 5. NTP Secure Groups 484 NTP secure groups are used to define cryptographic compartments and 485 security hierarchies. A secure group consists of a number of hosts 486 dynamically assembled as a forest with roots the trusted hosts (THs) 487 at the lowest stratum of the group. The THs do not have to be, but 488 often are, primary (stratum 1) servers. A trusted authority (TA), 489 not necessarily a group host, generates private identity keys for 490 servers and public identity keys for clients at the leaves of the 491 forest. The TA deploys the server keys to the THs and other 492 designated servers using secure means and delivers the client keys by 493 secure means. 495 For Autokey purposes all hosts belonging to a secure group have the 496 same group name but different host names, not necessarily related to 497 the DNS names. The group name is used in the subject and issuer 498 fields of the TH certificates; the host name is used in these fields 499 for other hosts. Thus, all host certificates are self-signed. 500 During the Autokey protocol a client requests the server to sign its 501 certificate and caches the result. A certificate trail is 502 constructed by each host, possibly via intermediate hosts and ending 503 at a TH. Thus, each host along the trail retrieves the entire trail 504 from its server(s) and provides this plus its own signed certificates 505 to its clients. 507 Secure groups can be configured as hierarchies where a TH of one 508 group can be a client of one or more other groups operating at a 509 lower stratum. In one scenario, groups RED and GREEN can be 510 cryptographically distinct, but both be clients of group BLUE 511 operating at a lower stratum. In another scenario, group CYAN can be 512 a client of multiple groups YELLOW and MAGENTA, both operating at a 513 lower stratum. There are many other scenarios, but all must be 514 configured to include only acyclic certificate trails. 516 In Figure 5, the Alice group consists of THs Alice, which is also the 517 TA, and Carol. Dependent servers Brenda and Denise have configured 518 Alice and Carol, respectively, as their time sources. Stratum 3 519 server Eileen has configured both Brenda and Denise as her time 520 sources. Public certificates are identified by the subject and 521 signed by the issuer. Note that the server keys have been previously 522 installed on Brenda and Denise and the client keys installed on all 523 machines. 525 +-------------+ +-------------+ +-------------+ 526 | Alice | | Brenda | | Denise | 527 | | | | | | 528 | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 529 Certificate | | Alice | | | | Brenda| | | | Denise| | 530 +-+-+-+-+-+ | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 531 | Subject | | | Alice*| 1 | | | Alice | 4 | | | Carol | 4 | 532 +-+-+-+-+-+ | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 533 | Issuer | S | | | | | | 534 +-+-+-+-+-+ | +=======+ | | +-+-+-+-+ | | +-+-+-+-+ | 535 | ||Alice|| 3 | | | Alice | | | | Carol | | 536 Group Key | +=======+ | | +-+-+-+-+ | | +-+-+-+-+ | 537 +=========+ +-------------+ | | Alice*| 2 | | | Carol*| 2 | 538 || Group || S | Carol | | +-+-+-+-+ | | +-+-+-+-+ | 539 +=========+ | | | | | | 540 | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 541 S = step | | Carol | | | | Brenda| | | | Denise| | 542 * = trusted | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 543 | | Carol*| 1 | | | Brenda| 1 | | | Denise| 1 | 544 | +-+-+-+-+ | | +-+-+-+-+ | | +-+-+-+-+ | 545 | | | | | | 546 | +=======+ | | +=======+ | | +=======+ | 547 | ||Alice|| 3 | | ||Alice|| 3 | | ||Alice|| 3 | 548 | +=======+ | | +=======+ | | +=======+ | 549 +-------------+ +-------------+ +-------------+ 550 Stratum 1 Stratum 2 552 +---------------------------------------------+ 553 | Eileen | 554 | | 555 | +-+-+-+-+ +-+-+-+-+ | 556 | | Eileen| | Eileen| | 557 | +-+-+-+-+ +-+-+-+-+ | 558 | | Brenda| | Carol | 4 | 559 | +-+-+-+-+ +-+-+-+-+ | 560 | | 561 | +-+-+-+-+ +-+-+-+-+ | 562 | | Alice | | Carol | | 563 | +-+-+-+-+ +-+-+-+-+ | 564 | | Alice*| | Carol*| 2 | 565 | +-+-+-+-+ +-+-+-+-+ | 566 | | 567 | +-+-+-+-+ +-+-+-+-+ | 568 | | Brenda| | Denise| | 569 | +-+-+-+-+ +-+-+-+-+ | 570 | | Alice | | Carol | 2 | 571 | +-+-+-+-+ +-+-+-+-+ | 572 | | 573 | +-+-+-+-+ | 574 | | Eileen| | 575 | +-+-+-+-+ | 576 | | Eileen| 1 | 577 | +-+-+-+-+ | 578 | | 579 | +=======+ | 580 | ||Alice|| 3 | 581 | +=======+ | 582 +---------------------------------------------+ 583 Stratum 3 585 Figure 5: NTP Secure Groups 587 The steps in hiking the certificate trails and verifying identity are 588 as follows. Note the step number in the description matches the step 589 number in the figure. 591 1. The servers start by loading the host key, sign key, self-signed 592 certificate and group key. They start the Autokey protocol by 593 exchanging host names and negotiating digest/signature schemes 594 and identity schemes. 596 2. They continue to load certificates recursively until a self- 597 signed trusted certificate is found. Brenda and Denise 598 immediately find trusted certificates for Alice and Carol, 599 respectively, but Eileen will loop because neither Brenda nor 600 Denise have their own certificates signed by either Alice or 601 Carol. 603 3. Brenda and Denise continue with the selected identity schemes to 604 verify that Alice and Carol have the correct group key previously 605 generated by Alice. If this succeeds, each continues in step 4. 607 4. Brenda and Denise present their certificates for signature. If 608 this succeeds, either or both Brenda and Denise can now provide 609 these signed certificates to Eileen, which may be looping in step 610 2. Eileen can now verify the trail via either Brenda or Denise 611 to the trusted certificates for Alice and Carol. Once this is 612 done, Eileen can complete the protocol just as Brenda and Denise. 614 For various reasons it may be convenient for a server to have client 615 keys for more than one group. For example, Figure 6 shows three 616 secure groups Alice, Helen and Carol arranged in a hierarchy. Hosts 617 A, B, C and D belong to Alice, R, S to Helen and X, Y and Z belong to 618 Carol. While not strictly necessary, hosts A, B and R are stratum 1 619 and presumed trusted, but the TA generating the identity keys could 620 be one of them or another not shown. 622 ***** ***** @@@@@ 623 Stratum 1 * A * * B * @ R @ 624 ***** ***** @@@@@ 625 \ / / 626 \ / / 627 ***** @@@@@ ********* 628 2 * C * @ S @ * Alice * 629 ***** @@@@@ ********* 630 / \ / 631 / \ / @@@@@@@@@ 632 ***** ##### @ Helen @ 633 3 * D * # X # @@@@@@@@@ 634 ***** ##### 635 / \ ######### 636 / \ # Carol # 637 ##### ##### ######### 638 4 # Y # # Z # 639 ##### ##### 641 Figure 6: Hierarchical Overlapping Groups 643 The intent of the scenario is to provide security separation, so that 644 servers cannot masquerade as in other groups and clients cannot 645 masquerade as servers. Assume for example that Alice and Helen 646 belong to national standards laboratories and their server keys are 647 used to confirm identity between members of each group. Carol is a 648 prominent corporation receiving standards products and requiring 649 cryptographic authentication. Perhaps under contract, host X 650 belonging to Carol has client keys for both Alice and Helen and 651 server keys for Carol. The Autokey protocol operates for each group 652 separately while preserving security separation. Host X can prove 653 identity in Carol to clients Y and Z, but cannot prove to anybody 654 that it belongs to either Alice or Helen. 656 6. Identity Schemes 658 A digital signature scheme provides secure server authentication, but 659 it does not provide protection against masquerade, unless the server 660 identity is verified by other means. The PKI model requires a server 661 to prove identity to the client by a certificate trail, but 662 independent means such as a driver's license are required for a CA to 663 sign the server certificate. While Autokey supports this model by 664 default, in a hierarchical ad-hoc network, especially with server 665 discovery schemes like NTP Manycast, proving identity at each rest 666 stop on the trail must be an intrinsic capability of Autokey itself. 668 While the identity scheme described in [RFC2875] is based on a 669 ubiquitous Diffie-Hellman infrastructure, it is expensive to generate 670 and use when compared to others described in Appendix B. In 671 principle, an ordinary public key scheme could be devised for this 672 purpose, but the most stringent Autokey design requires that every 673 challenge, even if duplicated, results in a different acceptable 674 response. 676 There are five schemes now implemented in the NTPv4 reference 677 implementation to prove identity: (1) private certificate (PC), (2) 678 trusted certificate (TC), (3) a modified Schnorr algorithm (IFF aka 679 Identify Friendly or Foe), (4) a modified Guillou-Quisquater 680 algorithm (GQ), and (5) a modified Mu-Varadharajan algorithm (MV). 681 Following is a summary description of each; details are given in 682 Appendix B. 684 The PC scheme involves a private certificate as group key. The 685 certificate is distributed to all other group members by secure means 686 and is never revealed outside the group. In effect, the private 687 certificate is used as a symmetric key. This scheme is used 688 primarily for testing and development and is not recommended for 689 regular use and is not considered further in this memo. 691 All other schemes involve a conventional certificate trail as 692 described in RFC 2510 [RFC2510]. This is the default scheme when an 693 identity scheme is not specified. While the remaining identity 694 schemes incorporate TC, it is not by itself considered further in 695 this memo. 697 The three remaining schemes IFF, GQ and MV involve a 698 cryptographically strong challenge-response exchange where an 699 intruder cannot deduce the server key, even after repeated 700 observations of multiple exchanges. In addition, the MV scheme is 701 properly described as a zero-knowledge proof, because the client can 702 verify the server has the correct group key without either the server 703 or client knowing its value. These schemes start when the client 704 sends a nonce to the server, which then rolls its own nonce, performs 705 a mathematical operation and sends the results to the client. The 706 client performs another mathematical operation and verifies the 707 results are correct. 709 7. Timestamps and Filestamps 711 While public key signatures provide strong protection against 712 misrepresentation of source, computing them is expensive. This 713 invites the opportunity for an intruder to clog the client or server 714 by replaying old messages or originating bogus messages. A client 715 receiving such messages might be forced to verify what turns out to 716 be an invalid signature and consume significant processor resources. 717 In order to foil such attacks, every Autokey message carries a 718 timestamp in the form of the NTP seconds when it was created. If the 719 system clock is synchronized to a proventic source, a signature is 720 produced with valid (nonzero) timestamp. Otherwise, there is no 721 signature and the timestamp is invalid (zero). The protocol detects 722 and discards extension fields with old or duplicate timestamps, 723 before any values are used or signatures are verified. 725 Signatures are computed only when cryptographic values are created or 726 modified, which is by design not very often. Extension fields 727 carrying these signatures are copied to messages as needed, but the 728 signatures are not recomputed. There are three signature types: 730 1. Cookie signature/timestamp. The cookie is signed when created by 731 the server and sent to the client. 733 2. Autokey signature/timestamp. The autokey values are signed when 734 the key list is created. 736 3. Public values signature/timestamp. The public key, certificate 737 and leapsecond values are signed at the time of generation, which 738 occurs when the system clock is first synchronized to a proventic 739 source, when the values have changed and about once per day after 740 that, even if these values have not changed. 742 The most recent timestamp received of each type is saved for 743 comparison. Once a signature with valid timestamp has been received, 744 messages with invalid timestamps or earlier valid timestamps of the 745 same type are discarded before the signature is verified. This is 746 most important in broadcast mode, which could be vulnerable to a 747 clogging attack without this test. 749 All cryptographic values used by the protocol are time sensitive and 750 are regularly refreshed. In particular, files containing 751 cryptographic values used by signature and encryption algorithms are 752 regenerated from time to time. It is the intent that file 753 regenerations occur without specific advance warning and without 754 requiring prior distribution of the file contents. While 755 cryptographic data files are not specifically signed, every file is 756 associated with a filestamp showing the NTP seconds at the creation 757 epoch. 759 Filestamps and timestamps can be compared in any combination and use 760 the same conventions. It is necessary to compare them from time to 761 time to determine which are earlier or later. Since these quantities 762 have a granularity only to the second, such comparisons are ambiguous 763 if the values are in the same second. 765 It is important that filestamps be proventic data; thus, they cannot 766 be produced unless the producer has been synchronized to a proventic 767 source. As such, the filestamps throughout the NTP subnet represent 768 a partial ordering of all creation epochs and serve as means to 769 expunge old data and insure new data are consistent. As the data are 770 forwarded from server to client, the filestamps are preserved, 771 including those for certificate and leapseconds values. Packets with 772 older filestamps are discarded before spending cycles to verify the 773 signature. 775 8. Autokey Protocol Overview 777 The Autokey protocol includes a number of request/response exchanges 778 that must be completed in order. In each exchange a client sends a 779 request message with data and expects a server response message with 780 data. Requests and responses are contained in extension fields, one 781 request or response in each field, as described later. An NTP packet 782 can contain one request message and one or more response messages. 783 Following is a list of these messages. 785 o Parameter exchange. The request includes the client host name and 786 status word; the response includes the server host name and status 787 word. The status word specifies the digest/signature scheme to 788 use and the identity schemes supported. 790 o Certificate exchange. The request includes the subject name of a 791 certificate; the response consists of a signed certificate with 792 that subject name. If the issuer name is not the same as the 793 subject name, it has been signed by a host one step closer to a 794 trusted host, so certificate retrieval continues for the issuer 795 name. If it is trusted and self-signed, the trail concludes at 796 the trusted host. If nontrusted and self-signed, the host 797 certificate has not yet been signed, so the trail temporarily 798 loops. Completion of this exchange lights the VAL bit as 799 described below. 801 o Identity exchange. The certificate trail is generally not 802 considered sufficient protection against middleman attacks unless 803 additional protection such as the proof-of-possession scheme 804 described in [RFC2875] is available, but this is expensive and 805 requires servers to retain state. Autokey can use one of the 806 challenge/response identity schemes described in Appendix B. 807 Completion of this exchange lights the IFF bit as described below. 809 o Cookie exchange. The request includes the public key of the 810 server. The response includes the server cookie encrypted with 811 this key. The client uses this value when constructing the key 812 list. Completion of this exchange lights the COOK bit as 813 described below. 815 o Autokey exchange. The request includes either no data or the 816 autokey values in symmetric modes. The response includes the 817 autokey values of the server. These values are used to verify the 818 autokey sequence. Completion of this exchange lights the AUT bit 819 as described below. 821 o Sign exchange. This exchange is executed only when the client has 822 synchronized to a proventic source. The request includes the 823 self-signed client certificate. The server acting as CA 824 interprets the certificate as a X.509v3 certificate request. It 825 extracts the subject, issuer, and extension fields, builds a new 826 certificate with these data along with its own serial number and 827 expiration time, then signs it using its own private key and 828 includes it in the response. The client uses the signed 829 certificate in its own role as server for dependent clients. 830 Completion of this exchange lights the SIGN bit as described 831 below. 833 o Leapseconds exchange. This exchange is executed only when the 834 client has synchronized to a proventic source. This exchange 835 occurs when the server has the leapseconds values, as indicated in 836 the host status word. If so, the client requests the values and 837 compares them with its own values, if available. If the server 838 values are newer than the client values, the client replaces its 839 own with the server values. The client, acting as server, can now 840 provide the most recent values to its dependent clients. In 841 symmetric mode, this results in both peers having the newest 842 values. Completion of this exchange lights the LPT bit as 843 described below. 845 Once the certificates and identity have been validated, subsequent 846 packets are validated by digital signatures and the autokey sequence. 847 The association is now proventic with respect to the downstratum 848 trusted host, but is not yet selectable to discipline the system 849 clock. The associations accumulate time values and the mitigation 850 algorithms continue in the usual way. When these algorithms have 851 culled the falsetickers and cluster outlyers and at least three 852 survivors remain, the system clock has been synchronized to a 853 proventic source. 855 The time values for truechimer sources form a proventic partial 856 ordering relative to the applicable signature timestamps. This 857 raises the interesting issue of how to mitigate between the 858 timestamps of different associations. It might happen, for instance, 859 that the timestamp of some Autokey message is ahead of the system 860 clock by some presumably small amount. For this reason, timestamp 861 comparisons between different associations and between associations 862 and the system clock are avoided, except in the NTP intersection and 863 clustering algorithms and when determining whether a certificate has 864 expired. 866 9. Autokey Operations 868 The NTP protocol has three principal modes of operation: client/ 869 server, symmetric and broadcast and each has its own Autokey program, 870 or dance. Autokey choreography is designed to be nonintrusive and to 871 require no additional packets other than for regular NTP operations. 872 The NTP and Autokey protocols operate simultaneously and 873 independently. When the dance is complete, subsequent packets are 874 validated by the autokey sequence and thus considered proventic as 875 well. Autokey assumes NTP clients poll servers at a relatively low 876 rate, such as once per minute or slower. In particular, it assumes 877 that a request sent at one poll opportunity will normally result in a 878 response before the next poll opportunity; however the protocol is 879 robust against a missed or duplicate response. 881 The server dance was suggested by Steve Kent over lunch some time 882 ago, but considerably modified since that meal. The server keeps no 883 state for each client, but uses a fast algorithm and a 32-bit random 884 private value (server seed) to regenerate the cookie upon arrival of 885 a client packet. The cookie is calculated as the first 32 bits of 886 the autokey computed from the client and server addresses, key ID 887 zero and the server seed as cookie. The cookie is used for the 888 actual autokey calculation by both the client and server and is thus 889 specific to each client separately. 891 In the server dance the client uses the cookie and each key ID on the 892 key list in turn to retrieve the autokey and generate the MAC. The 893 server uses the same values to generate the message digest and 894 verifies it matches the MAC. It then generates the MAC for the 895 response using the same values, but with the client and server 896 addresses interchanged. The client generates the message digest and 897 verifies it matches the MAC. In order to deflect old replays, the 898 client verifies the key ID matches the last one sent. In this dance 899 the sequential structure of the key list is not exploited, but doing 900 it this way simplifies and regularizes the implementation while 901 making it nearly impossible for an intruder to guess the next key ID. 903 In the broadcast dance clients normally do not send packets to the 904 server, except when first starting up. At that time the client runs 905 the server dance to verify the server credentials and calibrate the 906 propagation delay. The dance requires the association ID of the 907 particular server association, since there can be more than one 908 operating in the same server. For this purpose, the server packet 909 includes the association ID in every response message sent and, when 910 sending the first packet after generating a new key list, it sends 911 the autokey values as well. After obtaining and verifying the 912 autokey values, no extension fields are necessary and the client 913 verifies further server packets using the autokey sequence. 915 The symmetric dance is similar to the server dance and requires only 916 a small amount of state between the arrival of a request and 917 departure of the response. The key list for each direction is 918 generated separately by each peer and used independently, but each is 919 generated with the same cookie. The cookie is conveyed in a way 920 similar to the server dance, except that the cookie is a simple 921 nonce. There exists a possible race condition where each peer sends 922 a cookie request before receiving the cookie response from the other 923 peer. In this case each peer winds up with two values, one it 924 generated and one the other peer generated. The ambiguity is 925 resolved simply by computing the working cookie as the EXOR of the 926 two values. 928 Once the autokey dance has completed, it is normally dormant. In all 929 except the broadcast dance, packets are normally sent without 930 extension fields, unless the packet is the first one sent after 931 generating a new key list or unless the client has requested the 932 cookie or autokey values. If for some reason the client clock is 933 stepped, rather than slewed, all cryptographic and time values for 934 all associations are purged and the dances in all associations 935 restarted from scratch. This insures that stale values never 936 propagate beyond a clock step. 938 10. Autokey Protocol Messages 940 The Autokey protocol data unit is the extension field, one or more of 941 which can be piggybacked in the NTP packet. An extension field 942 contains either a request with optional data or a response with 943 optional data. To avoid deadlocks, any number of responses can be 944 included in a packet, but only one request. A response is generated 945 for every request, even if the requestor is not synchronized to a 946 proventic source, but most contain meaningful data only if the 947 responder is synchronized to a proventic source. Some requests and 948 most responses carry timestamped signatures. The signature covers 949 the entire extension field, including the timestamp and filestamp, 950 where applicable. Only if the packet passes all extension field 951 tests are cycles spent to verify the signature. 953 The following terms: light, lit, etc. means the bit value is set to 954 1, while the terms dark, dim, etc. indicate that the bit value is set 955 to 0. 957 There are currently eight Autokey requests and eight corresponding 958 responses. The NTP packet format is described in 959 [I-D.ietf-ntp-ntpv4-proto] and the extension field format used for 960 these messages is illustrated in Figure 7. 962 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 963 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 964 |R|E| Code | Field Type | Length | 965 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 966 | Association ID | 967 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 968 | Timestamp | 969 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 970 | Filestamp | 971 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 972 | Value Length | 973 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 974 \ / 976 / Value \ 977 \ / 978 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 979 | Signature Length | 980 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 981 \ / 982 / Signature \ 983 \ / 984 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 985 \ / 986 / Padding (if needed) \ 987 \ / 988 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 990 Figure 7: NTPv4 Extension Field Format 992 Each extension field is zero-padded to a 4-octet boundary. The 993 Length field covers the entire extension field, including the Length 994 and Padding fields. While the minimum field length is 8 octets, a 995 maximum field length remains to be established. The reference 996 implementation discards any packet with a field length more than 1024 997 octets. 999 The extension field parser initializes a pointer to the first octet 1000 beyond the NTP header fields and calculates the number of octets 1001 remaining in the packet. If this value is 20 the remaining data is 1002 the MAC and parsing is complete. If greater than 20 an extension 1003 field is present. If the length is less than 4 or not a multiple of 1004 4, a format error has occurred and the packet is discarded; 1005 otherwise, the parser increments the pointer by the length and then 1006 uses the same rules as above to determine whether a MAC is present or 1007 another extension field. 1009 In Autokey the 8-bit Field Type field is interpreted as the version 1010 number, currently 2. For future versions values 1-7 have been 1011 reserved for Autokey; other values may be assigned for other 1012 applications. The 6-bit Code field specifies the request or response 1013 operation. There are two flag bits: bit 0 is the Response Flag (R) 1014 and bit 1 is the Error Flag (E); the Reserved field is unused and 1015 should be set to 0. The remaining fields will be described later. 1017 In the most common protocol operations, a client sends a request to a 1018 server with an operation code specified in the Code field and both 1019 the R bit and E bit dim. The Association ID field is set to the 1020 value previously received from the server or 0 otherwise. The server 1021 returns a response with the same operation code in the Code field and 1022 lights the R bit. The server can also light the E bit in case of 1023 error. The Association ID field is set to the association ID of the 1024 server as a handle for subsequent exchanges. If for some reason the 1025 association ID value in a request does not match the association ID 1026 of any mobilized association, the server returns the request with 1027 both the R and E bits lit. Note that it is not necessarily a 1028 protocol error to send an unsolicited response with no matching 1029 request. 1031 In some cases not all fields may be present. For requests, until a 1032 client has synchronized to a proventic source, signatures are not 1033 valid. In such cases the Timestamp and Signature Length fields are 0 1034 and the Signature field is empty. Some request and error response 1035 messages carry no value or signature fields, so in these messages 1036 only the first two words are present. 1038 The Timestamp and Filestamp words carry the seconds field of an NTP 1039 timestamp. The timestamp establishes the signature epoch of the data 1040 field in the message, while the filestamp establishes the generation 1041 epoch of the file that ultimately produced the data that is signed. 1042 A signature and timestamp are valid only when the signing host is 1043 synchronized to a proventic source; otherwise, the timestamp is zero. 1044 A cryptographic data file can only be generated if a signature is 1045 possible; otherwise, the filestamp is zero, except in the ASSOC 1046 response message, where it contains the server status word. 1048 As in all other TIP/IP protocol designs, all data are sent in network 1049 byte order. Unless specified otherwise in the descriptions to 1050 follow, the data referred to are stored in the Value field. 1052 10.1. No-Operation 1054 A No-operation request (Field Type 0) does nothing except return an 1055 empty response which can be used as a crypto-ping. 1057 10.2. Association Message (ASSOC) 1059 An Association Message (Field Type 1) is used in the parameter 1060 exchange to obtain the host name and status word. The request 1061 contains the client status word in the Filestamp field and the 1062 Autokey host name in the Value field. The response contains the 1063 server status word in the Filestamp field and the Autokey host name 1064 in the Value field. The Autokey host name is not necessarily the DNS 1065 host name. A valid response lights the ENAB bit and possibly others 1066 in the association status word. 1068 When multiple identity schemes are supported, the host status word 1069 determine which ones are available. In server and symmetric modes 1070 the response status word contains bits corresponding to the supported 1071 schemes. In all modes the scheme is selected based on the client 1072 identity parameters which are loaded at startup. 1074 10.3. Certificate Message (CERT) 1076 A Certificate Message (Field Type 2) is used in the certificate 1077 exchange to obtain a certificate by subject name. The request 1078 contains the subject name; the response contains the certificate 1079 encoded in X.509 format with ASN.1 syntax as described in Appendix H. 1081 If the subject name in the response does not match the issuer name, 1082 the exchange continues with the issuer name replacing the subject 1083 name in the request. The exchange continues until a trusted, self- 1084 signed certificate is found and lights the CERT bit in the 1085 association status word. 1087 10.4. Cookie Message (COOKIE) 1089 The Cookie Message (Field Type 3) is used in server and symmetric 1090 modes to obtain the server cookie. The request contains the host 1091 public key encoded with ASN.1 syntax as described in Appendix H. The 1092 response contains the cookie encrypted by the public key in the 1093 request. A valid response lights the COOKIE bit in the association 1094 status word. 1096 10.5. Autokey Message (AUTO) 1098 The Autokey Message (Field Type 4) is used to obtain the autokey 1099 values. The request contains no value for a client or the autokey 1100 values for a symmetric peer. The response contains two 32-bit words, 1101 the first is the final key ID, while the second is the index of the 1102 final key ID. A valid response lights the AUTO bit in the 1103 association status word. 1105 10.6. Leapseconds Values Message (LEAP) 1107 The Leapseconds Values Message (Field Type 5) is used to obtain the 1108 leapseconds values as parsed from the leapseconds table from NIST. 1109 The request contains no values. The response contains three 32-bit 1110 integers: first the NTP seconds of the latest leap event followed by 1111 the NTP seconds when the latest NIST table expires and then the TAI 1112 offset following the leap event. A valid response lights the LEAP 1113 bit in the association status word. 1115 10.7. Sign Message (SIGN) 1117 The Sign Message (Field Type 6) requests the server to sign and 1118 return a certificate presented in the request. The request contains 1119 the client certificate encoded in X.509 format with ASN.1 syntax as 1120 described in Appendix H. The response contains the client 1121 certificate signed by the server private key. A valid response 1122 lights the SIGN bit in the association status word. 1124 10.8. Identity Messages (IFF, GQ, MV) 1126 The Identity Messages (Field Type 7 (IFF), 8 (GQ), or 9 (MV)) 1127 contains the client challenge, usually a 160- or 512-bit nonce. The 1128 response contains the result of the mathematical operation defined in 1129 Appendix B. The Response is encoded in ASN.1 syntax as described in 1130 Appendix H. A valid response lights the VRFY bit in the association 1131 status word. 1133 11. Autokey State Machine 1135 This section describes the formal model of the Autokey state machine, 1136 its state variables and the state transition functions. 1138 11.1. Status Word 1140 The server implements a host status word, while each client 1141 implements an association status word. These words have the format 1142 and content shown in Figure 8. The low order 16 bits of the status 1143 word define the state of the Autokey dance, while the high order 16 1144 bits specify the message digest/signature encryption scheme as 1145 encoded in the OpenSSL library. Bits 24-31 are reserved for server 1146 use, while bits 16-23 are reserved for client use. In the host 1147 portion bits 24-27 specify the available identity schemes, while bits 1148 28-31 specify the server capabilities. There are two additional bits 1149 implemented separately. 1151 1 2 3 1152 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 1153 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1154 | Digest / Signature NID | Client | Ident | Host | 1155 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1157 Figure 8: Status Word 1159 The host status word is included in the ASSOC request and response 1160 messages. The client copies this word to the association status word 1161 and then lights additional bits as the dance proceeds. Once enabled, 1162 these bits ordinarily never come dark unless a general reset occurs 1163 and the protocol is restarted from the beginning. 1165 The host status bits are defined as follows: 1167 o ENAB (31) Lit if the server implements the Autokey protocol. 1169 o LVAL (30) Lit if the server has installed leapseconds values, 1170 either from the NIST leapseconds file or from another server. 1172 o Bits (28-29) are reserved - always dark. 1174 o Bits 24-27 select which server identity schemes are available. 1175 While specific coding for various schemes is yet to be determined, 1176 the schemes available in the reference implementation and 1177 described in Appendix B include the following: 1179 * none - Trusted Certificate (TC) Scheme (default). 1181 * PC (27) Private Certificate Scheme. 1183 * IFF (26) Schnorr aka Identify-Friendly-or-Foe Scheme. 1185 * GQ (25) Guillard-Quisquater Scheme. 1187 * MV (24) Mu-Varadharajan Scheme. 1189 o The PC scheme is exclusive of any other scheme. Otherwise, the 1190 IFF, GQ and MV bits can be enabled in any combination. 1192 The association status bits are defined as follows: 1194 o CERT (23) Lit when the trusted host certificate and public key are 1195 validated. 1197 o VRFY (22) Lit when the trusted host identity credentials are 1198 confirmed. 1200 o PROV (21) Lit when the server signature is verified using its 1201 public key and identity credentials. Also called the proventic 1202 bit elsewhere in this memo. When enabled, signed values in 1203 subsequent messages are presumed proventic. 1205 o COOK (20) Lit when the cookie is received and validated. When 1206 lit, key lists with nonzero cookies are generated; when dim, the 1207 cookie is zero. 1209 o AUTO (19) Lit when the autokey values are received and validated. 1210 When lit, clients can validate packets without extension fields 1211 according to the autokey sequence. 1213 o SIGN (18) Lit when the host certificate is signed by the server. 1215 o LEAP (17) Lit when the leapseconds values are received and 1216 validated. 1218 o Bit 16 is reserved - always dark. 1220 There are three additional bits: LIST, SYNC and PEER not included in 1221 the association status word. LIST is lit when the key list is 1222 regenerated and dim when the autokey values have been transmitted. 1223 This is necessary to avoid resource starvation (livelock) under some 1224 conditions. SYNC is lit when the client has synchronized to a 1225 proventic source and never dim after that. PEER is lit when the 1226 server has synchronized, as indicated in the NTP header, and never 1227 dim after that. 1229 11.2. Host State Variables 1231 Following is a list of host state variables. 1233 Host Name - The name of the host, by default the string returned by 1234 the Unix gethostname() library function. In the reference 1235 implementation this is a configurable value. 1237 Host Status Word - This word is initialized when the host first 1238 starts up. The format is described above. 1240 Host Key - The RSA public/private key pair used to encrypt/decrypt 1241 cookies. This is also the default sign key. 1243 Sign Key - The RSA or DSA public/private key pair used to encrypt/ 1244 decrypt signatures when the host key is not used for this purpose. 1246 Sign Digest - The message digest algorithm used to compute the 1247 message digest before encryption. 1249 IFF Parameters - The parameters used in the optional IFF identity 1250 scheme described in Appendix B. 1252 GQ Parameters - The parameters used in the optional GQ identity 1253 scheme described in Appendix B. 1255 MV Parameters - The parameters used in the optional MV identity 1256 scheme described in Appendix B. 1258 Server Seed - The private value hashed with the IP addresses and key 1259 identifier to construct the cookie. 1261 Certificate Information Structure (CIS) - This structure includes 1262 certain information fields from an X.509v3 certificate, together with 1263 the certificate itself. The fields extracted include the subject and 1264 issuer names, subject public key and message digest algorithm 1265 (pointers), and the beginning and end of the valid period in NTP 1266 seconds. 1268 The certificate itself is stored as an extension field in network 1269 byte order so it can be copied intact to the message. The structure 1270 is signed using the sign key and carries the public values timestamp 1271 at signature time and the filestamp of the original certificate file. 1272 The structure is used by the CERT response message and SIGN request 1273 and response messages. 1275 A flags field in the CIS determines the status of the certificate. 1276 The field is encoded as follows: 1278 o TRUST (0x01) - The certificate has been signed by a trusted 1279 issuer. If the certificate is self-signed and contains 1280 "trustRoot" in the Extended Key Usage field, this bit is lit when 1281 the CIS is constructed. 1283 o SIGN (0x02) - The certificate signature has been verified. If the 1284 certificate is self-signed and verified using the contained public 1285 key, this bit is lit when the CIS is constructed. 1287 o VALID (0x04) - The certificate is valid and can be used to verify 1288 signatures. This bit is lit when a trusted certificate has been 1289 found on a valid certificate trail. 1291 o PRIV (0x08) - The certificate is private and not to be revealed. 1292 If the certificate is self-signed and contains "Private" in the 1293 Extended Key Usage field, this bit is lit when the CIS is 1294 constructed. 1296 o ERROR (0x80) - The certificate is defective and not to be used in 1297 any way. 1299 Certificate List - CIS structures are stored on the certificate list 1300 in order of arrival, with the most recently received CIS placed first 1301 on the list. The list is initialized with the CIS for the host 1302 certificate, which is read from the host certificate file. 1303 Additional CIS entries are added to the list as certificates are 1304 obtained from the servers during the certificate exchange. CIS 1305 entries are discarded if overtaken by newer ones. 1307 The following values are stored as an extension field structure in 1308 network byte order so they can be copied intact to the message. They 1309 are used to send some Autokey requests and responses. All but the 1310 Host Name Values structure are signed using the sign key and all 1311 carry the public values timestamp at signature time. 1313 Host Name Values. This is used to send ASSOC request and response 1314 messages. It contains the host status word and host name. 1316 Public Key Values - This is used to send the COOKIE request message. 1317 It contains the public encryption key used for the COOKIE response 1318 message. 1320 Leapseconds Values. This is used to send the LEAP response message. 1321 In contains the leapseconds values in the LEAP message description. 1323 11.3. Client State Variables (all modes) 1325 Following is a list of state variables used by the various dances in 1326 all modes. 1328 Association ID - The association ID used in responses. It is 1329 assigned when the association is mobilized. 1331 Association Status Word - The status word copied from the ASSOC 1332 response; subsequently modified by the state machine. 1334 Subject Name - The server host name copied from the ASSOC response. 1336 Issuer Name - The host name signing the certificate. It is extracted 1337 from the current server certificate upon arrival and used to request 1338 the next host on the certificate trail. 1340 Server Public Key - The public key used to decrypt signatures. It is 1341 extracted from the server host certificate. 1343 Server Message Digest - The digest/signature scheme determined in the 1344 parameter exchange. 1346 Group Key - A set of values used by the identity exchange. It 1347 identifies the cryptographic compartment shared by the server and 1348 client. 1350 Receive Cookie Values - The cookie returned in a COOKIE response, 1351 together with its timestamp and filestamp 1353 Receive Autokey Values - The autokey values returned in an AUTO 1354 response, together with its timestamp and filestamp. 1356 Send Autokey Values - The autokey values with signature and 1357 timestamps. 1359 Key List - A sequence of key IDs starting with the autokey seed and 1360 each pointing to the next. It is computed, timestamped and signed at 1361 the next poll opportunity when the key list becomes empty. 1363 Current Key Number - The index of the entry on the Key List to be 1364 used at the next poll opportunity. 1366 11.4. Protocol State Transitions 1368 The protocol state machine is very simple but robust. The state is 1369 determined by the client status word bits defined above. The state 1370 transitions of the three dances are shown below. The capitalized 1371 truth values represent the client status bits. All bits are 1372 initialized dark and are lit upon the arrival of a specific response 1373 message as detailed above. 1375 11.4.1. Server Dance 1377 The server dance begins when the client sends an ASSOC request to the 1378 server. The clock is updated when PREV is lit and the dance ends 1379 when LEAP is lit. In this dance the autokey values are not used, so 1380 an autokey exchange is not necessary. Note that the SIGN and LEAP 1381 requests are not issued until the client has synchronized to a 1382 proventic source. Subsequent packets without extension fields are 1383 validated by the autokey sequence. The following example and others 1384 assume the IFF identity scheme has been selected in the parameter 1385 exchange.. 1387 1 while (1) { 1388 2 wait_for_next_poll; 1389 3 make_NTP_header; 1390 4 if (response_ready) 1391 5 send_response; 1392 6 if (!ENB) /* parameter exchange */ 1393 7 ASSOC_request; 1394 8 else if (!CERT) /* certificate exchange */ 1395 9 CERT_request(Host_Name); 1396 10 else if (!IFF) /* identity exchange */ 1397 11 IFF_challenge; 1398 12 else if (!COOK) /* cookie exchange */ 1399 13 COOKIE_request; 1400 14 else if (!SYNC) /* synchronization wait */ 1401 15 continue; 1402 16 else if (!SIGN) /* sign exchange */ 1403 17 SIGN_request(Host_Certificate); 1404 18 else if (!LEAP) /* leap sec value exchange */ 1405 19 LEAP_request; 1406 20 send packet; 1407 21 } 1409 Figure 9: Server Dance 1411 If the server refreshes the private seed, the cookie becomes invalid. 1412 The server responds to an invalid cookie with a crypto_NAK message, 1413 which causes the client to restart the protocol from the beginning. 1415 11.4.2. Broadcast Dance 1417 The broadcast dance is similar to the server dance with the cookie 1418 exchange replaced by the autokey values exchange. The broadcast 1419 dance begins when the client receives a broadcast packet including an 1420 ASSOC response with the server association ID. This mobilizes a 1421 client association in order to proventicate the source and calibrate 1422 the propagation delay. The dance ends when the LEAP bit is lit, 1423 after which the client sends no further packets. Normally, the 1424 broadcast server includes an ASSOC response in each transmitted 1425 packet. However, when the server generates a new key list, it 1426 includes an AUTO response instead. 1428 In the broadcast dance extension fields are used with every packet, 1429 so the cookie is always zero and no cookie exchange is necessary. As 1430 in the server dance, the clock is updated when PREV is lit and the 1431 dance ends when LEAP is lit. Note that the SIGN and LEAP requests 1432 are not issued until the client has synchronized to a proventic 1433 source. Subsequent packets without extension fields are validated by 1434 the autokey sequence. 1436 1 while (1) { 1437 2 wait_for_next_poll; 1438 3 make_NTP_header; 1439 4 if (response_ready) 1440 5 send_response; 1441 6 if (!ENB) /* parameters exchange */ 1442 7 ASSOC_request; 1443 8 else if (!CERT) /* certificate exchange */ 1444 9 CERT_request(Host_Name); 1445 10 else if (!IFF) /* identity exchange */ 1446 11 IFF_challenge; 1447 12 else if (!AUT) /* autokey values exchange */ 1448 13 AUTO_request; 1449 14 else if (!SYNC) /* synchronization wait */ 1450 15 continue; 1451 16 else if (!SIGN) /* sign exchange */ 1452 17 SIGN_request(Host_Certificate); 1453 18 else if (!LEAP) /* leap sec value exchange */ 1454 19 LEAP_request; 1455 20 send NTP_packet; 1456 21 } 1458 Figure 10: Server Dance 1460 If a packet is lost and the autokey sequence is broken, the client 1461 hashes the current autokey until either it matches the previous 1462 autokey or the number of hashes exceeds the count given in the 1463 autokey values. If the latter, the client sends an AUTO request to 1464 retrieve the autokey values. If the client receives a crypto-NAK 1465 during the dance, or if the association ID changes, the client 1466 restarts the protocol from the beginning. 1468 11.4.3. Symmetric Dance 1470 The symmetric dance is intricately choreographed. It begins when the 1471 active peer sends an ASSOC request to the passive peer. The passive 1472 peer mobilizes an association and both peers step a three-way dance 1473 where each peer completes a parameter exchange with the other. Until 1474 one of the peers has synchronized to a proventic source (which could 1475 be the other peer) and can sign messages, the other peer loops 1476 waiting for a valid timestamp in the ensuing CERT response. 1478 1 while (1) { 1479 2 wait_for_next_poll; 1480 3 make_NTP_header; 1481 4 if (!ENB) /* parameters exchange */ 1482 5 ASSOC_request; 1483 6 else if (!CERT) /* certificate exchange */ 1484 7 CERT_request(Host_Name); 1485 8 else if (!IFF) /* identity exchange */ 1486 9 IFF_challenge; 1487 10 else if (!COOK && PEER) /* cookie exchange */ 1488 11 COOKIE_request); 1489 12 else if (!AUTO) /* autokey values exchange */ 1490 13 AUTO_request; 1491 14 else if (LIST) /* autokey values response */ 1492 15 AUTO_response; 1493 16 else if (!SYNC) /* synchronization wait */ 1494 17 continue; 1495 18 else if (!SIGN) /* sign exchange */ 1496 19 SIGN_request; 1497 20 else if (!LEAP) /* leap sec value exchange */ 1498 21 LEAP_request; 1499 22 send NTP_packet; 1500 23 } 1502 Figure 11: Symmetric Dance 1504 Once a peer has synchronized to a proventic source, it includes 1505 timestamped signatures in its messages. The other peer, which has 1506 been stalled waiting for valid timestamps, now mates the dance. It 1507 retrives the now nonzero cookie using a cookie exchange and then the 1508 updated autokey values using an autokey exchange. 1510 As in the broadcast dance, if a packet is lost and the autokey 1511 sequence broken, the peer hashes the current autokey until either it 1512 matches the previous autokey or the number of hashes exceeds the 1513 count given in the autokey values. If the latter, the client sends 1514 an AUTO request to retrive the autokey values. If the peer receives 1515 a crypto-NAK during the dance, or if the association ID changes, the 1516 peer restarts the protocol from the beginning. 1518 11.5. Error Recovery 1520 The Autokey protocol state machine includes provisions for various 1521 kinds of error conditions that can arise due to missing files, 1522 corrupted data, protocol violations and packet loss or misorder, not 1523 to mention hostile intrusion. This section describes how the 1524 protocol responds to reachability and timeout events which can occur 1525 due to such errors. 1527 A persistent NTP association is mobilized by an entry in the 1528 configuration file, while an ephemeral association is mobilized upon 1529 the arrival of a broadcast or symmetric active packet with no 1530 matching association. Subsequently, a general reset reinitializes 1531 all association variables to the initial state when first mobilized. 1532 In addition, if the association is ephemeral, the association is 1533 demobilized and all resources acquired are returned to the system. 1535 Every NTP association has two variables which maintain the liveness 1536 state of the protocol, the 8-bit reach register and the unreach 1537 counter defined in [I-D.ietf-ntp-ntpv4-proto]. At every poll 1538 interval the reach register is shifted left, the low order bit is 1539 dimmed and the high order bit is lost. At the same time the unreach 1540 counter is incremented by one. If an arriving packet passes all 1541 authentication and sanity checks, the rightmost bit of the reach 1542 register is lit and the unreach counter is set to zero. If any bit 1543 in the reach register is lit, the server is reachable, otherwise it 1544 is unreachable. 1546 When the first poll is sent from an association, the reach register 1547 and unreach counter are set to zero. If the unreach counter reaches 1548 16, the poll interval is doubled. In addition, if association is 1549 persistent, it is demobilized. This reduces the network load for 1550 packets that are unlikely to elicit a response. 1552 At each state in the protocol the client expects a particular 1553 response from the server. A request is included in the NTP packet 1554 sent at each poll interval until a valid response is received or a 1555 general reset occurs, in which case the protocol restarts from the 1556 beginning. A general reset also occurs for an association when an 1557 unrecoverable protocol error occurs. A general reset occurs for all 1558 associations when the system clock is first synchronized or the clock 1559 is stepped or when the server seed is refreshed. 1561 There are special cases designed to quickly respond to broken 1562 associations, such as when a server restarts or refreshes keys. 1563 Since the client cookie is invalidated, the server rejects the next 1564 client request and returns a crypto-NAK packet. Since the crypto-NAK 1565 has no MAC, the problem for the client is to determine whether it is 1566 legitimate or the result of intruder mischief. In order to reduce 1567 the vulnerability in such cases, the crypto-NAK, as well as all 1568 responses, is believed only if the result of a previous packet sent 1569 by the client is not a replay, as confirmed by the NTP on-wire 1570 protocol. While this defense can be easily circumvented by a 1571 middleman, it does deflect other kinds of intruder warfare. 1573 There are a number of situations where some event happens that causes 1574 the remaining autokeys on the key list to become invalid. When one 1575 of these situations happens, the key list and associated autokeys in 1576 the key cache are purged. A new key list, signature and timestamp 1577 are generated when the next NTP message is sent, assuming there is 1578 one. Following is a list of these situations: 1580 1. When the cookie value changes for any reason. 1582 2. When the poll interval is changed. In this case the calculated 1583 expiration times for the keys become invalid. 1585 3. If a problem is detected when an entry is fetched from the key 1586 list. This could happen if the key was marked non-trusted or 1587 timed out, either of which implies a software bug. 1589 11.6. Security Considerations 1591 This section discusses the most obvious security vulnerabilities in 1592 the various Autokey dances. In the following discussion the 1593 cryptographic algorithms and private values themselves are assumed 1594 secure; that is, a brute force cryptanalytic attack will not reveal 1595 the host private key, sign private key, cookie value, identity 1596 parameters, server seed or autokey seed. In addition, an intruder 1597 will not be able to predict random generator values. 1599 11.7. Protocol Vulnerability 1601 While the protocol has not been subjected to a formal analysis, a few 1602 preliminary assertions can be made. In the client/server and 1603 symmetric dances the underlying NTP on-wire protocol is resistant to 1604 lost, duplicate and bogus packets, even if the clock is not 1605 synchronized, so the protocol is not vulnerable to a wiretapper 1606 attack. A middleman attack, even if it could simulate a valid 1607 cookie, could not present a valid signature. 1609 In the broadcast dance the client begins with a volley in client/ 1610 server mode to obtain the autokey values and signature, so has the 1611 same protection as in that mode. When continuing in receive-only 1612 mode, a wiretapper cannot produce a key list with valid signed 1613 autokey values. If it replays an old packet, the client will reject 1614 it by the timestamp check. The most it can do is manufacture a 1615 future packet causing clients to repeat the autokey hash operations 1616 until exceeding the maximum key number. If this happens the 1617 broadcast client temporarily reverts to client mode to refresh the 1618 autokey values. 1620 A client instantiates cryptographic variables only if the server is 1621 synchronized to a proventic source. A server does not sign values or 1622 generate cryptographic data files unless synchronized to a proventic 1623 source. This raises an interesting issue: how does a client generate 1624 proventic cryptographic files before it has ever been synchronized to 1625 a proventic source? [Who shaves the barber if the barber shaves 1626 everybody in town who does not shave himself?] In principle, this 1627 paradox is resolved by assuming the primary (stratum 1) servers are 1628 proventicated by external phenomenological means. 1630 11.8. Clogging Vulnerability 1632 A self-induced clogging incident cannot happen, since signatures are 1633 computed only when the data have changed and the data do not change 1634 very often. For instance, the autokey values are signed only when 1635 the key list is regenerated, which happens about once an hour, while 1636 the public values are signed only when one of them is updated during 1637 a dance or the server seed is refreshed, which happens about once per 1638 day. 1640 There are two clogging vulnerabilities exposed in the protocol 1641 design: an encryption attack where the intruder hopes to clog the 1642 victim server with needless cryptographic calculations, and a 1643 decryption attack where the intruder attempts to clog the victim 1644 client with needless cryptographic calculations. Autokey uses public 1645 key cryptography and the algorithms that perform these functions 1646 consume significant resources. 1648 In client/server and peer dances an encryption hazard exists when a 1649 wiretapper replays prior cookie request messages at speed. There is 1650 no obvious way to deflect such attacks, as the server retains no 1651 state between requests. Replays of cookie request or response 1652 messages are detected and discarded by the client on-wire protocol. 1654 In broadcast mode a client a decryption hazard exists when a 1655 wiretapper replays autokey response messages at speed. Once 1656 synchronized to a proventic source, a legitimate extension field with 1657 timestamp the same as or earlier than the most recently received of 1658 that type is immediately discarded. This foils a middleman cut-and- 1659 paste attack using an earlier response, for example. A legitimate 1660 extension field with timestamp in the future is unlikely, as that 1661 would require predicting the autokey sequence. However, this causes 1662 the client to refresh and verify the autokey values and signature. 1664 A determined middleman can modify a recent packet with an intentional 1665 bit error. A stateless server will return a crypto-NAK message which 1666 will cause the client to perform a general reset. The middleman can 1667 do other things as well and have nothing to do with Autokey. 1669 12. IANA Considerations 1671 IANA is requested to add to the Extension Field Types associated with 1672 the NTP protocol (see [I-D.ietf-ntp-ntpv4-proto], section 16), the 1673 values 1 through 7 for the Autokey PRotocol. 1675 13. References 1677 13.1. Normative References 1679 [I-D.ietf-ntp-ntpv4-proto] 1680 Burbank, J., "Network Time Protocol Version 4 Protocol And 1681 Algorithms Specification", draft-ietf-ntp-ntpv4-proto-11 1682 (work in progress), September 2008. 1684 13.2. Informative References 1686 [DASBUCH] Mills, D., "Compouter Network Time Synchronization - the 1687 Network Time Protocol", 2006. 1689 [GUILLOU] Guillou, L. and J. Quisquatar, "A "paradoxical" identity- 1690 based signature scheme resulting from zero-knowledge", 1691 1990. 1693 [MV] Mu, Y. and V. Varadharajan, "Robust and secure 1694 broadcasting", 2001. 1696 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 1697 Specification, Implementation", RFC 1305, March 1992. 1699 [RFC2402] Kent, S. and R. Atkinson, "IP Authentication Header", 1700 RFC 2402, November 1998. 1702 [RFC2406] Kent, S. and R. Atkinson, "IP Encapsulating Security 1703 Payload (ESP)", RFC 2406, November 1998. 1705 [RFC2408] Maughan, D., Schneider, M., and M. Schertler, "Internet 1706 Security Association and Key Management Protocol 1707 (ISAKMP)", RFC 2408, November 1998. 1709 [RFC2412] Orman, H., "The OAKLEY Key Determination Protocol", 1710 RFC 2412, November 1998. 1712 [RFC2510] Adams, C. and S. Farrell, "Internet X.509 Public Key 1713 Infrastructure Certificate Management Protocols", 1714 RFC 2510, March 1999. 1716 [RFC2522] Karn, P. and W. Simpson, "Photuris: Session-Key Management 1717 Protocol", RFC 2522, March 1999. 1719 [RFC2875] Prafullchandra, H. and J. Schaad, "Diffie-Hellman Proof- 1720 of-Possession Algorithms", RFC 2875, July 2000. 1722 [RFC3279] Bassham, L., Polk, W., and R. Housley, "Algorithms and 1723 Identifiers for the Internet X.509 Public Key 1724 Infrastructure Certificate and Certificate Revocation List 1725 (CRL) Profile", RFC 3279, April 2002. 1727 [RFC3280] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet 1728 X.509 Public Key Infrastructure Certificate and 1729 Certificate Revocation List (CRL) Profile", RFC 3280, 1730 April 2002. 1732 [SCHNORR] Schnorr, C., "Efficient signature generation for smart 1733 cards", 1991. 1735 [STINSON] Stinson, D., "Cryptography - Theory and Practice", 1995. 1737 Appendix A. Timestamps, Filestamps and Partial Ordering 1739 When the host starts, it reads the host key and host certificate 1740 files, which are required for continued operation. It also reads the 1741 sign key and leapseconds values, when available. When reading these 1742 files the host checks the file formats and filestamps for validity; 1743 for instance, all filestamps must be later than the time the UTC 1744 timescale was established in 1972 and the certificate filestamp must 1745 not be earlier than its associated sign key filestamp. At the time 1746 the files are read the host is not synchronized, so it cannot 1747 determine whether the filestamps are bogus other than these simple 1748 checks. It must not produce filestamps or timestamps until 1749 synchronized to a proventic source. 1751 In the following the relation A --> B is Lamport's "happens before" 1752 relation, which is true if event A happens before event B. When 1753 timestamps are compared to timestamps, the relation is false if A 1754 <--> B; that is, false if the events are simultaneous. For 1755 timestamps compared to filestamps and filestamps compared to 1756 filestamps, the relation is true if A <--> B. Note that the current 1757 time plays no part in these assertions except in (6) below; however, 1758 the NTP protocol itself insures a correct partial ordering for all 1759 current time values. 1761 The following assertions apply to all relevant responses: 1763 1. The client saves the most recent timestamp T0 and filestamp F0 1764 for the respective signature type. For every received message 1765 carrying timestamp T1 and filestamp F1, the message is discarded 1766 unless T0 --> T1 and F0 --> F1. The requirement that T0 --> T1 1767 is the primary defense against replays of old messages. 1769 2. For timestamp T and filestamp F, F --> T; that is, the filestamp 1770 must happen before the timestamp. If not, this could be due to a 1771 file generation error or a significant error in the system clock 1772 time. 1774 3. For sign key filestamp S, certificate filestamp C, cookie 1775 timestamp D and autokey timestamp A, S --> C --> D --> A; that 1776 is, the autokey must be generated after the cookie, the cookie 1777 after the certificate and the certificate after the sign key. 1779 4. For sign key filestamp S and certificate filestamp C specifying 1780 begin time B and end time E, S --> C--> B --> E; that is, the 1781 valid period must not be retroactive. 1783 5. A certificate for subject S signed by issuer I and with filestamp 1784 C1 obsoletes, but does not necessarily invalidate, another 1785 certificate with the same subject and issuer but with filestamp 1786 C0, where C0 --> C1. 1788 6. A certificate with begin time B and end time E is invalid and can 1789 not be used to verify signatures if t --> B or E --> t, where t 1790 is the current proventic time. Note that the public key 1791 previously extracted from the certificate continues to be valid 1792 for an indefinite time. This raises the interesting possibility 1793 where a truechimer server with expired certificate or a 1794 falseticker with valid certificate are not detected until the 1795 client has synchronized to a proventic source. 1797 Appendix B. Identity Schemes 1799 There are five identity schemes in the NTPv4 reference 1800 implementation: (1) private certificate (PC), (2) trusted certificate 1801 (TC), (3) a modified Schnorr algorithm (IFF - Identify Friend or 1802 Foe), (4) a modified Guillou-Quisquater algorithm (GQ), and (5) a 1803 modified Mu-Varadharajan algorithm (MV). 1805 The PC scheme is intended for testing and development and not 1806 recommended for general use. The TC scheme uses a certificate trail, 1807 but not an identity scheme. The IFF, GQ and MV identity schemes use 1808 a cryptographically strong challenge-response exchange where an 1809 intruder cannot learn the group key, even after repeated observations 1810 of multiple exchanges. These schemes begin when the client sends a 1811 nonce to the server, which then rolls its own nonce, performs a 1812 mathematical operation and sends the results to the client. The 1813 client performs a second mathematical operation to prove the server 1814 has the same group key as the client. 1816 Appendix C. Private Certificate (PC) Scheme 1818 The PC scheme shown in Figure 12 uses a private certificate as the 1819 group key. 1821 Trusted 1822 Authority 1823 Secure +-------------+ Secure 1824 +--------------| Certificate |-------------+ 1825 | +-------------+ | 1826 | | 1827 \|/ \|/ 1828 +-------------+ +-------------+ 1829 | Certificate | | Certificate | 1830 +-------------+ +-------------+ 1831 Server Client 1833 Figure 12: Private Certificate (PC) Identity Scheme 1835 A certificate is designated private when the X509v3 Extended Key 1836 Usage extension field is present and contains "Private". The private 1837 certificate is distributed to all other group members by secret 1838 means, so in fact becomes a symmetric key. Private certificates are 1839 also trusted, so there is no need for a certificate trail or identity 1840 scheme. 1842 Appendix D. Trusted Certificate (TC) Scheme 1844 All other schemes involve a conventional certificate trail as shown 1845 in Figure 13. 1847 Trusted 1848 Host Host Host 1849 +-----------+ +-----------+ +-----------+ 1850 +--->| Subject | +--->| Subject | +--->| Subject | 1851 | +-----------+ | +-----------+ | +-----------+ 1852 ...---+ | Issuer |---+ | Issuer |---+ | Issuer | 1853 +-----------+ +-----------+ +-----------+ 1854 | Signature | | Signature | | Signature | 1855 +-----------+ +-----------+ +-----------+ 1857 Figure 13: Trusted Certificate (TC) Identity Scheme 1859 As described in RFC-2510 [RFC2510], each certificate is signed by an 1860 issuer one step closer to the trusted host, which has a self-signed 1861 trusted certificate. A certificate is designated trusted when an 1862 X509v3 Extended Key Usage extension field is present and contains 1863 "trustRoot". If no identity scheme is specified in the parameter 1864 exchange, this is the default scheme. 1866 Appendix E. Schnorr (IFF) Identity Scheme 1868 The IFF scheme is useful when the group key is concealed, so that 1869 client keys need not be protected. The primary disadvantage is that 1870 when the server key is refreshed all hosts must update the client 1871 key. The scheme shown in Figure 14 involves a set of public 1872 parameters and a group key including both private and public 1873 components. The public component is the client key. 1875 Trusted 1876 Authority 1877 +------------+ 1878 | Parameters | 1879 Secure +------------+ Insecure 1880 +-------------| Group Key |-----------+ 1881 | +------------+ | 1882 \|/ \|/ 1883 +------------+ Challenge +------------+ 1884 | Parameters |<------------------------| Parameters | 1885 +------------+ +------------+ 1886 | Group Key |------------------------>| Client Key | 1887 +------------+ Response +------------+ 1888 Server Client 1890 Figure 14: Schnorr (IFF) Identity Scheme 1892 By happy coincidence, the mathematical principles on which IFF is 1893 based are similar to DSA. The scheme is a modification an algorithm 1894 described in [SCHNORR] and [STINSON] p. 285. The parameters are 1895 generated by routines in the OpenSSL library, but only the moduli p, 1896 q and generator g are used. The p is a 512-bit prime, g a generator 1897 of the multiplicative group Z_p* and q a 160-bit prime that divides 1898 (p-1) and is a qth root of 1 mod p; that is, g^q = 1 mod p. The TA 1899 rolls a private random group key b (0 < b < q), then computes public 1900 client key v = g^(q-b) mod p. The TA distributes (p, q, g, b) to all 1901 servers using secure means and (p, q, g, v) to all clients not 1902 necessarily using secure means. 1904 The TA hides IFF parameters and keys in an OpenSSL DSA cuckoo 1905 structure. The IFF parameters are identical to the DSA parameters, 1906 so the OpenSSL library can be used directly. The structure shown in 1907 FigureFigure 15 is written to a file as a DSA private key encoded in 1908 PEM. Unused structure members are set to one. 1910 +----------------------------------+-------------+ 1911 | IFF | DSA | Item | Include | 1912 +=========+==========+=============+=============+ 1913 | p | p | modulus | all | 1914 +---------+----------+-------------+-------------+ 1915 | q | q | modulus | all | 1916 +---------+----------+-------------+-------------+ 1917 | g | g | generator | all | 1918 +---------+----------+-------------+-------------+ 1919 | b | priv_key | group key | server | 1920 +---------+----------+-------------+-------------+ 1921 | v | pub_key | client key | client | 1922 +---------+----------+-------------+-------------+ 1924 Figure 15: IFF Identity Scheme Structure 1926 Alice challenges Bob to confirm identity using the following protocol 1927 exchange. 1929 1. Alice rolls random r (0 < r < q) and sends to Bob. 1931 2. Bob rolls random k (0 < k < q), computes y = k + br mod q and x = 1932 g^k mod p, then sends (y, hash(x)) to Alice. 1934 3. Alice computes z = g^y * v^r mod p and verifies hash(z) equals 1935 hash(x). 1937 If the hashes match, Alice knows that Bob has the group key b. 1939 Besides making the response shorter, the hash makes it effectively 1940 impossible for an intruder to solve for b by observing a number of 1941 these messages. The signed response binds this knowledge to Bob's 1942 private key and the public key previously received in his 1943 certificate. 1945 Appendix F. Guillard-Quisquater (GQ) Identity Scheme 1947 The GQ scheme is useful when the server key must be refreshed from 1948 time to time without changing the group key. The NTP utility 1949 programs include the GQ client key in the X509v3 Subject Key 1950 Identifier extension field. The primary disadvantage of the scheme 1951 is that the group key must be protected in both the server and 1952 client. A secondary disadvantage is that when a server key is 1953 refreshed, old extension fields no longer work. The scheme is shown 1954 in Figure 16a involves a set of public parameters and group key used 1955 to generate private server keys and client keys. 1957 Trusted 1958 Authority 1959 +------------+ 1960 | Parameters | 1961 Secure +------------+ Secure 1962 +-------------| Group Key |-----------+ 1963 | +------------+ | 1964 \|/ \|/ 1965 +------------+ Challenge +------------+ 1966 | Parameters |<------------------------| Parameters | 1967 +------------+ +------------+ 1968 | Group Key | | Group Key | 1969 +------------+ Response +------------+ 1970 | Server Key |------------------------>| Client Key | 1971 +------------+ +------------+ 1972 Server Client 1974 Figure 16: Schnorr (IFF) Identity Scheme 1976 By happy coincidence, the mathematical principles on which GQ is 1977 based are similar to RSA. The scheme is a modification of an 1978 algorithm described in [GUILLOU] and [STINSON] p. 300 (with errors). 1979 The parameters are generated by routines in the OpenSSL library, but 1980 only the moduli p and q are used. The 512-bit public modulus is 1981 n=pq, where p and q are secret large primes. The TA rolls random 1982 large prime b (0 < b < n) and distributes (n, b) to all group servers 1983 and clients using secure means, since an intruder in possession of 1984 these values could impersonate a legitimate server. The private 1985 server key and public client key are constructed later. 1987 The TA hides GQ parameters and keys in an OpenSSL RSA cuckoo 1988 structure. The GQ parameters are identical to the RSA parameters, so 1989 the OpenSSL library can be used directly. When generating a 1990 certificate, the server rolls random server key u (0 < u < n) and 1991 client key its inverse obscured by the group key v = (u^-1)^b mod n. 1992 These values replace the private and public keys normally generated 1993 by the RSA scheme. The client key is conveyed in a X.509 certificate 1994 extension. The updated GQ structure shown in Figure 17 is written as 1995 an RSA private key encoded in PEM. Unused structure members are set 1996 to one. 1998 +---------------------------------+-------------+ 1999 | GQ | RSA | Item | Include | 2000 +=========+==========+============+=============+ 2001 | n | n | modulus | all | 2002 +---------+----------+------------+-------------+ 2003 | b | e | group key | all | 2004 +---------+----------+------------+-------------+ 2005 | u | p | server key | server | 2006 +---------+----------+------------+-------------+ 2007 | v | q | client key | client | 2008 +---------+----------+------------+-------------+ 2010 Figure 17: GQ Identity Scheme Structure 2012 Alice challenges Bob to confirm identity using the following 2013 exchange. 2015 1. Alice rolls random r (0 < r < n) and sends to Bob. 2017 2. Bob rolls random k (0 < k < n) and computes y = ku^r mod n and x 2018 = k^b mod n, then sends (y, hash(x)) to Alice. 2020 3. Alice computes z = (v^r)*(y^b) mod n and verifies hash(z) equals 2021 hash(x). 2023 If the hashes match, Alice knows that Bob has the corresponding 2024 server key u. Besides making the response shorter, the hash makes it 2025 effectively impossible for an intruder to solve for u by observing a 2026 number of these messages. The signed response binds this knowledge 2027 to Bob's private key and the client key previously received in his 2028 certificate. 2030 Appendix G. Mu-Varadharajan (MV) Identity Scheme 2032 The MV scheme is perhaps the most interesting and flexible of the 2033 three challenge/response schemes, but is devilishly complicated. It 2034 is most useful when a small number of servers provide synchronization 2035 to a large client population where there might be considerable risk 2036 of compromise between and among the servers and clients. The client 2037 population can be partitioned into a modest number of subgroups, each 2038 associated with an individual client key. 2040 The TA generates an intricate cryptosystem involving encryption and 2041 decryption keys, together with a number of activation keys and 2042 associated client keys. The TA can activate and revoke individual 2043 client keys without changing the client keys themselves. The TA 2044 provides to the servers an encryption key E and partial decryption 2045 keys g-bar and g-hat which depend on the activated keys. The servers 2046 have no additional information and, in particular, cannot masquerade 2047 as a TA. In addition, the TA provides to each client j individual 2048 partial decryption keys x-bar_j and x-hat_j, which do not need to be 2049 changed if the TA activates or deactivates any client key. The 2050 clients have no further information and, in particular, cannot 2051 masquerade as a server or TA. 2053 The scheme uses an encryption algorithm similar to El Gamal 2054 cryptography and a polynomial formed from the expansion of product 2055 terms (x-x_1)(x-x_2)(x-x_3)...(x-x_n), as described in [MV]. The 2056 paper has significant errors and serious omissions. The cryptosystem 2057 is constructed so that, for every encryption key E its inverse is 2058 (g-bar^x-hat_j)(g-hat^x-bar_j) mod p for every j. This remains true 2059 if both quantities are raised to the power k mod p. The difficulty 2060 in finding E is equivalent to the discrete log problem. 2062 The scheme is shown in Figure 18. The TA generates the parameters, 2063 group key, server keys and client keys, one for each client, all of 2064 which must be protected to prevent theft of service. Note that only 2065 the TA has the group key, which is not known to either the servers or 2066 clients. In this sense the MV scheme is a zero-knowledge proof. 2068 Trusted 2069 Authority 2070 +------------+ 2071 | Parameters | 2072 +------------+ 2073 | Group Key | 2074 +------------+ 2075 | Server Key | 2076 Secure +------------+ Secure 2077 +-------------| Client Key |-----------+ 2078 | +------------+ | 2079 \|/ \|/ 2080 +------------+ Challenge +------------+ 2081 | Parameters |<------------------------| Parameters | 2082 +------------+ +------------+ 2083 | Server Key |------------------------>| Client Key | 2084 +------------+ Response +------------+ 2085 Server Client 2087 Figure 18: Mu-Varadharajan (MV) Identity Scheme 2089 The TA hides MV parameters and keys in OpenSSL DSA cuckoo structures. 2090 The MV parameters are identical to the DSA parameters, so the OpenSSL 2091 library can be used directly. The structure shown in the figures 2092 below are written to files as a the fkey encoded in PEM. Unused 2093 structure members are set to one. The Figure 19 shows the data 2094 structure used by the servers, while Figure Figure 20 shows the 2095 client data structure associated with each activation key. 2097 +---------------------------------+-------------+ 2098 | MV | DSA | Item | Include | 2099 +=========+==========+============+=============+ 2100 | p | p | modulus | all | 2101 +---------+----------+------------+-------------+ 2102 | q | q | modulus | server | 2103 +---------+----------+------------+-------------+ 2104 | E | g | private | server | 2105 | | | encrypt | | 2106 +---------+----------+------------+-------------+ 2107 | g-bar | priv_key | public | server | 2108 | | | decrypt | | 2109 +---------+----------+------------+-------------+ 2110 | g-hat | pub_key | public | server | 2111 | | | decrypt | | 2112 +---------+----------+------------+-------------+ 2113 Figure 19: MV Scheme Server Structure 2115 +---------------------------------+-------------+ 2116 | MV | DSA | Item | Include | 2117 +=========+==========+============+=============+ 2118 | p | p | modulus | all | 2119 +---------+----------+------------+-------------+ 2120 | x-bar_j | priv_key | public | client | 2121 | | | decrypt | | 2122 +---------+----------+------------+-------------+ 2123 | x-hat_j | pub_key | public | client | 2124 | | | decrypt | | 2125 +---------+----------+------------+-------------+ 2127 Figure 20: MV Scheme Client Structure 2129 The devil is in the details, which are beyond the scope of this memo. 2130 The steps in generating the cryptosystem activating the keys and 2131 generating the partial decryption keys are in [DASBUCH] page 170 ff. 2133 Alice challenges Bob to confirm identity using the following 2134 exchange. 2136 1. Alice rolls random r (0 < r < q) and sends to Bob. 2138 2. Bob rolls random k (0 < k < q) and computes the session 2139 encryption key E-prime = E^k mod p and partial decryption keys 2140 g-bar-prime = g-bar^k mod p and g-hat-prime = g-hat^k mod p. He 2141 encrypts x = E-prime * r mod p and sends (x, g-bar-prime, g-hat- 2142 prime) to Alice. 2144 3. Alice computes the session decryption key E^-1 = (g-bar-prime)^x- 2145 hat_j (g-hat-prime)^x-bar_j mod p and verifies that r = E^-1 x. 2147 Appendix H. ASN.1 Encoding Rules 2149 Certain value fields in request and response messages contain data 2150 encoded in ASN.1 distinguished encoding rules (DER). The BNF grammar 2151 for each encoding rule is given below along with the OpenSSL routine 2152 used for the encoding in the reference implementation. The object 2153 identifiers for the encryption algorithms and message digest/ 2154 signature encryption schemes are specified in [RFC3279]. The 2155 particular algorithms required for conformance are not specified in 2156 this memo. 2158 H.1. COOKIE request, IFF response, GQ response, MV response 2160 The value field of the COOKIE request message contains a sequence of 2161 two integers (n, e) encoded by the i2d_RSAPublicKey() routine in the 2162 OpenSSL distribution. In the request, n is the RSA modulus in bits 2163 and e is the public exponent. 2165 RSAPublicKey ::= SEQUENCE { 2166 n ::= INTEGER, 2167 e ::= INTEGER 2168 } 2170 The IFF and GQ responses contain a sequence of two integers (r, s) 2171 encoded by the i2d_DSA_SIG() routine in the OpenSSL distribution. In 2172 the responses, r is the challenge response and s is the hash of the 2173 private value. 2175 DSAPublicKey ::= SEQUENCE { 2176 r ::= INTEGER, 2177 s ::= INTEGER 2178 } 2180 The MV response contains a sequence of three integers (p, q, g) 2181 encoded by the i2d_DSAparams() routine in the OpenSSL library. In 2182 the response, p is the hash of the encrypted challenge value and (q, 2183 g) is the client portion of the decryption key. 2185 DSAparameters ::= SEQUENCE { 2186 p ::= INTEGER, 2187 q ::= INTEGER, 2188 g ::= INTEGER 2189 } 2191 H.2. Certificates 2193 Certificate extension fields are used to convey information used by 2194 the identity schemes. While the semantics of these fields generally 2195 conforms with conventional usage, there are subtle variations. The 2196 fields used by Autokey Version 2 include: 2198 o Basic Constraints. This field defines the basic functions of the 2199 certificate. It contains the string "critical,CA:TRUE", which 2200 means the field must be interpreted and the associated private key 2201 can be used to sign other certificates. While included for 2202 compatibility, Autokey makes no use of this field. 2204 o Key Usage. This field defines the intended use of the public key 2205 contained in the certificate. It contains the string 2206 "digitalSignature,keyCertSign", which means the contained public 2207 key can be used to verify signatures on data and other 2208 certificates. While included for compatibility, Autokey makes no 2209 use of this field. 2211 o Extended Key Usage. This field further refines the intended use 2212 of the public key contained in the certificate and is present only 2213 in self-signed certificates. It contains the string "Private" if 2214 the certificate is designated private or the string "trustRoot" if 2215 it is designated trusted. A private certificate is always 2216 trusted. 2218 o Subject Key Identifier. This field contains the client identity 2219 key used in the GQ identity scheme. It is present only if the GQ 2220 scheme is in use. 2222 The value field contains a X509v3 certificate encoded by the 2223 i2d_X509() routine in the OpenSSL distribution. The encoding follows 2224 the rules stated in [RFC3280], including the use of X509v3 extension 2225 fields. 2227 Certificate ::= SEQUENCE { 2228 tbsCertificate TBSCertificate, 2229 signatureAlgorithm AlgorithmIdentifier, 2230 signatureValue BIT STRING 2231 } 2233 The signatureAlgorithm is the object identifier of the message 2234 digest/signature encryption scheme used to sign the certificate. The 2235 signatureValue is computed by the certificate issuer using this 2236 algorithm and the issuer private key. 2238 TBSCertificate ::= SEQUENCE { 2239 version EXPLICIT v3(2), 2240 serialNumber CertificateSerialNumber, 2241 signature AlgorithmIdentifier, 2242 issuer Name, 2243 validity Validity, 2244 subject Name, 2245 subjectPublicKeyInfo SubjectPublicKeyInfo, 2246 extensions EXPLICIT Extensions OPTIONAL 2247 } 2249 The serialNumber is an integer guaranteed to be unique for the 2250 generating host. The reference implementation uses the NTP seconds 2251 when the certificate was generated. The signature is the object 2252 identifier of the message digest/signature encryption scheme used to 2253 sign the certificate. It must be identical to the 2254 signatureAlgorithm. 2256 CertificateSerialNumber ::= INTEGER 2257 Validity ::= SEQUENCE { 2258 notBefore UTCTime, 2259 notAfter UTCTime 2260 } 2262 The notBefore and notAfter define the period of validity as defined 2263 in Appendix B. 2265 SubjectPublicKeyInfo ::= SEQUENCE { 2266 algorithm AlgorithmIdentifier, 2267 subjectPublicKey BIT STRING 2268 } 2270 The AlgorithmIdentifier specifies the encryption algorithm for the 2271 subject public key. The subjectPublicKey is the public key of the 2272 subject. 2274 Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension 2275 Extension ::= SEQUENCE { 2276 extnID OBJECT IDENTIFIER, 2277 critical BOOLEAN DEFAULT FALSE, 2278 extnValue OCTET STRING 2279 } 2281 Name ::= SEQUENCE { 2282 OBJECT IDENTIFIER commonName 2283 PrintableString HostName 2284 } 2286 For trusted host certificates the subject and issuer HostName is the 2287 NTP name of the group, while for all other host certificates the 2288 subject and issuer HostName is the NTP name of the host. In the 2289 reference implementation if these names are not explicitly specified, 2290 they default to the string returned by the Unix gethostname() routine 2291 (trailing NUL removed). For other than self-signed certificates, the 2292 issuer HostName is the unique DNS name of the host signing the 2293 certificate. 2295 Authors' Addresses 2297 Brian Haberman (editor) 2298 The Johns Hopkins University Applied Physics Laboratory 2299 11100 Johns Hopkins Road 2300 Laurel, MD 20723-6099 2301 US 2303 Phone: +1 443 778 1319 2304 Email: brian@innovationslab.net 2306 Dr. David L. Mills 2307 University of Delaware 2308 Newark, DE 19716 2309 US 2311 Phone: +1 302 831 8247 2312 Email: mills@udel.edu