src/HOL/Auth/Yahalom2.thy
author paulson
Tue Jul 01 17:38:49 1997 +0200 (1997-07-01)
changeset 3481 256f38c01b98
parent 3466 30791e5a69c4
child 3519 ab0a9fbed4c0
permissions -rw-r--r--
Deleted a redundant A~=B in rules that refer to a previous event
paulson@3445
     1
(*  Title:      HOL/Auth/Yahalom2
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@3432
     9
Also in YM3, care is taken to make the two certificates distinct.
paulson@2111
    10
paulson@2111
    11
From page 259 of
paulson@2111
    12
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@2111
    13
  Proc. Royal Soc. 426 (1989)
paulson@2111
    14
*)
paulson@2111
    15
paulson@2111
    16
Yahalom2 = Shared + 
paulson@2111
    17
paulson@2378
    18
consts  yahalom   :: agent set => event list set
paulson@2111
    19
inductive "yahalom lost"
paulson@2111
    20
  intrs 
paulson@2111
    21
         (*Initial trace is empty*)
paulson@2111
    22
    Nil  "[]: yahalom lost"
paulson@2111
    23
paulson@2111
    24
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@2111
    25
           invent new nonces here, but he can also use NS1.  Common to
paulson@2111
    26
           all similar protocols.*)
paulson@2111
    27
    Fake "[| evs: yahalom lost;  B ~= Spy;  
paulson@2111
    28
             X: synth (analz (sees lost Spy evs)) |]
paulson@2111
    29
          ==> Says Spy B X  # evs : yahalom lost"
paulson@2111
    30
paulson@2111
    31
         (*Alice initiates a protocol run*)
paulson@2516
    32
    YM1  "[| evs: yahalom lost;  A ~= B;  Nonce NA ~: used evs |]
paulson@2516
    33
          ==> Says A B {|Agent A, Nonce NA|} # evs : yahalom lost"
paulson@2111
    34
paulson@2111
    35
         (*Bob's response to Alice's message.  Bob doesn't know who 
paulson@2111
    36
	   the sender is, hence the A' in the sender field.*)
paulson@2516
    37
    YM2  "[| evs: yahalom lost;  B ~= Server;  Nonce NB ~: used evs;
nipkow@3465
    38
             Says A' B {|Agent A, Nonce NA|} : set evs |]
paulson@3432
    39
          ==> Says B Server 
paulson@3432
    40
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@3432
    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@3432
    45
           !! Fields are reversed in the 2nd packet to prevent attacks!! *)
paulson@2516
    46
    YM3  "[| evs: yahalom lost;  A ~= B;  A ~= Server;  Key KAB ~: used evs;
paulson@3432
    47
             Says B' Server {|Agent B, Nonce NB,
paulson@3432
    48
			      Crypt (shrK B) {|Agent A, Nonce NA|}|}
nipkow@3465
    49
               : set evs |]
paulson@2111
    50
          ==> Says Server A
paulson@2111
    51
               {|Nonce NB, 
paulson@2516
    52
                 Crypt (shrK A) {|Agent B, Key KAB, Nonce NA|},
paulson@2516
    53
                 Crypt (shrK B) {|Nonce NB, Key KAB, Agent A|}|}
paulson@2111
    54
                 # evs : yahalom lost"
paulson@2111
    55
paulson@2111
    56
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@2111
    57
           uses the new session key to send Bob his Nonce.*)
paulson@3481
    58
    YM4  "[| evs: yahalom lost;  A ~= Server;  
paulson@2284
    59
             Says S A {|Nonce NB, Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
paulson@3466
    60
                        X|}  : set evs;
nipkow@3465
    61
             Says A B {|Agent A, Nonce NA|} : set evs |]
paulson@2284
    62
          ==> Says A B {|X, Crypt K (Nonce NB)|} # 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@2284
    69
                             Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
nipkow@3465
    70
                             X|}  : set evs |]
paulson@2155
    71
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evs : yahalom lost"
paulson@2111
    72
paulson@2111
    73
end