src/HOL/Auth/Yahalom2.thy
author paulson
Fri Nov 01 18:28:19 1996 +0100 (1996-11-01)
changeset 2155 dc85854810eb
parent 2111 81c8d46edfa3
child 2284 80ebd1a213fd
permissions -rw-r--r--
New version with simpler disambiguation in YM3,
Oops message, and no encryption in YM2
paulson@2111
     1
(*  Title:      HOL/Auth/Yahalom
paulson@2111
     2
    ID:         $Id$
paulson@2111
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2111
     4
    Copyright   1996  University of Cambridge
paulson@2111
     5
paulson@2111
     6
Inductive relation "yahalom" for the Yahalom protocol, Variant 2.
paulson@2111
     7
paulson@2111
     8
This version trades encryption of NB for additional explicitness in YM3.
paulson@2155
     9
It also omits encryption in YM2.  The resulting protocol no longer guarantees
paulson@2155
    10
that the other agent is present.
paulson@2111
    11
paulson@2111
    12
From page 259 of
paulson@2111
    13
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@2111
    14
  Proc. Royal Soc. 426 (1989)
paulson@2111
    15
*)
paulson@2111
    16
paulson@2111
    17
Yahalom2 = Shared + 
paulson@2111
    18
paulson@2111
    19
consts  yahalom   :: "agent set => event list set"
paulson@2111
    20
inductive "yahalom lost"
paulson@2111
    21
  intrs 
paulson@2111
    22
         (*Initial trace is empty*)
paulson@2111
    23
    Nil  "[]: yahalom lost"
paulson@2111
    24
paulson@2111
    25
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@2111
    26
           invent new nonces here, but he can also use NS1.  Common to
paulson@2111
    27
           all similar protocols.*)
paulson@2111
    28
    Fake "[| evs: yahalom lost;  B ~= Spy;  
paulson@2111
    29
             X: synth (analz (sees lost Spy evs)) |]
paulson@2111
    30
          ==> Says Spy B X  # evs : yahalom lost"
paulson@2111
    31
paulson@2111
    32
         (*Alice initiates a protocol run*)
paulson@2111
    33
    YM1  "[| evs: yahalom lost;  A ~= B |]
paulson@2111
    34
          ==> Says A B {|Agent A, Nonce (newN evs)|} # evs : yahalom lost"
paulson@2111
    35
paulson@2111
    36
         (*Bob's response to Alice's message.  Bob doesn't know who 
paulson@2111
    37
	   the sender is, hence the A' in the sender field.*)
paulson@2111
    38
    YM2  "[| evs: yahalom lost;  B ~= Server;
paulson@2111
    39
             Says A' B {|Agent A, Nonce NA|} : set_of_list evs |]
paulson@2155
    40
          ==> Says B Server {|Agent A, Agent B, Nonce NA, Nonce (newN evs)|}
paulson@2111
    41
                 # evs : yahalom lost"
paulson@2111
    42
paulson@2111
    43
         (*The Server receives Bob's message.  He responds by sending a
paulson@2155
    44
           new session key to Alice, with a packet for forwarding to Bob.
paulson@2155
    45
           Fields are reversed in the 2nd packet to prevent attacks.*)
paulson@2155
    46
    YM3  "[| evs: yahalom lost;  A ~= B;  A ~= Server;
paulson@2155
    47
             Says B' Server {|Agent A, Agent B, Nonce NA, Nonce NB|}
paulson@2111
    48
               : set_of_list evs |]
paulson@2111
    49
          ==> Says Server A
paulson@2111
    50
               {|Nonce NB, 
paulson@2111
    51
                 Crypt {|Agent B, Key (newK evs), Nonce NA|} (shrK A),
paulson@2155
    52
                 Crypt {|Nonce NB, Key (newK evs), Agent A|} (shrK B)|}
paulson@2111
    53
                 # evs : yahalom lost"
paulson@2111
    54
paulson@2111
    55
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@2111
    56
           uses the new session key to send Bob his Nonce.*)
paulson@2155
    57
    YM4  "[| evs: yahalom lost;  A ~= Server;  A ~= B;  
paulson@2111
    58
             Says S A {|Nonce NB, Crypt {|Agent B, Key K, Nonce NA|} (shrK A),
paulson@2111
    59
                        X|}
paulson@2111
    60
               : set_of_list evs;
paulson@2111
    61
             Says A B {|Agent A, Nonce NA|} : set_of_list evs |]
paulson@2111
    62
          ==> Says A B {|X, Crypt (Nonce NB) K|} # evs : yahalom lost"
paulson@2111
    63
paulson@2155
    64
         (*This message models possible leaks of session keys.  The nonces
paulson@2155
    65
           identify the protocol run.  Quoting Server here ensures they are
paulson@2155
    66
           correct. *)
paulson@2155
    67
    Oops "[| evs: yahalom lost;  A ~= Spy;
paulson@2155
    68
             Says Server A {|Nonce NB, 
paulson@2155
    69
                             Crypt {|Agent B, Key K, Nonce NA|} (shrK A),
paulson@2155
    70
                             X|}  : set_of_list evs |]
paulson@2155
    71
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evs : yahalom lost"
paulson@2111
    72
paulson@2111
    73
end