src/HOL/Auth/Recur.thy
author paulson
Fri, 17 Jan 1997 12:49:31 +0100
changeset 2516 4d68fbe6378b
parent 2485 c4368c967c56
child 2532 cde25bf71cc1
permissions -rw-r--r--
Now with Andy Gordon's treatment of freshness to replace newN/K
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Recur
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     5
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     6
Inductive relation "recur" for the Recursive Authentication protocol.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     7
*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     8
2485
c4368c967c56 Simplification of some proofs, especially by eliminating
paulson
parents: 2481
diff changeset
     9
Recur = Shared +
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    10
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    11
(*Two session keys are distributed to each agent except for the initiator,
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    12
        who receives one.
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    13
  Perhaps the two session keys could be bundled into a single message.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    14
*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    15
consts     respond :: "event list => (msg*msg*key)set"
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    16
inductive "respond evs" (*Server's response to the nested message*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    17
  intrs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    18
    (*The message "Agent Server" marks the end of a list.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    19
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    20
    One  "[| A ~= Server;  Key KAB ~: used evs |]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    21
          ==> (Hash[Key(shrK A)] 
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    22
                        {|Agent A, Agent B, Nonce NA, Agent Server|}, 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    23
               {|Crypt (shrK A) {|Key KAB, Agent B, Nonce NA|}, Agent Server|},
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    24
               KAB)   : respond evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    25
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    26
    (*newK2(i,Suc j) is the key for A & B; newK2(i,j) is the key for B & C*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    27
    Cons "[| (PA, RA, KAB) : respond evs;  
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    28
             Key KBC ~: used evs;  Key KBC ~: parts {RA};
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    29
             PA = Hash[Key(shrK A)] {|Agent A, Agent B, Nonce NA, P|};
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    30
             B ~= Server |]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    31
          ==> (Hash[Key(shrK B)] {|Agent B, Agent C, Nonce NB, PA|}, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    32
               {|Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|},
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    33
                 Crypt (shrK B) {|Key KBC, Agent C, Nonce NB|}, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    34
                 RA|},
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    35
               KBC)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    36
              : respond evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    37
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    38
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    39
(*Induction over "respond" can be difficult due to the complexity of the
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    40
  subgoals.  The "responses" relation formalizes the general form of its
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    41
  third component.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    42
*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    43
consts     responses :: event list => msg set
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    44
inductive "responses evs"       
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    45
  intrs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    46
    (*Server terminates lists*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    47
    Nil  "Agent Server : responses evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    48
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    49
    Cons "[| RA : responses evs;  Key KAB ~: used evs |]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    50
          ==> {|Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|},
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    51
                RA|}  : responses evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    52
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    53
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    54
consts     recur   :: agent set => event list set
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    55
inductive "recur lost"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    56
  intrs 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    57
         (*Initial trace is empty*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    58
    Nil  "[]: recur lost"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    59
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    60
         (*The spy MAY say anything he CAN say.  We do not expect him to
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    61
           invent new nonces here, but he can also use NS1.  Common to
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    62
           all similar protocols.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    63
    Fake "[| evs: recur lost;  B ~= Spy;  
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    64
             X: synth (analz (sees lost Spy evs)) |]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    65
          ==> Says Spy B X  # evs : recur lost"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    66
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    67
         (*Alice initiates a protocol run.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    68
           "Agent Server" is just a placeholder, to terminate the nesting.*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    69
    RA1  "[| evs: recur lost;  A ~= B;  A ~= Server;  Nonce NA ~: used evs |]
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    70
          ==> Says A B 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    71
                (Hash[Key(shrK A)] 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    72
                 {|Agent A, Agent B, Nonce NA, Agent Server|})
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    73
              # evs : recur lost"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    74
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    75
         (*Bob's response to Alice's message.  C might be the Server.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    76
           XA should be the Hash of the remaining components with KA, but
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    77
                Bob cannot check that.
2485
c4368c967c56 Simplification of some proofs, especially by eliminating
paulson
parents: 2481
diff changeset
    78
           P is the previous recur message from Alice's caller.
c4368c967c56 Simplification of some proofs, especially by eliminating
paulson
parents: 2481
diff changeset
    79
           NOTE: existing proofs don't need PA and are complicated by its
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    80
                presence!  See parts_Fake_tac.*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    81
    RA2  "[| evs: recur lost;  B ~= C;  B ~= Server;  Nonce NB ~: used evs;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    82
             Says A' B PA : set_of_list evs;  
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    83
             PA = {|XA, Agent A, Agent B, Nonce NA, P|} |]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    84
          ==> Says B C (Hash[Key(shrK B)] {|Agent B, Agent C, Nonce NB, PA|})
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    85
              # evs : recur lost"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    86
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    87
         (*The Server receives and decodes Bob's message.  Then he generates
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    88
           a new session key and a response.*)
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    89
    RA3  "[| evs: recur lost;  B ~= Server;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    90
             Says B' Server PB : set_of_list evs;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    91
             (PB,RB,K) : respond evs |]
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    92
          ==> Says Server B RB # evs : recur lost"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    93
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    94
         (*Bob receives the returned message and compares the Nonces with
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    95
           those in the message he previously sent the Server.*)
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    96
    RA4  "[| evs: recur lost;  A ~= B;  
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    97
             Says C' B {|Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|}, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    98
                         Crypt (shrK B) {|Key KBC, Agent C, Nonce NB|}, RA|}
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    99
               : set_of_list evs;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   100
             Says B  C {|XH, Agent B, Agent C, Nonce NB, 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   101
                         XA, Agent A, Agent B, Nonce NA, P|} 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   102
               : set_of_list evs |]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   103
          ==> Says B A RA # evs : recur lost"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   104
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   105
(**No "oops" message can readily be expressed, since each session key is
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   106
   associated--in two separate messages--with two nonces.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   107
***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   108
end