src/HOL/Auth/NS_Shared.thy
author paulson
Thu, 24 Oct 1996 10:30:43 +0200
changeset 2121 7e118eb32bdc
parent 2069 a1c623f70407
child 2131 3106a99d30a5
permissions -rw-r--r--
Removal of unused predicate isSpy
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
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    15
consts  ns_shared   :: "agent set => event list set"
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    16
inductive "ns_shared lost"
1934
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*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    19
    Nil  "[]: ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    20
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    21
         (*The spy MAY say anything he CAN say.  We do not expect him to
1934
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.*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    24
    Fake "[| evs: ns_shared lost;  B ~= Spy;  
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    25
             X: synth (analz (sees lost Spy evs)) |]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    26
          ==> Says Spy B X # evs : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    27
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    28
         (*Alice initiates a protocol run, requesting to talk to any B*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    29
    NS1  "[| evs: ns_shared lost;  A ~= Server |]
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    30
          ==> Says A Server {|Agent A, Agent B, Nonce (newN evs)|} # evs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    31
                 : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    32
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    33
         (*Server's response to Alice's message.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    34
           !! It may respond more than once to A's request !!
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    35
	   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
    36
               the sender field.*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    37
    NS2  "[| evs: ns_shared lost;  A ~= B;  A ~= Server;
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    38
             Says A' Server {|Agent A, Agent B, Nonce NA|} : set_of_list evs |]
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    39
          ==> Says Server A 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    40
                  (Crypt {|Nonce NA, Agent B, Key (newK evs),   
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    41
                           (Crypt {|Key (newK evs), Agent A|} (shrK B))|}
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    42
                   (shrK A)) # evs : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    44
          (*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
    45
            Can inductively show A ~= Server*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    46
    NS3  "[| evs: ns_shared lost;  A ~= B;
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    47
             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
    48
               : set_of_list evs;
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    49
             Says A Server {|Agent A, Agent B, Nonce NA|} : set_of_list evs |]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    50
          ==> Says A B X # evs : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    51
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    52
         (*Bob's nonce exchange.  He does not know who the message came
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    53
           from, but responds to A because she is mentioned inside.*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    54
    NS4  "[| evs: ns_shared lost;  A ~= B;  
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    55
             Says A' B (Crypt {|Key K, Agent A|} (shrK B)) : set_of_list evs |]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    56
          ==> Says B A (Crypt (Nonce (newN evs)) K) # evs : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    57
2069
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    58
         (*Alice responds with Nonce NB if she has seen the key before.
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    59
           Maybe should somehow check Nonce NA again.
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    60
           We do NOT send NB-1 or similar as the Spy cannot spoof such things.
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    61
           Letting the Spy add or subtract 1 lets him send ALL nonces.
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    62
           Instead we distinguish the messages by sending the nonce twice.*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 1997
diff changeset
    63
    NS5  "[| evs: ns_shared lost;  A ~= B;  
2069
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    64
             Says B' A (Crypt (Nonce NB) K) : set_of_list evs;
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    65
             Says S  A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A))
1976
1cff1f4fdb8a Reformatting
paulson
parents: 1965
diff changeset
    66
               : set_of_list evs |]
2069
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    67
          ==> Says A B (Crypt {|Nonce NB, Nonce NB|} K) # evs : ns_shared lost"
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    68
  
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    69
         (*This message models possible leaks of session keys.
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    70
           The two Nonces identify the protocol run.*)
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    71
    Revl "[| evs: ns_shared lost;  A ~= Spy;
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    72
             Says B' A (Crypt (Nonce NB) K) : set_of_list evs;
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    73
             Says S  A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A))
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    74
               : set_of_list evs |]
a1c623f70407 Addition of Revl rule, and tidying
paulson
parents: 2032
diff changeset
    75
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evs : ns_shared lost"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    76
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    77
end