src/HOL/Auth/NS_Shared.thy
author paulson
Mon, 23 Sep 1996 17:41:57 +0200
changeset 2002 ed423882c6a9
parent 1997 6efba890341e
child 2032 1bbf1bdcaf56
permissions -rw-r--r--
Bad version of Otway-Rees and the new attack on it
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/NS_Shared
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     2
    ID:         $Id$
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     5
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     6
Inductive relation "ns_shared" for Needham-Schroeder Shared-Key protocol.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     7
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     8
From page 247 of
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    10
  Proc. Royal Soc. 426 (1989)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    11
*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    12
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    13
NS_Shared = Shared + 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    14
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    15
consts  ns_shared   :: "event list set"
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    16
inductive ns_shared
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    17
  intrs 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    18
         (*Initial trace is empty*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    19
    Nil  "[]: ns_shared"
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    20
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    21
         (*The enemy MAY say anything he CAN say.  We do not expect him to
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    22
           invent new nonces here, but he can also use NS1.  Common to
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    23
           all similar protocols.*)
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    24
    Fake "[| evs: ns_shared;  B ~= Enemy;  X: synth (analz (sees Enemy evs)) |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    25
          ==> Says Enemy B X # evs : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    26
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    27
         (*Alice initiates a protocol run, requesting to talk to any B*)
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    28
    NS1  "[| evs: ns_shared;  A ~= Server |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    29
          ==> Says A Server {|Agent A, Agent B, Nonce (newN evs)|} # evs
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    30
                 : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    31
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    32
         (*Server's response to Alice's message.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    33
           !! It may respond more than once to A's request !!
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    34
	   Server doesn't know who the true sender is, hence the A' in
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    35
               the sender field.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    36
    NS2  "[| evs: ns_shared;  A ~= B;  A ~= Server;
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    37
             Says A' Server {|Agent A, Agent B, Nonce NA|} : set_of_list evs |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    38
          ==> Says Server A 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    39
                  (Crypt {|Nonce NA, Agent B, Key (newK evs),   
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    40
                           (Crypt {|Key (newK evs), Agent A|} (shrK B))|}
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    41
                   (shrK A)) # evs : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    42
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
          (*We can't assume S=Server.  Agent A "remembers" her nonce.
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1976
diff changeset
    44
            Can inductively show A ~= Server*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    45
    NS3  "[| evs: ns_shared;  A ~= B;
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    46
             Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A)) 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    47
               : set_of_list evs;
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    48
             Says A Server {|Agent A, Agent B, Nonce NA|} : set_of_list evs |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    49
          ==> Says A B X # evs : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    50
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    51
         (*Bob's nonce exchange.  He does not know who the message came
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    52
           from, but responds to A because she is mentioned inside.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    53
    NS4  "[| evs: ns_shared;  A ~= B;  
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    54
             Says A' B (Crypt {|Key K, Agent A|} (shrK B)) : set_of_list evs |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    55
          ==> Says B A (Crypt (Nonce (newN evs)) K) # evs : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    56
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    57
         (*Alice responds with the Nonce, if she has seen the key before.
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    58
           We do NOT use N-1 or similar as the Enemy cannot spoof such things.
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    59
           Allowing the Enemy to add or subtract 1 allows him to send ALL
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    60
               nonces.  Instead we distinguish the messages by sending the
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    61
               nonce twice.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    62
    NS5  "[| evs: ns_shared;  A ~= B;  
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    63
             Says B' A (Crypt (Nonce N) K) : set_of_list evs;
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    64
             Says S  A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A))
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    65
               : set_of_list evs |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    66
          ==> Says A B (Crypt {|Nonce N, Nonce N|} K) # evs : ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    67
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    68
end