home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_n_r / draft-petke-remote-pass-auth-00.txt < prev    next >
Text File  |  1997-05-19  |  90KB  |  2,323 lines

  1.  
  2. INTERNET-DRAFT                                                   G Brown
  3. draft-petke-remote-pass-auth-00.txt                           CompuServe
  4. Expires: 19 November 1997                                    19 May 1997
  5.  
  6.  
  7.                     Remote Passphrase Authentication
  8.  
  9.  
  10. Status of this Memo
  11.  
  12.    This document is an Internet-Draft. Internet-Drafts are working 
  13.    documents of the Internet Engineering Task Force (IETF), its areas, 
  14.    and its working groups. Note that other groups may also distribute 
  15.    working documents as Internet-Drafts. 
  16.    
  17.    Internet-Drafts are draft documents valid for a maximum of six months 
  18.    and may be updated, replaced, or obsoleted by other documents at any 
  19.    time. It is inappropriate to use Internet- Drafts as reference 
  20.    material or to cite them other than as "work in progress." 
  21.    
  22.    To learn the current status of any Internet-Draft, please check the 
  23.    "1id-abstracts.txt" listing contained in the Internet- Drafts Shadow 
  24.    Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe), 
  25.    munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or 
  26.    ftp.isi.edu (US West Coast). 
  27.    
  28.    
  29.  
  30. Abstract 
  31.    
  32.    Remote Passphrase Authentication provides a way to authenticate a 
  33.    user to a service by using a pass phrase over an insecure network, 
  34.    without revealing the pass phrase to eavesdroppers. In addition, the 
  35.    service need not know and does not learn the user's pass phrase, 
  36.    making this scheme useful in distributed environments where it would 
  37.    be difficult or inappropriate to trust a service with a pass phrase 
  38.    database or to allow the server to learn enough to masquerade as the 
  39.    user in a future authentication attempt. 
  40.    
  41.    This scheme was inspired by Dave Raggett's Mediated Digest 
  42.    Authentication, draft-ietf-http-mda-00.txt. 
  43.    
  44.    This specification is divided into five parts. Part Zero contains an 
  45.    extended introduction to the problem and potential solutions. Part 
  46.    One explains the mechanism. Part Two explains how to incorporate the 
  47.    mechanism into HTTP. Part Three explains the protocol between the 
  48.    service and deity. Part Four explains the GSS-API token formats. Feel 
  49.    free to start with Part One; Part Zero provides background 
  50.    information and is not a prerequisite for Part One. 
  51.    
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Brown                                                           [Page 1]
  59.  
  60. Internet Draft      Remote Passphrase Authentication         19 May 1997
  61.  
  62.  
  63. Table of Contents 
  64.    
  65.    PART 0. EXTENDED INTRODUCTION
  66.    
  67.    1. INTRODUCTION    
  68.    1.1 IDENTIFICATION    
  69.    1.2 AUTHENTICATION    
  70.    1.3 AUTHORIZATION    
  71.    
  72.    2. THE PROBLEM AND HOW NOT TO SOLVE IT    
  73.    2.1 ENCRYPT THE PASS PHRASE?    
  74.    2.2 A CHALLENGE-RESPONSE MECHANISM?    
  75.    2.3 WHAT IF I DON'T KNOW YOUR PASS PHRASE?    
  76.    2.4 TWO MORE WAYS NOT TO SOLVE THE PROBLEM    
  77.    
  78.    PART 1. THE MECHANISM
  79.    
  80.    3. INTRODUCTION
  81.    
  82.    4. TERMINOLOGY
  83.    
  84.    5. DESIGN CRITERIA
  85.    
  86.    6. THE MECHANISM
  87.    6.1 AUTHENTICATION    
  88.    6.1.1 Values and their representation    
  89.    6.1.2 The authentication process    
  90.    6.2 REAUTHENTICATION    
  91.    6.3 REAUTHENTICATION CHEATING    
  92.    
  93.    PART 2. HTTP AUTHENTICATION SCHEME
  94.    
  95.    7. INTRODUCTION 
  96.    
  97.    8. USING THIS AUTHENTICATION MECHANISM IN HTTP  
  98.    8.1 AUTHENTICATION      
  99.    8.2 REAUTHENTICATION CHEATING   
  100.    8.3 REAUTHENTICATION    
  101.    
  102.    PART 3. SERVICE-TO-DEITY PROTOCOL
  103.    
  104.    9. INTRODUCTION
  105.    
  106.    10. OBJECT FORMATS
  107.    
  108.    11. MESSAGE OBJECT TYPES
  109.    11.1 AUTHENTICATION REQUEST
  110.    11.2 AUTHENTICATION RESPONSE, AFFIRMATIVE
  111.    11.3 AUTHENTICATION RESPONSE, NO SERVICE
  112.    11.4 AUTHENTICATION RESPONSE, NEGATIVE
  113.    11.5 AUTHENTICATION RESPONSE, INVALID SERVICE
  114.  
  115.  
  116. Brown                                                           [Page 2]
  117.  
  118. Internet Draft      Remote Passphrase Authentication         19 May 1997
  119.  
  120.  
  121.    11.6 AUTHENTICATION RESPONSE, PROBLEM
  122.    
  123.    12. OBJECT TYPES
  124.    
  125.    13. THE BLOB
  126.    
  127.    PART 4. GSS-API HANDSHAKE
  128.    
  129.    14. INTRODUCTION
  130.    
  131.    15. THE HANDSHAKE
  132.    15.1 TOKEN 1 (NEGOTIATION, CLIENT-TO-SERVER)
  133.    15.2 TOKEN 2 (CHALLENGE, SERVER-TO-CLIENT)
  134.    15.3 TOKEN 3 (AUTHENTICATION, CLIENT-TO-SERVER)
  135.    15.4 TOKEN 4 (AUTHENTICATION, SERVER-TO-CLIENT)
  136.    15.5 TOKEN 5 (HACK, CLIENT-TO-SERVER)
  137.    15.6 FIELD DESCRIPTIONS
  138.    
  139.    16 SAMPLE CONVERSATION
  140.    
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174. Brown                                                           [Page 3]
  175.  
  176. Internet Draft      Remote Passphrase Authentication         19 May 1997
  177.  
  178.  
  179.                      Remote Passphrase Authentication
  180.                                   Part 0
  181.                            Extended Introduction
  182.    
  183.  
  184. 1 Introduction 
  185.    
  186.    In this introduction we'll explain the problem--fundamentally, how to 
  187.    authenticate a user to a service without revealing a pass phrase, and 
  188.    without requiring the service to know the user's pass phrase--and 
  189.    consider several alternatives and their flaws, leading to the reasons 
  190.    for developing this authentication mechanism. If you're already 
  191.    familiar with the concept of authentication and the surrounding 
  192.    issues, you might prefer to skip to Part One of the specification, 
  193.    returning to this part only if you want more information about the 
  194.    motivation for the mechanism. 
  195.    
  196.    We'll speak of an environment in which a user communicates with a 
  197.    service that wishes to learn and authenticate the user's identity and 
  198.    vice versa. You may, of course, think in terms of client and server, 
  199.    but those terms generally refer to an implementation. We're speaking 
  200.    at a higher level where there's no direct correspondence between 
  201.    server and service nor user and client. 
  202.    
  203.    We'll use CompuServe and America Online as concrete examples of 
  204.    services, but the same concepts apply even to a single Web server or 
  205.    BBS that wants to authenticate users. There are three aspects of this 
  206.    environment of interest: 
  207.    
  208.       Identification--the way in which we refer to a user. 
  209.       
  210.       Authentication--the way in which a user may prove his or her 
  211.       identity. 
  212.       
  213.       Authorization--the way in which we determine what a given user may 
  214.       do. 
  215.    
  216.    The same aspects apply to services as well as users. 
  217.    
  218. 1.1 Identification 
  219.    
  220.    A user's identity consists of a user name and a realm name. A realm 
  221.    is a universe of identities; CompuServe Information Service user IDs 
  222.    and America Online screen names are two examples of realms. The 
  223.    combination of username and realm--typically shown as 
  224.    name@realm--identifies a user. Any given service will recognize some 
  225.    particular set of identities. A realm doesn't have to be large, 
  226.    though, either in number of users or size of service. For example, a 
  227.    single Web server might have its own realm of users. 
  228.    
  229.    Often, a service recognizes only one realm: CIS recognizes only 
  230.  
  231.  
  232. Brown                                                           [Page 4]
  233.  
  234. Internet Draft      Remote Passphrase Authentication         19 May 1997
  235.  
  236.  
  237.    identities within the CIS realm, and AOL recognizes only identities 
  238.    within the AOL realm. But one can imagine a service that has 
  239.    agreements with both CIS and AOL. The service gives the user a choice 
  240.    of realms--"Please supply a CIS or AOL identity, and prove it"--and 
  241.    the user chooses a realm in which he has an identity. 
  242.    
  243. 1.2 Authentication 
  244.    
  245.    Identification provides the ability to identify, or refer to, a user. 
  246.    Authentication provides the ability to prove identity. When you ask 
  247.    to do something for which your identity matters, we ask for your 
  248.    identity--your username and realm--and we make you prove that you are 
  249.    who you say you are. 
  250.    
  251.    To accomplish this, we'll use a secret that we call a pass phrase, 
  252.    although it's not necessarily derived from text. Such a secret is 
  253.    sometimes called a secret key, but we won't be using it for 
  254.    encryption. 
  255.    
  256.    The fundamental problem to be solved is: How can you prove to me that 
  257.    you know your pass phrase without revealing the pass phrase in the 
  258.    process? We'll explore this problem in more detail momentarily. 
  259.    
  260. 1.3 Authorization 
  261.    
  262.    Authorization refers to the process of determining whether a given 
  263.    user is allowed to do something. For example, may he post a message? 
  264.    May he use a surcharged service? We won't say much about this topic, 
  265.    but it's important to realize that authentication and authorization 
  266.    are distinct processes, one related to proving an identity, and the 
  267.    other related to the properties of an identity. 
  268.    
  269.    Our mechanism has nothing to do with authorization, but it is 
  270.    designed to co-exist with authorization mechanisms. 
  271.    
  272.  
  273. 2 The problem and how not to solve it 
  274.    
  275.    Imagine that I'm a service who wishes to authenticate you, a user. 
  276.    You must identify yourself and prove to me that you know your pass 
  277.    phrase. That's easy: I'll prompt you for your pass phrase. 
  278.    
  279.    But that doesn't work. We learned long ago that plaintext pass 
  280.    phrases cannot be transmitted through a network. X.25 networks have 
  281.    been compromised, and LANs, modem pools, and "The Internet" likewise 
  282.    are not suitable for plaintext pass phrases. Prompting for the pass 
  283.    phrase is not the answer. 
  284.    
  285.  
  286.  
  287.  
  288.  
  289.  
  290. Brown                                                           [Page 5]
  291.  
  292. Internet Draft      Remote Passphrase Authentication         19 May 1997
  293.  
  294.  
  295. 2.1 Encrypt the pass phrase? 
  296.    
  297.    How about encrypting the pass phrase? Sounds good. You encrypt your 
  298.    pass phrase, send me the result, and I'll decrypt it. Techniques like 
  299.    Diffie-Hellman can create a one-time key that prevents an 
  300.    eavesdropper from decrypting your pass phrase. 
  301.    
  302.    But that doesn't work, either. What if somebody else--a 
  303.    spoofer--pretends to be the service? He'll decrypt the result, 
  304.    learning your pass phrase and gaining the ability to masquerade as 
  305.    you. Perhaps that sounds unlikely, but it's not; even in dial-up 
  306.    modem days, people have spoofed services--"Here's a new telephone 
  307.    number they left out of their directory. It's much faster than the 
  308.    listed numbers!" 
  309.    
  310.    We need a mechanism that won't reveal your pass phrase to anyone, 
  311.    even if you're not talking to whom you think you're talking. 
  312.    
  313. 2.2 A challenge-response mechanism? 
  314.    
  315.    How about a challenge-response mechanism? Now we're on the right 
  316.    track. I send you a challenge, which is a random number, and you use 
  317.    a one-way function to calculate a result that depends on the 
  318.    challenge and your pass phrase. You send me the result, and I perform 
  319.    the same calculation and see if my result matches yours. Done 
  320.    correctly, this reveals no information to eavesdroppers, nor does it 
  321.    allow a spoofer to acquire your pass phrase--if someone pretends to 
  322.    be me, they learn only your result for a particular challenge, which 
  323.    is of no value. 
  324.    
  325.    Although such a mechanism works, it doesn't quite solve our problem. 
  326.    If I'm the service, I must know your pass phrase in order to 
  327.    reproduce your calculation and verify your response to my challenge. 
  328.    But what if I don't know your pass phrase? 
  329.    
  330. 2.3 What if I don't know your pass phrase? 
  331.    
  332.    Why might I, the service, not know your pass phrase? Consider a set 
  333.    of services that share a set of users' identities. For example, 
  334.    imagine a collection of Web servers, scattered throughout the world, 
  335.    all of which are a part of Gary's Information Service; you may use 
  336.    your GIS name and pass phrase to identify yourself to any GIS 
  337.    service. 
  338.    
  339.    The obvious implementation--each physical server has a copy of all 
  340.    pass phrases or access to a master database--is awkward at best, 
  341.    especially if some are third-party servers, not directly under the 
  342.    control of our imaginary GIS. 
  343.    
  344.    Or consider a service that accepts identities in multiple realms. 
  345.    Imagine a service that has agreements with both CIS and AOL. The 
  346.  
  347.  
  348. Brown                                                           [Page 6]
  349.  
  350. Internet Draft      Remote Passphrase Authentication         19 May 1997
  351.  
  352.  
  353.    service gives the user a choice of realms--"Please supply a CIS or 
  354.    AOL identity, and prove it"--and the user chooses a realm in which he 
  355.    has an identity. It's unlikely that CIS and AOL will entrust a copy 
  356.    of their pass phrase databases to a third-party service--or to each 
  357.    other. 
  358.    
  359.    So, if I don't know your pass phrase, how can you prove to me that 
  360.    you do know it? And that's the fundamental question addressed by this 
  361.    mechanism. We'll begin by pointing out a couple of solutions that 
  362.    don't work. 
  363.    
  364. 2.4 Two more ways not to solve the problem 
  365.    
  366.    Wrong answer #1--I'll prompt you for your pass phase. Let's make this 
  367.    example more concrete: I'll display an HTML form with a box that asks 
  368.    for your name and a box for your pass phrase. We'll use SSL or SHTTP 
  369.    so an eavesdropper can't see it. When I get your reply, I can use a 
  370.    challenge-response mechanism to verify your pass phrase with a server 
  371.    that knows the pass phrases. 
  372.    
  373.    But that won't work. It's important to teach users not to type their 
  374.    pass phrases just because somebody asks for it--that's a standard 
  375.    technique for cracking others' accounts. Teaching users to provide 
  376.    their pass phrases in an HTML form is a bad idea. 
  377.    
  378.    And I'll see your pass phrase, which is precisely what we want to 
  379.    avoid, especially if I'm a spoofer. 
  380.    
  381.    Wrong answer #2--We'll create a pass-phrase database server. I'll ask 
  382.    it for a copy of your pass phrase. Now that I know it, we can use an 
  383.    ordinary challenge-response mechanism. 
  384.    
  385.    That won't work. We'd need a way to get the pass phrase from that 
  386.    database to me, safely. And if I can look up your pass phrase, what's 
  387.    to stop somebody else from doing the same? (Don't say "a firewall." 
  388.    Services that need to verify your identity exist outside firewalls, 
  389.    too.) 
  390.    
  391.    If anything, this is even worse--I could dump the entire pass-phrase 
  392.    database--and, again, I should never see your pass phrase. 
  393.    
  394.    But there is a solution, which we'll cover in Part One of this 
  395.    specification. 
  396.    
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406. Brown                                                           [Page 7]
  407.  
  408. Internet Draft      Remote Passphrase Authentication         19 May 1997
  409.  
  410.  
  411.                      Remote Passphrase Authentication
  412.                                   Part 1
  413.                                The Mechanism
  414.    
  415.  
  416. Table of Contents 
  417.    
  418.    3. INTRODUCTION
  419.    
  420.    4. TERMINOLOGY
  421.    
  422.    5. DESIGN CRITERIA
  423.    
  424.    6. THE MECHANISM
  425.    6.1 AUTHENTICATION    
  426.    6.1.1 Values and their representation    
  427.    6.1.2 The authentication process    
  428.    6.2 REAUTHENTICATION    
  429.    6.3 REAUTHENTICATION CHEATING    
  430.    
  431.  
  432. 3 Introduction 
  433.    
  434.    In this mechanism, we'll authenticate a user to a service and vice 
  435.    versa. We'll use pass phrases--actually, they're 128-bit shared 
  436.    secrets, but we'll define a way to use textual phrases--so the goal 
  437.    is to prove to the service that you know your pass phrase, and vice 
  438.    versa. 
  439.    
  440.    Of course, it's important not to reveal the pass phrase to an 
  441.    eavesdropper. It is equally important not to reveal the pass phrase 
  442.    to a spoofer. 
  443.    
  444.    Furthermore, the mechanism should work even if the service does not 
  445.    know the user's pass phrase. In a distributed environment, with many 
  446.    services that wish to authenticate the same set of users, it may be 
  447.    difficult to make users' pass phrases available to all services. And 
  448.    we might prefer not to do that, if we don't completely trust the 
  449.    services. So, not only should the service not have to know the user's 
  450.    pass phrase, but the service should not learn the user's pass phrase 
  451.    during the authentication process. 
  452.    
  453.    On the other hand, the mechanism should be simple enough to apply 
  454.    even in the traditional case where the service knows the user's pass 
  455.    phrase; there's no need to use a different mechanism in that case. 
  456.    
  457.    Part Zero of this specification contains an extended introduction 
  458.    that explains the problem and various potential solutions and their 
  459.    problems, leading to this mechanism. If you find yourself asking, 
  460.    "Why not just...," it might be worth reading Part Zero to see if that 
  461.    explains it. However, it contains only background material, so you 
  462.  
  463.  
  464. Brown                                                           [Page 8]
  465.  
  466. Internet Draft      Remote Passphrase Authentication         19 May 1997
  467.  
  468.  
  469.    needn't read Part Zero before reading the rest of this specification. 
  470.    
  471.  
  472. 4 Terminology 
  473.    
  474.    Throughout this specification we'll speak of a "user" communicating 
  475.    with a "service" that wishes to learn and authenticate the user's 
  476.    identity. Often, the user is a "client" and the service is a 
  477.    "server," but those terms refer to an implementation. 
  478.    
  479.    The "deity" knows the users' and services' pass phrases, and the 
  480.    service talks to the deity during the authentication process. 
  481.    Although the term "authentication server" is more conventional, we 
  482.    call it a deity because it's got fewer syllables and the term 
  483.    "server" is overloaded. If the service knows the pass phrases, then 
  484.    it acts as its own deity, simplifying the implementation but 
  485.    otherwise having no effect on the mechanism. 
  486.    
  487.    Identities exist in some "realm," and we use that term in its usual 
  488.    sense. We often think of a realm as being a relatively large 
  489.    collection of users, like compuserve.com or aol.com, but it might 
  490.    well consist of a small set of users, e.g., user names and pass 
  491.    phrases associated with an individual Web server. We allow the 
  492.    service to specify a set of realms, to recognize an identity in any 
  493.    of the realms in which it participates. 
  494.    
  495.  
  496. 5 Design criteria 
  497.    
  498.    This authentication mechanism is intended to meet the following 
  499.    criteria. 
  500.    
  501.    * The service learns and authenticates the user's identity. 
  502.      
  503.    * The user learns and authenticates the service's identity. 
  504.      
  505.    * The mechanism does not use public-key technology. 
  506.      
  507.    * The mechanism does not use encryption. (By encryption, we're 
  508.      referring to reversible encryption, the ability to encrypt 
  509.      something and later decrypt it. By avoiding encryption, we avoid 
  510.      restrictions on exportability.) 
  511.      
  512.    * The mechanism is based on shared secrets: "pass phrases," although 
  513.      they can be arbitrary bit patterns rather than text. 
  514.      
  515.    * Neither the user nor the service needs to know the other's pass 
  516.      phrase. 
  517.      
  518.    * Neither the user nor the service nor eavesdroppers will learn the 
  519.      other's pass phrase. However, if the pass phrase is based on text, 
  520.  
  521.  
  522. Brown                                                           [Page 9]
  523.  
  524. Internet Draft      Remote Passphrase Authentication         19 May 1997
  525.  
  526.  
  527.      it's important to choose a "good" pass phrase to avoid a dictionary 
  528.      attack. 
  529.      
  530.    * The mechanism is reasonably easy to implement in clients and does 
  531.      not require the client to communicate with a third party nor to a 
  532.      possess a reliable clock. 
  533.      
  534.    * The mechanism derives a shared secret that may be used as a session 
  535.      key for subsequent authentication. 
  536.      
  537.    * The mechanism may be incorporated into almost any protocol. In 
  538.      other words, the mechanism is not designed around a protocol; the 
  539.      protocol is designed around the mechanism. But the mechanism must 
  540.      be suitable for incorporation into protocols like HTTP. 
  541.      
  542.    * The mechanism provides the ability to accept an identity in any of 
  543.      a set of realms in which the user and service are members. 
  544.    
  545.  
  546. 6 The mechanism 
  547.    
  548.    This authentication mechanism consists of three related processes: 
  549.    authentication, reauthentication, and reauthentication cheating. 
  550.    
  551.    Authentication is the fundamental process by which a user and a 
  552.    service mutually authenticate one another within one of a set of 
  553.    realms, without revealing their pass phrases to one another. 
  554.    
  555.    Reauthentication is a process by which a user and service, having 
  556.    recently authenticated one another, may again authenticate one 
  557.    another. They could, of course, simply repeat the authentication 
  558.    process, but that requires interaction with an authentication deity. 
  559.    The reauthentication process is faster, requiring no communication 
  560.    with a third party. Reauthentication is useful when multiple 
  561.    connections between the user and service are established, whether 
  562.    sequential as in HTTP or simultaneous. Each connection must be 
  563.    authenticated, but the reauthentication process provides a shortcut. 
  564.    
  565.    Reauthentication cheating is a further optimization for HTTP, a 
  566.    protocol that is quite unfriendly to challenge-response mechanisms. 
  567.    Reauthentication cheating can be performed in parallel with an HTTP 
  568.    transaction. True reauthentication is just as simple, but requires 
  569.    two sequential requests because of the characteristics of HTTP. By 
  570.    using reauthentication cheating, we create a "one-way" handshake. 
  571.    
  572. 6.1 Authentication 
  573.    
  574.    There are three parties involved in the authentication process: 
  575.    
  576.    * the user; 
  577.    
  578.  
  579.  
  580. Brown                                                          [Page 10]
  581.  
  582. Internet Draft      Remote Passphrase Authentication         19 May 1997
  583.  
  584.  
  585.    * the service; and 
  586.    
  587.    * the authentication deity. 
  588.    
  589.    Each user has a name and a pass phrase in some realm of interest. 
  590.    Similarly, each service has a name and a pass phrase in that realm. 
  591.    The pass phrase isn't really text; it's a 128-bit (16-octet) string 
  592.    of bits. 
  593.    
  594.    However, it's often useful to use pass phrases in the conventional, 
  595.    textual sense, so we define a procedure for converting a textual 
  596.    phrase to the 128-bit value used by the authentication mechanism. If 
  597.    such a pass phrase is poorly chosen, it will be subject to dictionary 
  598.    attack, and that's why we never use the word password in this 
  599.    specification (well, except in this sentence)--use a phrase, not a 
  600.    word. 
  601.    
  602.    The service may specify a list of realms, and the user chooses one in 
  603.    which he has an identity. Thus, a service is not restricted to 
  604.    authenticating identities in a single realm. The service must possess 
  605.    a name and pass phrase in all realms it lists. 
  606.    
  607.    Each realm has an authentication deity, which knows the names and 
  608.    pass phrases of its members. It's the service's responsibility to 
  609.    know how to locate an authentication deity for each realm; the user 
  610.    never communicates directly with an authentication deity. If the 
  611.    service knows the user's pass phrase, it performs the role of the 
  612.    authentication deity itself, but this does not affect the mechanism. 
  613.    
  614. 6.1.1 Values and their representation 
  615.    
  616.    Following is a glossary of the values involved in the authentication 
  617.    process; we'll use these symbols in the following explanation. 
  618.    
  619.        As--Authentication deity's response to service; proves user's 
  620.            identity 
  621.            
  622.        Au--Authentication deity's response to user; proves service's 
  623.            identity 
  624.            
  625.        Cs--Challenge from service 
  626.            
  627.        Cu--Challenge from user 
  628.            
  629.        Kus--Session key for user and service 
  630.            
  631.        Kuss--Session key obscured so visible only to service 
  632.            
  633.        Kusu--Session key obscured so visible only to user 
  634.            
  635.        Nr--Realm name 
  636.  
  637.  
  638. Brown                                                          [Page 11]
  639.  
  640. Internet Draft      Remote Passphrase Authentication         19 May 1997
  641.  
  642.  
  643.            
  644.        Ns--Service name 
  645.            
  646.        Nu--User name 
  647.            
  648.        Ps--Service's pass phrase, a 128-bit value 
  649.            
  650.        Pu--User's pass phrase, a 128-bit value 
  651.            
  652.        Rs--Service's response to challenge (during authentication 
  653.            process, goes to authentication deity; during 
  654.            reauthentication, goes to user) 
  655.            
  656.        Ru--User's response to challenge (during authentication process, 
  657.            goes via service to authentication deity; during 
  658.            reauthentication, goes to service) 
  659.            
  660.        Ts--Service's time stamp 
  661.            
  662.        Z--Padding consisting of 48 octets (384 bits) with all bits set 
  663.            to zero 
  664.            
  665.        +--Concatenation of octet strings 
  666.            
  667.        xor--Bitwise exclusive or 
  668.    
  669.    Bit patterns for each value must be specified. Imagine, for example, 
  670.    that one implementation uses ASCII, another EBCDIC, and another 
  671.    Unicode for the user name. Or one implementation converts the name to 
  672.    lowercase, another to all caps. Each would generate a different 
  673.    result for the same calculation, and authentication would fail. 
  674.    
  675.    Should we leave such details to the underlying protocol? We could, 
  676.    but that would make the service-to-deity protocol dependent on the 
  677.    user-to-service protocol, so we couldn't have a single deity for each 
  678.    realm. If we specify the bit patterns, we can allow any mixture of 
  679.    user-to-service and service-to-deity protocols to operate on the same 
  680.    data. Therefore, we adopt the following conventions. 
  681.    
  682.    Text strings are represented in the Unicode character set, in 
  683.    big-endian byte order, without a trailing null character. Note that 
  684.    ASCII can be converted to ISO 8859-1 by prefixing a single 0 bit, and 
  685.    ISO 8859-1 can be converted to Unicode by prefixing eight 0 bits. 
  686.    Each 16-bit Unicode character is stored in two octets, with its 
  687.    high-order 8 bits in the first octet. Representation of characters 
  688.    with multiple encodings is for further study. For example, e-acute 
  689.    has more than one representation. The form that uses combining 
  690.    characters, in character-code order, is probably the most logical. 
  691.    
  692.    Note, by the way, that this specification refers only to values used 
  693.    in the authentication calculations, not the underlying protocol. For 
  694.  
  695.  
  696. Brown                                                          [Page 12]
  697.  
  698. Internet Draft      Remote Passphrase Authentication         19 May 1997
  699.  
  700.  
  701.    example, it's quite reasonable for a protocol to use ASCII for user 
  702.    names, if that character set is adequate. Those ASCII characters must 
  703.    be converted to Unicode before using them in authentication 
  704.    calculations, but the protocol need not transmit Unicode characters. 
  705.    
  706.    * Names--Nr, Ns, Nu--are converted to lowercase Unicode. Note that 
  707.      there is no trailing null character. 
  708.      
  709.    * Challenges--Cs, Cu--are arbitrary strings of octets, not text. They 
  710.      may contain any bit patterns, including nulls, and must be at least 
  711.      eight octets in length. 
  712.      
  713.    * The time stamp--Ts--is the ISO 646 (ASCII) textual representation 
  714.      of the current universal time--UTC--in exactly 14 octets, using 
  715.      24-hour time, with leading zeroes: 19950805011344. 
  716.      
  717.    * Pass phrases--Ps, Pu--are 16-octet quantities that contain 
  718.      arbitrary bit patterns, including nulls. If the pass phrase is 
  719.      based on a textual phrase, the textual phrase is converted to a 
  720.      16-octet quantity by the following process. 
  721.      
  722.      * Convert the text string to a sequence of characters in either the 
  723.        Unicode or ISO 8859-1 character sets, as appropriate for the 
  724.        realm. 
  725.        
  726.      * Convert each character to its lowercase equivalent, or its 
  727.        uppercase equivalent, or leave it alone, as appropriate for the 
  728.        realm. 
  729.        
  730.      * Store the sequence of characters in an octet stream, with each 
  731.        Unicode character in two consecutive octets in big-endian order, 
  732.        or each ISO 8859-1 character in one octet. Do not append a 
  733.        trailing null character. 
  734.        
  735.      * Take the MD5 digest of the resulting string of octets. The result 
  736.        is the 128-bit value to use in the authentication calculations. 
  737.    
  738.    A realm will specify which of the preceding options--character set, 
  739.    case conversion, and hash function--it uses for the text-to-128-bit 
  740.    value transformation; the defaults are Unicode, convert to lowercase, 
  741.    and MD5. More options might be added in the future. The user-service 
  742.    protocol should be designed to convey the appropriate options for 
  743.    each realm from the service to the user, if other than the defaults 
  744.    are to be supported, to avoid requiring the (human) user to manually 
  745.    configure software. 
  746.    
  747. 6.1.2 The authentication process 
  748.    
  749.    Here we describe the individual steps. Taken literally, one might 
  750.    envision many messages between the service and deity, but an actual 
  751.    implementation within a protocol combines steps. For example, "The 
  752.  
  753.  
  754. Brown                                                          [Page 13]
  755.  
  756. Internet Draft      Remote Passphrase Authentication         19 May 1997
  757.  
  758.  
  759.    user sends a random challenge" is shown as a separate step for 
  760.    clarity, but it needn't be a separate message to the service, nor 
  761.    must it be sent at the point shown--if it makes sense in the 
  762.    underlying protocol, the user's challenge might be included with the 
  763.    user's response to the service. 
  764.    
  765.    * The service supplies a sequence of realms, with the service's name 
  766.      in each realm, to the user. For example, 
  767.      
  768.          foo@compuserve.com bar@aol.com 
  769.      
  770.      means "Please identify yourself with a CIS user ID. If you don't 
  771.      have one, your AOL ID will do." The service indicates its realm 
  772.      preferences in most-preferred to least-preferred order; by 
  773.      specifying only one realm, the service requires identification in 
  774.      that realm. 
  775.      
  776.    * The user chooses a realm, Nr, and gives it and his name in that 
  777.      realm, Nu, to the service. That, in turn, determines Ns, the 
  778.      service's name in that realm. Note that a protocol might allow the 
  779.      service to include a null realm name, meaning "I'll accept you as 
  780.      an anonymous user if you wish." The user might make this choice by 
  781.      supplying a null name; the the process stops here, and no 
  782.      authentication is performed. 
  783.      
  784.    * The service transmits a random challenge, Cs, and a time stamp, Ts. 
  785.      The challenges are random values that make each authentication 
  786.      unique. The time stamp is, in effect, a third challenge, which the 
  787.      deity will ensure is recent. The user may examine it, but most 
  788.      users lack an accurate source of universal time, so most users will 
  789.      treat it as an opaque value. 
  790.      
  791.    * The user sends a random challenge, Cu. 
  792.      
  793.    * The user calculates a response, Ru: 
  794.      
  795.          Ru = MD5(Pu + Z + Nu + Ns + Nr + Cu + Cs + Ts + Pu) 
  796.      
  797.      and sends it to the service. 
  798.      
  799.      Only the real user can generate the correct response, because it 
  800.      depends on the user's pass phrase, Pu. No one can determine the 
  801.      user's pass phrase from a captured response, because it's generated 
  802.      by a one-way function, although there is the risk of a dictionary 
  803.      attack if Pu is based on a poorly chosen pass phrase. 
  804.      
  805.    * The service calculates a response, Rs: 
  806.      
  807.          Rs = MD5(Ps + Z + Nu + Ns + Nr + Cu + Cs + Ts + Ru + Ps) 
  808.      
  809.      This response is not sent to the user; it would do no harm if the 
  810.  
  811.  
  812. Brown                                                          [Page 14]
  813.  
  814. Internet Draft      Remote Passphrase Authentication         19 May 1997
  815.  
  816.  
  817.      user saw it, but the user won't need it. 
  818.      
  819.    * The service sends a request to the authentication deity for the 
  820.      realm in question. The request contains 
  821.      
  822.      * The realm name, Nr (included so the same deity can serve more 
  823.        than one realm) 
  824.        
  825.      * The user's name, Nu 
  826.        
  827.      * The service's name, Ns 
  828.        
  829.      * The user's challenge, Cu 
  830.        
  831.      * The service's challenge, Cs 
  832.        
  833.      * The time stamp, Ts 
  834.        
  835.      * The user's response, Ru 
  836.        
  837.      * The service's response, Rs 
  838.      
  839.    * The deity verifies the time stamp per previously agreed upon 
  840.      criteria. In some applications, one might require it within a few 
  841.      minutes; in others, one might want to allow 25 hours to eliminate 
  842.      problems of misconfigured time zones. Beware of overzealousness, 
  843.      though; this time stamp went from the service to the user, then 
  844.      back to the service, then to the deity, perhaps with human 
  845.      interaction--typing a pass phrase--introducing further delay. The 
  846.      deity might implement a replay cache. 
  847.      
  848.    * The deity uses Nr, Ns, and Nu to look up the user's and service's 
  849.      pass phrases. 
  850.      
  851.    * The deity uses the values in the request, plus the service's pass 
  852.      phrase, Ps, to verify Rs. If it is incorrect, the deity returns a 
  853.      negative response; this request apparently did not come from a 
  854.      legitimate service. 
  855.      
  856.    * Having verified the requesting service's identity, the deity uses 
  857.      the values in the request, plus the user's pass phrase, Pu, to 
  858.      verify Ru. If it is incorrect, the deity returns a failure response 
  859.      to the service; the user does not know the correct pass phrase. 
  860.      
  861.    * Having verified both the user's and service's identity, the deity 
  862.      creates a random, 128-bit session key, Kus, for use by the user and 
  863.      service. They might use it for session encryption; in addition, it 
  864.      will be used in the reauthentication process described later. 
  865.      
  866.    * The deity generates two obscured copies of the session key: 
  867.      
  868.  
  869.  
  870. Brown                                                          [Page 15]
  871.  
  872. Internet Draft      Remote Passphrase Authentication         19 May 1997
  873.  
  874.  
  875.      * Kuss = Kus xor MD5(Ps + Z + Ns + Nu + Nr + Cs + Cu + Ts + Ps) 
  876.        
  877.      * Kusu = Kus xor MD5(Pu + Z + Ns + Nu + Nr + Cs + Cu + Ts + Pu) 
  878.        
  879.        The obscuring masks resemble Ru and Rs, but differ, of course, so 
  880.        an eavesdropper cannot recover Kus. 
  881.      
  882.    * The deity generates a pair of authentication "proofs": 
  883.      
  884.      * Au = MD5(Pu + Z + Ns + Nu + Nr + Kusu + Cs + Cu + Ts + Kus + Pu) 
  885.        
  886.      * As = MD5(Ps + Z + Ns + Nu + Nr + Kuss + Cs + Cu + Ts + Kus + M + 
  887.        Ps) 
  888.        
  889.        Here "M" is the message transmitted from the deity to the 
  890.        service; it is included in the calculation to authenticate the 
  891.        response to the service. Refer to Part Three of this 
  892.        specification for more details. 
  893.      
  894.    * The deity sends the four values Kuss, Kusu, As, and Au to the 
  895.      service. 
  896.      
  897.    * The service extracts its copy of the session key from Kuss by 
  898.      calculating the obscuring mask value and XORing. (The service can 
  899.      determine the user's key-obscuring value by calculating Kus xor 
  900.      Kusu; and if the user sees Kuss, it can do likewise. But the 
  901.      obscuring masks reveal nothing.) 
  902.      
  903.    * The service verifies As by performing the same calculation and 
  904.      comparing the result. If it matches, the service knows that someone 
  905.      who knows its pass phrase--the deity--replied, having verified that 
  906.      the user is who he claims to be. 
  907.      
  908.    * The service forwards Kusu and Au to the user. 
  909.      
  910.    * The user extracts its copy of the session key from Kusu by 
  911.      calculating the mask value and XORing. 
  912.      
  913.    * The user verifies Au by computing it and comparing. If it matches, 
  914.      the user knows that someone who knows his pass phrase--the 
  915.      deity--replied, having verified that the service is who it claims 
  916.      to be. Of course, if the service itself knows the user's pass 
  917.      phrase, it can assert any service identity; but this is the case 
  918.      where the service is trusted and acts as its own deity. 
  919.    
  920.    Now the user and service are confident of each others' identities, 
  921.    and the two parties share a session key that they may use for 
  922.    encryption, if they so choose. 
  923.    
  924.         [Perhaps we should add another value to the authentication 
  925.         calculations, opaque to the mechanism, provided by the 
  926.  
  927.  
  928. Brown                                                          [Page 16]
  929.  
  930. Internet Draft      Remote Passphrase Authentication         19 May 1997
  931.  
  932.  
  933.         protocol in which this mechanism is embedded. This value 
  934.         would, of course, have to be added to the service-to-deity 
  935.         protocol, and its generation and interpretation would be up 
  936.         to the lower-level protocol. For example, HTTP might choose 
  937.         to include the Web server's IP address and, perhaps, the 
  938.         URL in the authentication calculations, making it harder to 
  939.         do a man-in-the-middle attack. (Of course, that problem 
  940.         cannot be completely solved without using the session key 
  941.         to authenticate data, which is a protocol issue outside the 
  942.         scope of this mechanism.)] 
  943.    
  944. 6.2 Reauthentication 
  945.    
  946.    Reauthentication is a process by which a user and service, having 
  947.    recently authenticated each other, may again mutually authenticate 
  948.    without talking to a deity. This is useful with protocols like HTTP, 
  949.    which involve a sequence of connections that must be independently 
  950.    authenticated. It's also useful with parallel connections--imagine a 
  951.    scheme in which a user and service are connected, and wish to 
  952.    establish a second connection. 
  953.    
  954.    To reauthenticate one another, the user and service prove to each 
  955.    other that they both possess a secret 128-bit key--the session key, 
  956.    Kus, derived during the authentication process. The reauthentication 
  957.    process is essentially an ordinary challenge-response mechanism in 
  958.    which the session key is used as a pass phrase. 
  959.    
  960.    * The service sends a challenge, Cs, to the user. 
  961.      
  962.    * The user sends a challenge, Cu, to the service. 
  963.      
  964.    * The user calculates 
  965.      
  966.          Ru = MD5(Kus + Z + Ns + Nu + Nr + Cs + Cu + Kus) 
  967.      
  968.      and sends it to the service. 
  969.      
  970.    * The service verifies the result. If correct, it calculates 
  971.      
  972.          Rs = MD5(Kus + Z + Nu + Ns + Nr + Cu + Cs + Kus) 
  973.      
  974.      and sends it to the user. Both responses involve the same set of 
  975.      values, but they're used in a different order, so the responses are 
  976.      different. 
  977.      
  978.    * The user verifies the result. 
  979.    
  980. 6.3 Reauthentication cheating 
  981.    
  982.    In HTTP, one can shortcut the reauthentication process by cheating, 
  983.    for an increase in efficiency. 
  984.  
  985.  
  986. Brown                                                          [Page 17]
  987.  
  988. Internet Draft      Remote Passphrase Authentication         19 May 1997
  989.  
  990.  
  991.    
  992.    A naive approach allows the user to repeat its authentication data, 
  993.    presumably in the form of an Authorization header. If the service 
  994.    recognizes the same Authorization header, it presumes that it's 
  995.    talking to the previously authenticated user; essentially, we pretend 
  996.    that we reauthenticated with the same challenges. But this approach 
  997.    is vulnerable to replay attacks during the period of time the service 
  998.    considers the data valid. The service can check the user's IP address 
  999.    to reduce the risk, but IP addresses mean surprisingly little. Even 
  1000.    neglecting address spoofing, multiple users share an IP address when 
  1001.    they're on the same host or routed through a proxy or SOCKS server. 
  1002.    
  1003.    There's a better solution. We begin by noting why it's 
  1004.    desirable--from an efficiency, not security, point of view--to allow 
  1005.    the Authorization header to be replayed. To embed a 
  1006.    challenge-response mechanism in HTTP, we require at least two HTTP 
  1007.    transactions for authentication, because we cannot send a challenge 
  1008.    and receive a response in one HTTP transaction. If we could challenge 
  1009.    the user without sending a challenge to the user, we could 
  1010.    authenticate in one HTTP transaction. And we can do exactly that by 
  1011.    treating the URI as a challenge. 
  1012.    
  1013.    * The first time, the user and service perform the authentication 
  1014.      process. 
  1015.      
  1016.    * The user and service remember the session key (Kus), challenges (Cu 
  1017.      and Cs), and timestamp (Ts). 
  1018.      
  1019.    * When the user generates an HTTP request, he includes an 
  1020.      Authorization header containing a response calculated as 
  1021.      
  1022.          MD5(Kus + Z + Ns + Nu + Nr + Cs + Cu + Ts + method + URI + Kus) 
  1023.    
  1024.    The method and URI are canonicalized by taking the big-endian Unicode 
  1025.    representation and converting all characters to lowercase; the URI 
  1026.    should not include the scheme://host:port. It always begins with a 
  1027.    slash; for "http://www.foo.com" the one-character string "/" would be 
  1028.    used. 
  1029.    
  1030.    Now the authentication response is unique for each URI, and 
  1031.    calculable only by the authenticated user, even without a unique 
  1032.    challenge. This doesn't completely eliminate the risk of replay, of 
  1033.    course, but an attacker can replay only a previously referenced URI 
  1034.    during the window in which the service considers the session key to 
  1035.    be valid. Is that acceptable? 
  1036.    
  1037.    Sometimes. If we're reading Web pages, and the only impact of replay 
  1038.    is that the attacker could re-read the page, it might be 
  1039.    acceptable--after all, the attacker saw the page, anyway, when he 
  1040.    captured it along with the original request. On the other hand, if 
  1041.    we're charging the user per page, or if the request "did" something, 
  1042.  
  1043.  
  1044. Brown                                                          [Page 18]
  1045.  
  1046. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1047.  
  1048.  
  1049.    replay might not be so harmless. 
  1050.    
  1051.    One strategy is to maintain some history. In its simplest form, the 
  1052.    service sets a flag for this session when it does something for which 
  1053.    replay would be harmful. If the user tries reauthentication cheating, 
  1054.    and the flag is set, the service forces reauthentication. Because the 
  1055.    cheating response is based on Cu and Cs, and those values change 
  1056.    during reauthentication, the correct response for a given URI changes 
  1057.    after reauthentication. Thus, reauthentication creates a boundary 
  1058.    after which previous requests cannot be replayed. 
  1059.    
  1060.    Or the service can maintain a history of URIs for which replay would 
  1061.    be harmful, and force reauthentication only if the user tries 
  1062.    reauthentication cheating on one of those URIs. 
  1063.    
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102. Brown                                                          [Page 19]
  1103.  
  1104. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1105.  
  1106.  
  1107.                      Remote Passphrase Authentication
  1108.                                   Part 2
  1109.                         HTTP Authentication Scheme
  1110.    
  1111.  
  1112. Table of Contents 
  1113.    
  1114.    7. INTRODUCTION 
  1115.    
  1116.    8. USING THIS AUTHENTICATION MECHANISM IN HTTP  
  1117.    8.1 AUTHENTICATION      
  1118.    8.2 REAUTHENTICATION CHEATING   
  1119.    8.3 REAUTHENTICATION    
  1120.    
  1121.  
  1122. 7 Introduction 
  1123.    
  1124.    See Part One of this series for an explanation of the mechanism, its 
  1125.    motivation, and its specification. This part describes only the HTTP 
  1126.    encapsulation of the mechanism. 
  1127.    
  1128.  
  1129. 8 Using this authentication mechanism in HTTP 
  1130.    
  1131.    The HTTP client may indicate that it supports this authentication 
  1132.    mechanism by whatever technique is appropriate. 
  1133.    
  1134.         [For example, a header like "Extension: 
  1135.         Security/Remote-Passphrase" might be appropriate, if that 
  1136.         extension mechanism is adopted. The extension mechanism is, 
  1137.         of course, independent of authentication, but we mention it 
  1138.         here to point out the issue. Theoretically, the server does 
  1139.         not need to know ahead of time whether the client supports 
  1140.         a particular authentication scheme.] 
  1141.    
  1142.    We begin by defining a security context, which represents a logical 
  1143.    connection between a user and Web server. Because the context spans 
  1144.    HTTP connections, the server assigns a security context identifier, 
  1145.    an opaque string, when it creates a context, and it informs the 
  1146.    client of its value in the Security-Context attribute of the 
  1147.    WWW-Authenticate header. The client includes the identifier in the 
  1148.    Authorization header of subsequent requests that refer to the same 
  1149.    context. 
  1150.    
  1151.    From the client's point of view, the pair (server IP address, 
  1152.    security context identifier) uniquely identifies a context; the same 
  1153.    is essentially true for the server, although a server can make its 
  1154.    security context identifiers unique, rather than (client IP address, 
  1155.    identifier) pairs. 
  1156.    
  1157.    Note that a client might refer to the same security context from 
  1158.  
  1159.  
  1160. Brown                                                          [Page 20]
  1161.  
  1162. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1163.  
  1164.  
  1165.    different IP addresses, if he switches proxies (is that possible?). 
  1166.    Note also that the client IP address alone is not adequate to 
  1167.    identify the security context. A multiple-user host, an HTTP proxy, 
  1168.    and a SOCKS server are examples of situations in which the same IP 
  1169.    address may be involved in many security contexts. And even an 
  1170.    individual PC running two browsers falls into this category--if I 
  1171.    connect to you from both browsers, I'll establish two security 
  1172.    contexts, which might or might not refer to the same user identity. 
  1173.    
  1174.    The server should assign security context identifiers that are unique 
  1175.    over time. If the client refers to an old context identifier--the 
  1176.    user returns to his PC tomorrow morning and clicks a link that was 
  1177.    displayed yesterday--it will do no harm if that identifier had been 
  1178.    reused, but the server won't be able to recognize it as such. 
  1179.    
  1180.    The security context "contains" information appropriate to the 
  1181.    context, such as the realm name, user and service names, session key, 
  1182.    challenges, state, etc. We'll gloss over the details in this 
  1183.    explanation. Note that a session using this mechanism is secure; 
  1184.    unlike other "cookie"-type mechanisms, we do not depend on the 
  1185.    secrecy of the context identifier. However, the content of requests 
  1186.    and responses is not authenticated, in this version of the protocol. 
  1187.    
  1188.    We define the authentication scheme name "Remote-Passphrase", used as 
  1189.    described below. The client begins by making a request for which the 
  1190.    server requires identification and authentication; because there is 
  1191.    no Authorization header in the request, the server will demand 
  1192.    authentication. 
  1193.    
  1194.    All WWW-Authenticate and Authorization headers used with this scheme 
  1195.    may include a Version attribute. When omitted, as in the examples 
  1196.    below, Version="1" is implied, for this version of the protocol. 
  1197.    
  1198. 8.1 Authentication 
  1199.    
  1200.    The server creates a new security context, assigns it an identifier, 
  1201.    and responds 401 Unauthorized and includes the header 
  1202.    
  1203.        WWW-Authenticate:
  1204.                Remote-Passphrase
  1205.                Realm="compuserve.com",
  1206.                State="Initial",
  1207.                Realms="foo@compuserve.com
  1208.                        bar@aol.com:iso-8859-1,lc,md5",
  1209.                Challenge="base64 encoding of service challenge",
  1210.                Timestamp="19950808132430",
  1211.                Security-Context="opaque"
  1212.    
  1213.    The first token specifies the authentication scheme, 
  1214.    Remote-Passphrase. That's followed by a comma-separated list of 
  1215.    attribute-value pairs. HTTP requires the first attribute to be called 
  1216.  
  1217.  
  1218. Brown                                                          [Page 21]
  1219.  
  1220. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1221.  
  1222.  
  1223.    "Realm" and specify the realm in which the user must indicate his 
  1224.    identity, but we support multiple realms, so this is merely one realm 
  1225.    acceptable to the server, perhaps its preferred realm. 
  1226.    
  1227.    The State attribute distinguishes this as the initial request for 
  1228.    authentication. 
  1229.    
  1230.    The Realms attribute provides a list of realms in the order preferred 
  1231.    by the server, with the server's name in each realm. Each may be 
  1232.    followed by a colon and a list of parameters separated by commas, to 
  1233.    drive the transformation from pass phrase to 128-bit shared secret 
  1234.    for that particular realm. Refer to Part One of this specification 
  1235.    for more information about the transformation. 
  1236.    
  1237.    The default transformation, if the colon and parameters are omitted, 
  1238.    is specified in Part One of this specification--the Unicode character 
  1239.    set in big-endian ("network") byte order, with all characters 
  1240.    converted to lowercase, and the MD5 hash algorithm. 
  1241.    
  1242.    Otherwise, a single parameter, "none", implies that the client must 
  1243.    already possess a 128-bit value, and no transformation from a textual 
  1244.    pass phrase is defined. 
  1245.    
  1246.    Otherwise, three parameters control the transformation from a textual 
  1247.    pass phrase to the 128-bit shared secret used by the authentication 
  1248.    mechanism, if such a transformation takes place (it might not, if the 
  1249.    client believes it already knows a 128-bit value for this user). The 
  1250.    three parameters specify the character set: Unicode 1.1 
  1251.    ("unicode-1-1") or ISO 8859-1 ("iso-8859-1"); case conversion: 
  1252.    convert to all caps ("uc"), all lowercase ("lc"), or as-is with no 
  1253.    case conversion ("nc"); and hash function: MD5 ("md5"). Omitting the 
  1254.    colon and parameters is equivalent to specifying 
  1255.    "unicode-1-1,lc,md5". 
  1256.    
  1257.         [There's no need for US-ASCII as a character set, because 
  1258.         ISO 8859-1 will give the same results. Note that these 
  1259.         parameters are part of the base authentication mechanism 
  1260.         specification; only the means of conveying them, and the 
  1261.         textual names shown above, are specific to this HTTP 
  1262.         authentication scheme. Other variations can be added, but 
  1263.         they must be added to the authentication mechanism defined 
  1264.         by Part One of this specification as well as here in Part 
  1265.         Two.] 
  1266.    
  1267.    We convey this information to the client because there's no reason 
  1268.    the client would otherwise know whether a particular realm's pass 
  1269.    phrases are case sensitive, etc. The server, on the other hand, 
  1270.    simply must "know" how its particular realm uses pass phrases; these 
  1271.    characteristics are a part of server's configuration along with its 
  1272.    name in the realm, deity addresses, etc. 
  1273.    
  1274.  
  1275.  
  1276. Brown                                                          [Page 22]
  1277.  
  1278. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1279.  
  1280.  
  1281.    The Challenge attribute specifies the service's challenge. It is an 
  1282.    arbitrarily long sequence of octets containing arbitrary bit 
  1283.    patterns, represented in base64. The client must decode it before 
  1284.    using it in the authentication calculations; it might contain nulls 
  1285.    or any other bit patterns. The client may decline to trust the server 
  1286.    and abort at this point, if it deems the challenge to be too short. 
  1287.    
  1288.    The Timestamp attribute specifies the server's timestamp. This is a 
  1289.    UTC date and time in the format specified by the authentication 
  1290.    standard. It may be treated as an opaque string by the client, unless 
  1291.    the client chooses to interpret it to make a judgement about its 
  1292.    reality; but beware that you probably don't have a reliable source of 
  1293.    universal time. 
  1294.    
  1295.    The Security-Context attribute contains the server-assigned security 
  1296.    context identifier, an opaque string. 
  1297.    
  1298.    The client creates its security context and repeats the request with 
  1299.    an Authorization header: 
  1300.    
  1301.        Authorization:
  1302.                Remote-Passphrase
  1303.                State="Initial",
  1304.                Security-Context="opaque",
  1305.                Realm="compuserve.com",
  1306.                Username="70003.1215",
  1307.                Challenge="base64 encoding of user challenge",
  1308.                Response="base64 encoding of response"
  1309.    
  1310.    The first token specifies the authorization scheme. That's followed 
  1311.    by the state, "Initial" for the initial authentication; the security 
  1312.    context identifier; the realm chosen by the user; the user's identity 
  1313.    in that realm; the user's challenge; and the user's response. 
  1314.    
  1315.    The service looks up the security context. If the security context 
  1316.    identifier refers to no context or refers to a context that is 
  1317.    already established, the server creates a new security context with a 
  1318.    new identifier, then responds 401 Unauthorized and includes a fresh 
  1319.    WWW-Authenticate header as shown above, with which the client can 
  1320.    repeat the request with correct authentication information. 
  1321.    
  1322.         [Or does this risk a loop? We could just respond with an 
  1323.         error.] 
  1324.    
  1325.    Any existing security context is unaffected; if I send you a request 
  1326.    that specifies someone else's security context, you should not delete 
  1327.    his context. 
  1328.    
  1329.    Otherwise--the context identifier is recognized and that context is 
  1330.    in the awaiting authentication state--the server performs the 
  1331.    authentication process. 
  1332.  
  1333.  
  1334. Brown                                                          [Page 23]
  1335.  
  1336. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1337.  
  1338.  
  1339.    
  1340.    The server may verify that the client's IP address matches that in 
  1341.    the previous request that created the "pending" context. The only 
  1342.    risk is that someone might change proxies at whim, which seems 
  1343.    unlikely. 
  1344.    
  1345.    If the authentication process fails, the server refuses to process 
  1346.    the request, but does not delete the "pending" security context. It 
  1347.    generates a 401 Unauthorized response with a WWW-Authenticate header 
  1348.    that indicates failure: 
  1349.    
  1350.        WWW-Authenticate:
  1351.                Remote-Passphrase
  1352.                Realm="nonsense",
  1353.                State="Failed"
  1354.    
  1355.    It is up to the client to try the request again (without an 
  1356.    Authorization header), restarting the entire process, if it believes 
  1357.    that it was using the wrong pass phrase but it now has the right pass 
  1358.    phrase. 
  1359.    
  1360.         [Sending another "Initial" WWW-Authenticate header would 
  1361.         provoke a loop: the browser would calculate a new response 
  1362.         and retry the request, which is pointless if the browser's 
  1363.         idea of the pass phrase is wrong, so we indicate the 
  1364.         failure.] 
  1365.    
  1366.         [One could argue that the browser should forget whichever 
  1367.         cached pass phrase it used, in order to prompt for it again 
  1368.         if the user tries to next time. But the pass phrase might 
  1369.         have been correct, depending on what exactly went wrong at 
  1370.         the server.] 
  1371.    
  1372.    Otherwise, having successfully authenticated the user, the server 
  1373.    processes the client's request and returns an appropriate response, 
  1374.    including in its reply: 
  1375.    
  1376.        WWW-Authenticate:
  1377.                Remote-Passphrase
  1378.                Realm="realm in use",
  1379.                State="Authenticated",
  1380.                Session-Key="base64 encoding of session key",
  1381.                Response="base64 encoding of response"
  1382.    
  1383.    The "Authenticated" state indicates that the user was successfully 
  1384.    authenticated, and includes the session key, masked so only the user 
  1385.    can extract it (Kusu), and the authentication deity's proof of the 
  1386.    service's identity (Au, not Rs). The realm is ignorable, but should 
  1387.    indicate the realm in which the identity was authenticated. 
  1388.    
  1389.  
  1390.  
  1391.  
  1392. Brown                                                          [Page 24]
  1393.  
  1394. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1395.  
  1396.  
  1397. 8.2 Reauthentication cheating 
  1398.    
  1399.    In subsequent requests, the client tries to cheat by including an 
  1400.    Authorization header in its request: 
  1401.    
  1402.        Authorization:
  1403.                Remote-Passphrase
  1404.                State="Cheating",
  1405.                Security-Context="opaque",
  1406.                Response="base64 encoding of response"
  1407.    
  1408.    where the response is calculated based on the previously agreed-upon 
  1409.    values plus the canonicalized method and URI of this request as 
  1410.    explained in Part One of this specification. 
  1411.    
  1412.         [The HTTP specification suggests that clients be allowed to 
  1413.         replay the previous Authorization header, but it includes 
  1414.         an escape clause--"for a period of time determined by the 
  1415.         authentication scheme"--so we simply declare that period of 
  1416.         time to be zero.] 
  1417.    
  1418.    If the server is willing to accept the use of reauthentication 
  1419.    cheating, and the response is correct, the server processes the 
  1420.    request without comment. If it recognizes the security context but is 
  1421.    not willing to cheat--e.g., it recognizes a replay--the server 
  1422.    demands reauthentication. If it does not recognize the security 
  1423.    context or if it recognizes the context but the client's response is 
  1424.    incorrect, the server demands authentication but does not delete the 
  1425.    existing security context. 
  1426.    
  1427.         [Perhaps the user is referring to a security context that 
  1428.         has expired because it's been a long time since the user 
  1429.         last referred to it. And this can happen legitimately, if 
  1430.         the user refers to an expired security context and the 
  1431.         server reuses context identifiers. We do not delete an 
  1432.         existing context because that would provide a way for an 
  1433.         attacker to delete security contexts.] 
  1434.    
  1435.    In either of these cases, the server responds 401 Unauthorized and 
  1436.    includes the appropriate WWW-Authenticate header. To require 
  1437.    authentication, refer to the preceding section; to require 
  1438.    reauthentication, refer to the next section. 
  1439.    
  1440. 8.3 Reauthentication 
  1441.    
  1442.    If the server chooses to require reauthentication, it replies 401 
  1443.    Unauthorized and includes the header 
  1444.    
  1445.        WWW-Authenticate:
  1446.                Remote-Passphrase
  1447.                Realm="realm in use",
  1448.  
  1449.  
  1450. Brown                                                          [Page 25]
  1451.  
  1452. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1453.  
  1454.  
  1455.                State="Reauthenticate",
  1456.                Challenge="base64 encoding of service challenge"
  1457.    
  1458.    The client retries the request with an Authorization field: 
  1459.    
  1460.        Authorization:
  1461.                Remote-Passphrase
  1462.                State="Reauthenticate",
  1463.                Security-Context="opaque",
  1464.                Challenge="base64 encoding of user challenge",
  1465.                Response="base64 encoding of response"
  1466.    
  1467.    If the response is correct--the user has proven his knowledge of the 
  1468.    previously generated Kus for this context--the server processes the 
  1469.    request and includes in its reply: 
  1470.    
  1471.        WWW-Authenticate:
  1472.                Remote-Passphrase
  1473.                Realm="realm in use",
  1474.                State="Reauthenticated",
  1475.                Response="base64 encoding of response"
  1476.    
  1477.    The past-tense state indicates successful reauthentication, and 
  1478.    includes the server's response; this response is of debatable 
  1479.    relevance to HTTP, of course, given that the client's use of 
  1480.    reauthentication cheating implies its willingness to trust that the 
  1481.    server's identity has not changed. 
  1482.    
  1483.    If the client's response is incorrect, the server does not process 
  1484.    the request. However, there's a possibility that the client attempted 
  1485.    to do reauthentication with an old security context identifier that 
  1486.    has been reused by the server. Although the server should avoid 
  1487.    reusing security context identifiers, it can attempt to avert the 
  1488.    problem by forcing authentication by responding 401 Unauthorized and 
  1489.    including the header described above under Authentication. 
  1490.    
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508. Brown                                                          [Page 26]
  1509.  
  1510. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1511.  
  1512.  
  1513.                      Remote Passphrase Authentication
  1514.                                   Part 3
  1515.                          Service-to-Deity Protocol
  1516.    
  1517.  
  1518. 9 Introduction 
  1519.    
  1520.    The service sends a request to the authentication diety and receives 
  1521.    a reply. The requests and replies may be packaged in UDP datagrams, 
  1522.    or as byte streams over a TCP connection. The tradeoff is primarily 
  1523.    that opening a TCP connection requires multiple round trip delays, 
  1524.    where UDP doesn't; but TCP avoids the "I wonder whether it's actually 
  1525.    running" issue. 
  1526.    
  1527.    How to find the deity is a service configuration issue. The service 
  1528.    must know the IP addresses, TCP or UDP port numbers, etc., for the 
  1529.    deities for a particular realm; it must also know its name and pass 
  1530.    phrase in that realm. 
  1531.    
  1532.  
  1533. 10 Object formats 
  1534.    
  1535.    Every message is an object composed of other objects. Every object 
  1536.    consists of a type-length-value encoded structure: 
  1537.    
  1538.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1539.    |     Type      |   Length MSB  |   Length LSB  | Value octet 1 |
  1540.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1541.    | Value octet 2 | Value octet 3 | Value octet 4 |      ...      |
  1542.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1543.    
  1544.    In this picture, each box represents one octet. Octets are 
  1545.    transmitted in order from left to right, top to bottom. 
  1546.    
  1547.    "Type" is a single octet that identifies the type of the object. 
  1548.    
  1549.    "Length" indicates the number of octets following the length field, 
  1550.    as a 16-bit, big-endian value. The appropriate number of value 
  1551.    octets--possibly none--follow the length field. Their meaning is 
  1552.    determined by the type of the object; in some cases, the value octets 
  1553.    contain a sequence of other objects. 
  1554.    
  1555.    Here is an example of an object that contains 4 value octets: 
  1556.    
  1557.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1558.    |     Type      |0 0 0 0 0 0 0 0|0 0 0 0 0 1 0 0| Value octet 1 |
  1559.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1560.    | Value octet 2 | Value octet 3 | Value octet 4 |
  1561.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1562.    
  1563.    And here is an example of an object that contains 1,000 value octets: 
  1564.  
  1565.  
  1566. Brown                                                          [Page 27]
  1567.  
  1568. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1569.  
  1570.  
  1571.    
  1572.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1573.    |     Type      |0 0 0 0 0 0 1 1|1 1 1 0 1 0 0 0| Value octet 1 |
  1574.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1575.    | Value octet 2 | Value octet 3 | Value octet 4 | Value octet 5 |
  1576.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1577.    |                              ...                              |
  1578.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1579.    |Value octet 996|Value octet 997|Value octet 998|Value octet 999|
  1580.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1581.    |Value octet1000|
  1582.    +-+-+-+-+-+-+-+-+
  1583.    
  1584.    No padding or alignment is used; if an object contains sub-objects, 
  1585.    they follow one another with no padding. For example, an object whose 
  1586.    value consists consists of three sub-objects might look like this: 
  1587.    
  1588.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1589.    |  Object type  |   00000000    |   00001111    |Sub-obj 1 type |
  1590.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1591.    |   00000000    |   00000101    | Value octet 1 | Value octet 2 |
  1592.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1593.    | Value octet 3 | Value octet 4 | Value octet 5 |Sub-obj 2 type |
  1594.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1595.    |   00000000    |   00000000    |Sub-obj 3 type |   00000000    |
  1596.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1597.    |   00000001    | Value octet 1 |
  1598.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1599.    
  1600.    In this example, we have a single object whose value contains 15 
  1601.    octets. In this example, the value is a sequence of three objects, 
  1602.    the first of which contains five octets, the second of which is zero 
  1603.    length, and third of which contains one octet. The meaning of each 
  1604.    object depends on its type; we'll describe all object types in detail 
  1605.    after describing the message objects. 
  1606.    
  1607.    We'll sometimes use the term "sub-object" to refer to an object when 
  1608.    it is a part of another object, but this is merely a matter of 
  1609.    terminology. There is no difference in encoding nor in the meaning of 
  1610.    the type field, regardless of whether the object is contained in some 
  1611.    other object or not. 
  1612.    
  1613.    All messages may contain a "blob" that conveys information defined by 
  1614.    a particular deity. The blob is envisioned for use in three contexts. 
  1615.    
  1616.    * In a request, a service may use the blob to tell the deity the 
  1617.      nature of the action for which authentication is being performed, 
  1618.      if there's some reason to do so. In addition, the service might ask 
  1619.      the diety for particular information about the username being 
  1620.      authenticated, although, in the general case, the deity will 
  1621.      already know what additional information to return to a particular 
  1622.  
  1623.  
  1624. Brown                                                          [Page 28]
  1625.  
  1626. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1627.  
  1628.  
  1629.      service. 
  1630.      
  1631.    * In an affirmative response, the deity may return additional 
  1632.      information about the username. 
  1633.      
  1634.    * In other responses, the blob might indicate something about the 
  1635.      nature of the problem. 
  1636.      
  1637.    In general, different deities and services will have different 
  1638.    information that's appropriate for inclusion in the blob, so it is 
  1639.    difficult to conceive of a truly "standard" set of information. 
  1640.    However, we define one format that we'll describe below. 
  1641.    
  1642.  
  1643. 11 Message object types 
  1644.    
  1645.    There are six message object types, one for a request and six kinds 
  1646.    of replies. 
  1647.    
  1648.    * Authentication request 
  1649.    * Authentication response, affirmative 
  1650.    * Authentication response, no service 
  1651.    * Authentication response, negative 
  1652.    * Authentication response, invalid service 
  1653.    * Authentication response, problem 
  1654.      
  1655.    The various response flavors indicate various conditions of the 
  1656.    account as described below. 
  1657.    
  1658.    Remember, a message is simply an object that contains other objects. 
  1659.    The message itself is encoded as a type, length, and value, as 
  1660.    described above, where the value consists of the concatenation of the 
  1661.    component objects of that message; each component object consists of 
  1662.    its own type, length, and value. Unless stated to the contrary, all 
  1663.    messages must contain exactly the objects indicated in the order 
  1664.    shown. Optional components, such as the blob, may be omitted. 
  1665.    
  1666.         [When appropriate, it is possible to add extensions, or 
  1667.         make a sub-object optional, yet parse the containing object 
  1668.         successfully. But in a security protocol, it is best to 
  1669.         stick to well-defined formats, rather than adopting a 
  1670.         "construct them any way you wish" attitude.] 
  1671.    
  1672.    Contents of the component objects are explained in more detail 
  1673.    following the descriptions of the message objects. 
  1674.    
  1675. 11.1 Authentication request 
  1676.    
  1677.    An authentication request contains the following sub-objects. 
  1678.    
  1679.  
  1680.  
  1681.  
  1682. Brown                                                          [Page 29]
  1683.  
  1684. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1685.  
  1686.  
  1687.        Request identifier
  1688.        Nr (Realm name)
  1689.        Ns (Service name)
  1690.        Nu (User name)
  1691.        Cu (Challenge from user)
  1692.        Cs (Challenge from service)
  1693.        Ts (Timestamp from service)
  1694.        Ru (Response from user)
  1695.        Blob (optional)
  1696.        Rs (Response from service)
  1697.    
  1698.    The value contained in most of the sub-objects matches the value 
  1699.    described in Part One of this specification. 
  1700.    
  1701.    The request identifier contains arbitrary data that is not 
  1702.    interpreted by the deity; it is simply echoed in a response to 
  1703.    provide a way for the requesting service to match requests and 
  1704.    responses. 
  1705.    
  1706.    The blob contains additional information about the request, and is 
  1707.    described below. Usually, it will be omitted or null, i.e., 
  1708.    zero-length. 
  1709.    
  1710.    Rs is calculated as MD5(Ps + Z + M + Ps), where M is the request 
  1711.    shown above, octet by octet, from the type octet for the message 
  1712.    object itself through the last length octet of the length field of 
  1713.    the Rs object. Thus, it serves to protect the entire request, 
  1714.    including its structure, length, etc., and is a different calculation 
  1715.    from that shown in the authentication document. 
  1716.    
  1717. 11.2 Authentication response, affirmative 
  1718.    
  1719.    An affirmative response indicates that the username is recognized, 
  1720.    and is indeed the user you're talking to. 
  1721.    
  1722.        Request identifier
  1723.        Canonical Nu (User name, case corrected)
  1724.        Kuss (Key obscured for service)
  1725.        Kusu (Key obscured for user)
  1726.        Au (Authentication value for user)
  1727.        Blob (optional)
  1728.        As (Authentication value for service)
  1729.    
  1730.    The response contains the canonical username in the desired case; 
  1731.    this is not the same object type as Nu in the request. In an 
  1732.    environment that is not case sensitive, this is the preferred form of 
  1733.    the name, which might differ from the name in the request. 
  1734.    
  1735.    The blob may contain additional information about the username; see 
  1736.    below. 
  1737.    
  1738.  
  1739.  
  1740. Brown                                                          [Page 30]
  1741.  
  1742. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1743.  
  1744.  
  1745.    As is calculated as 
  1746.    
  1747.        MD5(Ps + Z + Ns + Nu + Nr + Kuss + Cs + Cu + Ts + Kus + M + Ps) 
  1748.    
  1749.    where M is the request shown above, octet by octet, from the type 
  1750.    octet for the containing object through the last octet of the length 
  1751.    field of the As object, inclusive. This serves to protect the entire 
  1752.    request, and differs from the calculation in the authentication 
  1753.    document by the addition of the message contents as shown. Note that 
  1754.    the Nu mentioned as the third component in the formula is the 
  1755.    originally specified username, not the altered-case version in the 
  1756.    response message. 
  1757.    
  1758.    Beware that an affirmative response does not necessarily mean that it 
  1759.    is reasonable to provide service to the user. Often, there are 
  1760.    criteria beyond a "yes" answer, which could mean anything from "it's 
  1761.    a valid user" to "it's a valid user but not billable" to "it's an 
  1762.    account that was signed up five minutes ago and we haven't had a 
  1763.    chance to look at it yet." 
  1764.    
  1765.    Typically, the authentication deity applies criteria appropriate to 
  1766.    the requesting service. For example, if the service doesn't want to 
  1767.    allow "free" users, the authentication deity would be configured to 
  1768.    return a no-service response for such a user. Alternatively, the 
  1769.    deity could be configured to provide an affirmative response but 
  1770.    include information in the blob that would permit the service to 
  1771.    distinguish "free" from "paying" users and treat them differently. 
  1772.    
  1773. 11.3 Authentication response, no service 
  1774.    
  1775.    The no-service response is an indication that the user is whom he 
  1776.    claims to be, but you should not provide service to him for one 
  1777.    reason or another. For example, he might be a "free" user but your 
  1778.    service is provided only to paying accounts; his billing choices 
  1779.    might not include your service; or Customer Service might be waiting 
  1780.    for him to provide a new credit card number. 
  1781.    
  1782.    The authentication deity's configuration for this particular service 
  1783.    determines the criteria applied by the deity when making the decision 
  1784.    to reply affirmative or no service. 
  1785.    
  1786.        Request identifier
  1787.        Canonical Nu (User name, case corrected)
  1788.        Kuss (Key obscured for service)
  1789.        Kusu (Key obscured for user)
  1790.        Au (Authentication value for user)
  1791.        Blob (optional)
  1792.        As (Authentication value for service)
  1793.    
  1794.    The contents of this object are identical to those for an affirmative 
  1795.    response, but the service would not normally use the keys or Au 
  1796.  
  1797.  
  1798. Brown                                                          [Page 31]
  1799.  
  1800. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1801.  
  1802.  
  1803.    values. The blob might include information useful in distinguishing 
  1804.    the reason for the no service response, if appropriate for this 
  1805.    service. 
  1806.    
  1807. 11.4 Authentication response, negative 
  1808.    
  1809.    A negative response means the user is not who he says he is. Whether 
  1810.    there is such a username, but that's not who you're talking to; there 
  1811.    is such a username, but it is not an enabled account; or there is no 
  1812.    such username, is not specified. 
  1813.    
  1814.        Request identifier
  1815.        Blob (optional)
  1816.        As (Authentication value for service)
  1817.    
  1818.    As is calculated as MD5(Ps + Z + M + Ps). The message may contain a 
  1819.    blob if there is additional information about the problem, e.g., for 
  1820.    logging, but it may be omitted. 
  1821.    
  1822. 11.5 Authentication response, invalid service 
  1823.    
  1824.    An invalid request response means the request could not be processed 
  1825.    because you (the service) are not whom you claim to be, based on your 
  1826.    apparently not knowing the service's pass phrase or based on any 
  1827.    other kind of authentication checking done by the deity. 
  1828.    
  1829.        Request identifier
  1830.        Blob (optional)
  1831.    
  1832.    The blob, if present, contains information that allows the deity 
  1833.    administrators to trace the problem. There is no As field, because 
  1834.    there is no shared secret to authenticate the response. This presents 
  1835.    some obvious denial of service issues. 
  1836.    
  1837. 11.6 Authentication response, problem 
  1838.    
  1839.    A "problem" response indicates that the request could not be 
  1840.    processed for some reason. This could indicate a failure in the 
  1841.    system, an unparsable request, or a request for a realm that isn't 
  1842.    handled by this deity. 
  1843.    
  1844.        Request identifier
  1845.        Blob (optional)
  1846.        As (optional)
  1847.    
  1848.    The blob may contain information that allows the deity administrators 
  1849.    to trace the problem. As might or might not be present, depending on 
  1850.    the nature of the problem, i.e., whether there is a known shared 
  1851.    secret with the server; if present, it is calculated as MD5(Ps + Z + 
  1852.    M + Ps). 
  1853.    
  1854.  
  1855.  
  1856. Brown                                                          [Page 32]
  1857.  
  1858. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1859.  
  1860.  
  1861. 12 Object types 
  1862.    
  1863.    The following types of objects are defined in this protocol. These 
  1864.    object types apply to the messages themselves and objects contained 
  1865.    in messages. These types do not apply to the contents of the blob. 
  1866.    
  1867.         [Numbers for the object type field are indicated for each 
  1868.         type, but are not necessarily accurate in this draft of the 
  1869.         document.] 
  1870.    
  1871.    Authentication request--type 1--The request to the authentication 
  1872.    deity. Its contents consist of a sequence of other objects as 
  1873.    described elsewhere in this document. 
  1874.    
  1875.    Authentication response, affirmative--type 2 
  1876.    
  1877.    Authentication response, no service--type 3 
  1878.    
  1879.    Authentication response, negative--type 4 
  1880.    
  1881.    Authentication response, invalid service--type 5 
  1882.    
  1883.    Authentication response, problem--type 6 
  1884.    
  1885.    Request identifier--type 128--A request must contain an identifier to 
  1886.    assist in matching replies to requests. This identifier is opaque to 
  1887.    the deity, and is simply echoed in the reply, so its value is defined 
  1888.    only by the requesting entity. The value should, of course, be unique 
  1889.    for each request, but it is otherwise meaningless. It may be of any 
  1890.    length. 
  1891.    
  1892.    Realm name--type 129--The name of the realm in which the user's and 
  1893.    service's identities exist. This is included in the request to allow 
  1894.    a deity to serve more than one realm. The value consists of the name 
  1895.    in Unicode, in big-endian order. There is no terminating null 
  1896.    character, and the realm is generally treated as being case 
  1897.    insensitive. For example, the realm aol.com might look like this: 
  1898.    
  1899.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1900.    |   10000001    |   00000000    |   00001110    |   00000000    |
  1901.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1902.    |   01100001    |   00000000    |   01101111    |   00000000    |
  1903.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1904.    |   01101100    |   00000000    |   00101110    |   00000000    |
  1905.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1906.    |   01100011    |   00000000    |   01101111    |   00000000    |
  1907.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  1908.    |   01101101    |
  1909.    +-+-+-+-+-+-+-+-+
  1910.    
  1911.    That's type 129, fourteen octets follow, and the big-endian Unicode 
  1912.  
  1913.  
  1914. Brown                                                          [Page 33]
  1915.  
  1916. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1917.  
  1918.  
  1919.    representation of the seven characters aol.com. 
  1920.    
  1921.    Service name--type 130--The name of the service in big-endian 
  1922.    Unicode. 
  1923.    
  1924.    User name--type 131--The name of the user in big-endian Unicode, 
  1925.    e.g., gsb. 
  1926.    
  1927.    User challenge--type 132--The user's challenge, a sequence of random 
  1928.    octets. The length is not bounded by the protocol, but the deity will 
  1929.    impose length restrictions, e.g., a minimum and maximum length. All 
  1930.    bit patterns are legal in the challenge. 
  1931.    
  1932.    Service challenge--type 133--The service's challenge, a sequence of 
  1933.    random octets. The length is not bounded by the protocol, but the 
  1934.    deity will impose length restrictions, e.g., a minimum and maximum 
  1935.    length. All bit patterns are legal in the challenge. 
  1936.    
  1937.    Time stamp--type 134--The time stamp, containing 14 octets with the 
  1938.    value specified in Part One of this specification. 
  1939.    
  1940.    User's response--type 135--The user's response, containing 16 octets 
  1941.    with the value specified in Part One of this specification. This is a 
  1942.    binary value, so any bit pattern is possible in this value. 
  1943.    
  1944.    Service's response--type 136--The service's response, calculated as 
  1945.    described elsewhere in this document. This is a binary value, so any 
  1946.    bit pattern is possible in this value. 
  1947.    
  1948.    Key obscured for user--type 137--The key for the user, containing 16 
  1949.    octets as described in Part One of this specification. This is a 
  1950.    binary value, so any bit pattern is possible in this value. 
  1951.    
  1952.    Key obscured for service--type 138--The key for the service, 
  1953.    containing 16 octets as described in Part One of this specification. 
  1954.    This is a binary value, so any bit pattern is possible in this value. 
  1955.    
  1956.    Authentication proof for user--type 139--The authentication proof, 
  1957.    Au, for the user, containing 16 octets as described in Part One of 
  1958.    this specification. This is a binary value, so any bit pattern is 
  1959.    possible in this value. 
  1960.    
  1961.    Authentication proof for service--type 140--The authentication proof, 
  1962.    As, for the service, containing 16 octets calculated as described 
  1963.    elsewhere in this document (not as described in Part One of this 
  1964.    specification). This is a binary value, so any bit pattern is 
  1965.    possible in this value. 
  1966.    
  1967.    Canonical user name--type 141--The username adjusted to canonical 
  1968.    case, in big-endian Unicode. 
  1969.    
  1970.  
  1971.  
  1972. Brown                                                          [Page 34]
  1973.  
  1974. Internet Draft      Remote Passphrase Authentication         19 May 1997
  1975.  
  1976.  
  1977.    Blob--type 142--Deity-specific request and response information. 
  1978.    
  1979.  
  1980. 13 The blob 
  1981.    
  1982.    The first two octets in the blob contain a major/minor version number 
  1983.    to indicate the format of the blob. This format is version 1.0, the 
  1984.    two octets 0x01 0x00. 
  1985.    
  1986.    This is followed by multiple null-terminated attribute name-value 
  1987.    pairs with the final attribute followed by an additional null. Names 
  1988.    and values are represented in the ISO 8859-1 character set. The 
  1989.    format of an attribute/value pair is 
  1990.    
  1991.        name[=[value]] 
  1992.    
  1993.    That is, an attribute name may exist alone, implying that just its 
  1994.    existence is significant. Additionally, the value may be a null 
  1995.    string, in which case the '=' character is followed immediately by a 
  1996.    null character. 
  1997.    
  1998.    Attribute names may consist of letters, digits, hyphens, and 
  1999.    underscores; letter case is not significant. The first character must 
  2000.    be a letter or underscore. Attribute values may contain any ISO 
  2001.    8859-1 graphic character; they may not contain control characters, 
  2002.    but they may contain spaces (i.e., octet values 00-1F and 7F-9F are 
  2003.    illegal). If, for some reason, a particular attribute value should 
  2004.    contain arbitrary octet values, it must be encoded somehow, e.g., by 
  2005.    using base64 or MIME quoted-printable encoding. (We presume that you 
  2006.    know, when you get around to using an attribute value, how it's 
  2007.    formatted, so as to know whether some form of decoding is necessary.) 
  2008.    
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030. Brown                                                          [Page 35]
  2031.  
  2032. Internet Draft      Remote Passphrase Authentication         19 May 1997
  2033.  
  2034.  
  2035.                      Remove Passphrase Authentication
  2036.                                   Part 4
  2037.                              GSS-API Handshake
  2038.    
  2039.  
  2040. Table of Contents 
  2041.    
  2042.    14. INTRODUCTION
  2043.    
  2044.    15. THE HANDSHAKE
  2045.    15.1 TOKEN 1 (NEGOTIATION, CLIENT-TO-SERVER)
  2046.    15.2 TOKEN 2 (CHALLENGE, SERVER-TO-CLIENT)
  2047.    15.3 TOKEN 3 (AUTHENTICATION, CLIENT-TO-SERVER)
  2048.    15.4 TOKEN 4 (AUTHENTICATION, SERVER-TO-CLIENT)
  2049.    15.5 TOKEN 5 (HACK, CLIENT-TO-SERVER)
  2050.    15.6 FIELD DESCRIPTIONS
  2051.    
  2052.    16 SAMPLE CONVERSATION
  2053.    
  2054.  
  2055. 14 Introduction 
  2056.    
  2057.    This section explains the GSS-API handshake for RPA, used by 
  2058.    connection-oriented protocols such as NNTP, POP3, etc. We define 
  2059.    "tokens" that are conveyed from end to end; they contain arbitrary 
  2060.    binary data, so a text-based protocol would generally use base64 
  2061.    encoding to transport the token. 
  2062.    
  2063.  
  2064. 15 The handshake 
  2065.    
  2066.    RPA uses a four-way or five-way handshake. The protocol requires only 
  2067.    a four-way handshake, and the additional hop is used to support 
  2068.    servers that require the last authentication step to go from the 
  2069.    client to the server. Clients should support both the four-way and 
  2070.    the five-way handshake. The server indicates which type it requires 
  2071.    via the "Selected Version" field described below. 
  2072.    
  2073. 15.1 Token 1 (negotiation, client-to-server) 
  2074.    
  2075.        Token Length
  2076.        Mechanism Type
  2077.        Earliest Version
  2078.        Latest Version
  2079.        Flags
  2080.    
  2081. 15.2 Token 2 (challenge, server-to-client) 
  2082.    
  2083.        Token Length
  2084.        Mechanism Type
  2085.        Selected Version
  2086.  
  2087.  
  2088. Brown                                                          [Page 36]
  2089.  
  2090. Internet Draft      Remote Passphrase Authentication         19 May 1997
  2091.  
  2092.  
  2093.        Service Challenge
  2094.        Timestamp
  2095.        Realm List
  2096.    
  2097. 15.3 Token 3 (authentication, client-to-server) 
  2098.    
  2099.        Token Length
  2100.        Mechanism Type
  2101.        Identity
  2102.        User Challenge
  2103.        User Response
  2104.    
  2105. 15.4 Token 4 (authentication, server-to-client) 
  2106.    
  2107.        Token Length
  2108.        Mechanism Type
  2109.        User Authentication
  2110.        Obscured Session-Key
  2111.        Status
  2112.    
  2113.    Note: If the Status field is non-zero, indicating an authentication 
  2114.    error, the User Authentication and Obscured Session Key values should 
  2115.    be ignored; although, the values must still be legal values (that is, 
  2116.    the field lengths should be valid). 
  2117.    
  2118. 15.5 Token 5 (hack, client-to-server) 
  2119.    
  2120.        Token Length
  2121.        Dummy Byte
  2122.    
  2123. 15.6 Field descriptions 
  2124.    
  2125.    Dummy Byte: A single octet with the value 0. 
  2126.    
  2127.    Earliest Version: Two binary octets indicating the earliest version 
  2128.    of the RPA protocol that the client-side implementation of the 
  2129.    mechanism supports. First octet is major version; second octet is 
  2130.    minor version. The client should indicate that it supports version 
  2131.    1.0. 
  2132.    
  2133.    Flags: Two binary octets, in network (big-endian) byte order, 
  2134.    consisting of bit flags. In versions 1.0 and 2.0, bit 0 indicates 
  2135.    that mutual authentication is requested. Mutual authentication should 
  2136.    always be selected. In version 3.0 of the protocol, there are no 
  2137.    flags defined because Token 4 is always returned from the server to 
  2138.    the client (that is, mutual authentication is always selected). 
  2139.    
  2140.    Note: Bit 0 is the low-order bit of the second octet. 
  2141.    
  2142.    Identity: The selected user identity, in the form "name@realm," 
  2143.    preceded by two binary octets, in network (big-endian) byte order, 
  2144.  
  2145.  
  2146. Brown                                                          [Page 37]
  2147.  
  2148. Internet Draft      Remote Passphrase Authentication         19 May 1997
  2149.  
  2150.  
  2151.    representing the length of the identity string (in characters, not 
  2152.    octets). The identity is encoded using the ISO-8859-1 character set. 
  2153.    
  2154.    Latest Version: Two binary octets indicating the latest version of 
  2155.    the RPA protocol that the client supports. First octet is major 
  2156.    version; second octet is minor version. The client should indicate 
  2157.    that it supports version 3.0. 
  2158.    
  2159.    Mechanism Type: An OID (object identifier) specifying the RPA SSPI 
  2160.    scheme. The value is the following sequence of bytes 0x06, 0x09, 
  2161.    0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x73, 0x01, 0x01. 
  2162.    
  2163.    Obscured Session-Key: The session-key, generated and obscured by the 
  2164.    deity, encoded as length plus binary value as described above. 
  2165.    
  2166.    Realm List: The list of realms in which the service can accept 
  2167.    identities, along with the service name for each realm. Each realm is 
  2168.    separated by a single space character; the entire string is preceded 
  2169.    by two binary octets, in network (big-endian) byte order, 
  2170.    representing the length of the realm list string (in characters, not 
  2171.    octets): 
  2172.    
  2173.        "foo@compuserve.com bar@aol.com" 
  2174.    
  2175.    The realm name begins with the first character to the right of the 
  2176.    rightmost '@' character; realm names cannot contain '@' characters. 
  2177.    The realm list is encoded using the ISO-8859-1 character set. 
  2178.    
  2179.    Selected Version: Two binary octets indicating the version of RPA the 
  2180.    server-side implementation of the mechanism has elected to use. It 
  2181.    must be no earlier than "earliest version" and no later than "latest 
  2182.    version" as specified in Token 1. If the server indicates version 1.0 
  2183.    or version 3.0, then the client MUST perform the five-way handshake. 
  2184.    If version 2.0 is specified, the client should perform the 4-way 
  2185.    handshake. Version 3.0 indicates that Token 4 contains the Status 
  2186.    field that is used to report certain errors from the server to the 
  2187.    client. Previous versions do not contain the Status field. 
  2188.    
  2189.    Service Challenge: The service's random challenge, consisting of a 
  2190.    one octet length field followed by the specified number of octets 
  2191.    containing the challenge. This is raw, binary data, where any bit 
  2192.    patterns are allowed. 
  2193.    
  2194.    Status: A single octet indicating the status of the authentication 
  2195.    attempt. A non-zero value indicates there was an error authenticating 
  2196.    the user. The following status codes are defined for version 3.0 of 
  2197.    the protocol: 
  2198.    
  2199.        0 Success
  2200.        1 Restricted user (something wrong with user's account)
  2201.        2 Invalid user ID or passphrase
  2202.  
  2203.  
  2204. Brown                                                          [Page 38]
  2205.  
  2206. Internet Draft      Remote Passphrase Authentication         19 May 1997
  2207.  
  2208.  
  2209.        3 Deity error
  2210.    
  2211.    Timestamp: The service's timestamp encoded using the ISO 646 (ASCII) 
  2212.    textual representation of the current universal time (UTC) in exactly 
  2213.    14 octets, using 24-hour time with leading zeroes, e.g. 
  2214.    19950805011344. 
  2215.    
  2216.    Token Length: To conform to the GSS-API standard for token formats, 
  2217.    the token is encapsulated in an ASN.1 SEQUENCE that includes its 
  2218.    length. This consists of one octet containing the value 0x60, an 
  2219.    ASN.1 SEQUENCE, followed by the length of the token, indicating the 
  2220.    number of octets following the length field. This length is ASN.1 DER 
  2221.    encoded: if the length is less than 128 octets, it consists of a 
  2222.    single octet containing the length. Otherwise, the length is 
  2223.    represented using the minimum number of octets required, in network 
  2224.    (big-endian) byte order, preceded by an octet whose MSB is set and 
  2225.    whose remaining bits indicate the number of octets in the length. 
  2226.    
  2227.    For example, if there are 126 octets, the length is one octet with a 
  2228.    value of 0x7E (126 decimal). If there are 150 octets, the length is 
  2229.    two octets: 0x81 0x96. If there are 258 octets, the length is three 
  2230.    octets: 0x82 0x01 0x02. 
  2231.    
  2232.    User Authentication: The deity's response to the user, encoded as 
  2233.    length plus binary value as described above. 
  2234.    
  2235.    User Challenge: The user's random challenge, consisting of a one 
  2236.    octet length field followed by the specified number of octets 
  2237.    containing the challenge. This is raw, binary data, where any bit 
  2238.    patterns are allowed. 
  2239.    
  2240.    User Response: The user's response, encoded as length plus binary 
  2241.    value as described above. 
  2242.    
  2243.  
  2244. 16 Sample conversation 
  2245.    
  2246.    RPA SSPI authentication can be used with the POP3 AUTH command to 
  2247.    perform authentication between a client and server. The following is 
  2248.    an example conversation between a client and server: 
  2249.    
  2250.    Server: listens at TCP port 110 
  2251.    
  2252.    Client: connects to port 110 
  2253.    
  2254.    Server: +OK <server message> 
  2255.    
  2256.    Client: AUTH RPA 
  2257.    
  2258.    Server: + 
  2259.    
  2260.  
  2261.  
  2262. Brown                                                          [Page 39]
  2263.  
  2264. Internet Draft      Remote Passphrase Authentication         19 May 1997
  2265.  
  2266.  
  2267.    The client and server communicate Base64-encoded tokens using one or 
  2268.    more of the following sequence, ending with the client: 
  2269.    
  2270.        a) Client: <Base64-encoded token> 
  2271.        b) Server: + <Base64-encoded token> 
  2272.    
  2273.    Server: +OK <server message> 
  2274.    
  2275.  
  2276. Security Considerations 
  2277.    
  2278.    This entire document is about security. 
  2279.    
  2280.  
  2281. Author's Address 
  2282.    
  2283.    Gary S. Brown
  2284.    CompuServe Incorporated
  2285.    5000 Arlington Centre Blvd
  2286.    Columbus OH 43220
  2287.    USA
  2288.    
  2289.    <gsb@csi.compuserve.com>
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320. Brown                                                          [Page 40]
  2321.  
  2322.  
  2323.