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