src/HOL/Auth/OtwayRees.thy
author paulson
Tue Sep 08 15:17:11 1998 +0200 (1998-09-08)
changeset 5434 9b4bed3f394c
parent 5359 bd539b72d484
child 6308 76f3865a2b1d
permissions -rw-r--r--
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson@1941
     1
(*  Title:      HOL/Auth/OtwayRees
paulson@1941
     2
    ID:         $Id$
paulson@1941
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1941
     4
    Copyright   1996  University of Cambridge
paulson@1941
     5
paulson@1941
     6
Inductive relation "otway" for the Otway-Rees protocol.
paulson@1941
     7
paulson@2014
     8
Version that encrypts Nonce NB
paulson@2014
     9
paulson@1941
    10
From page 244 of
paulson@1941
    11
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@1941
    12
  Proc. Royal Soc. 426 (1989)
paulson@1941
    13
*)
paulson@1941
    14
paulson@1941
    15
OtwayRees = Shared + 
paulson@1941
    16
paulson@3519
    17
consts  otway   :: event list set
paulson@3519
    18
inductive "otway"
paulson@1941
    19
  intrs 
paulson@1941
    20
         (*Initial trace is empty*)
paulson@3519
    21
    Nil  "[]: otway"
paulson@1941
    22
paulson@5434
    23
         (** These rules allow agents to send messages to themselves **)
paulson@5434
    24
paulson@2032
    25
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@1941
    26
           invent new nonces here, but he can also use NS1.  Common to
paulson@1941
    27
           all similar protocols.*)
paulson@5434
    28
    Fake "[| evs: otway;  X: synth (analz (spies evs)) |]
paulson@3519
    29
          ==> Says Spy B X  # evs : otway"
paulson@1941
    30
paulson@1941
    31
         (*Alice initiates a protocol run*)
paulson@5434
    32
    OR1  "[| evs1: otway;  Nonce NA ~: used evs1 |]
paulson@2516
    33
          ==> Says A B {|Nonce NA, Agent A, Agent B, 
paulson@2516
    34
                         Crypt (shrK A) {|Nonce NA, Agent A, Agent B|} |} 
paulson@3659
    35
                 # evs1 : otway"
paulson@1941
    36
paulson@1941
    37
         (*Bob's response to Alice's message.  Bob doesn't know who 
paulson@1941
    38
	   the sender is, hence the A' in the sender field.
paulson@2105
    39
           Note that NB is encrypted.*)
paulson@5434
    40
    OR2  "[| evs2: otway;  Nonce NB ~: used evs2;
paulson@3659
    41
             Says A' B {|Nonce NA, Agent A, Agent B, X|} : set evs2 |]
paulson@1976
    42
          ==> Says B Server 
paulson@2014
    43
                  {|Nonce NA, Agent A, Agent B, X, 
paulson@2451
    44
                    Crypt (shrK B)
paulson@2516
    45
                      {|Nonce NA, Nonce NB, Agent A, Agent B|}|}
paulson@3659
    46
                 # evs2 : otway"
paulson@1941
    47
paulson@1941
    48
         (*The Server receives Bob's message and checks that the three NAs
paulson@1941
    49
           match.  Then he sends a new session key to Bob with a packet for
paulson@1941
    50
           forwarding to Alice.*)
paulson@5434
    51
    OR3  "[| evs3: otway;  Key KAB ~: used evs3;
paulson@1941
    52
             Says B' Server 
paulson@1941
    53
                  {|Nonce NA, Agent A, Agent B, 
paulson@2284
    54
                    Crypt (shrK A) {|Nonce NA, Agent A, Agent B|}, 
paulson@2284
    55
                    Crypt (shrK B) {|Nonce NA, Nonce NB, Agent A, Agent B|}|}
paulson@3659
    56
               : set evs3 |]
paulson@1976
    57
          ==> Says Server B 
paulson@1941
    58
                  {|Nonce NA, 
paulson@2516
    59
                    Crypt (shrK A) {|Nonce NA, Key KAB|},
paulson@2516
    60
                    Crypt (shrK B) {|Nonce NB, Key KAB|}|}
paulson@3659
    61
                 # evs3 : otway"
paulson@1941
    62
paulson@1941
    63
         (*Bob receives the Server's (?) message and compares the Nonces with
paulson@5434
    64
	   those in the message he previously sent the Server.
paulson@5434
    65
           Need B ~= Server because we allow messages to self.*)
paulson@5434
    66
    OR4  "[| evs4: otway;  B ~= Server;
paulson@2014
    67
             Says B Server {|Nonce NA, Agent A, Agent B, X', 
paulson@2284
    68
                             Crypt (shrK B)
paulson@2284
    69
                                   {|Nonce NA, Nonce NB, Agent A, Agent B|}|}
paulson@3659
    70
               : set evs4;
paulson@2837
    71
             Says S' B {|Nonce NA, X, Crypt (shrK B) {|Nonce NB, Key K|}|}
paulson@3659
    72
               : set evs4 |]
paulson@3659
    73
          ==> Says B A {|Nonce NA, X|} # evs4 : otway"
paulson@1941
    74
paulson@2135
    75
         (*This message models possible leaks of session keys.  The nonces
paulson@2135
    76
           identify the protocol run.*)
paulson@5359
    77
    Oops "[| evso: otway;  
paulson@2284
    78
             Says Server B {|Nonce NA, X, Crypt (shrK B) {|Nonce NB, Key K|}|}
paulson@3659
    79
               : set evso |]
paulson@4537
    80
          ==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso : otway"
paulson@1941
    81
paulson@1941
    82
end