src/HOL/Auth/Yahalom2.thy
author paulson
Tue Sep 08 15:17:11 1998 +0200 (1998-09-08)
changeset 5434 9b4bed3f394c
parent 5359 bd539b72d484
child 6335 7e4bffaa2a3e
permissions -rw-r--r--
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
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@3519
    18
consts  yahalom   :: event list set
paulson@3519
    19
inductive "yahalom"
paulson@2111
    20
  intrs 
paulson@2111
    21
         (*Initial trace is empty*)
paulson@3519
    22
    Nil  "[]: yahalom"
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@5434
    27
    Fake "[| evs: yahalom;  X: synth (analz (spies evs)) |]
paulson@3519
    28
          ==> Says Spy B X  # evs : yahalom"
paulson@2111
    29
paulson@2111
    30
         (*Alice initiates a protocol run*)
paulson@5434
    31
    YM1  "[| evs1: yahalom;  Nonce NA ~: used evs1 |]
paulson@3659
    32
          ==> Says A B {|Agent A, Nonce NA|} # evs1 : yahalom"
paulson@2111
    33
paulson@2111
    34
         (*Bob's response to Alice's message.  Bob doesn't know who 
paulson@2111
    35
	   the sender is, hence the A' in the sender field.*)
paulson@5434
    36
    YM2  "[| evs2: yahalom;  Nonce NB ~: used evs2;
paulson@3659
    37
             Says A' B {|Agent A, Nonce NA|} : set evs2 |]
paulson@3432
    38
          ==> Says B Server 
paulson@3432
    39
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@3659
    40
                # evs2 : yahalom"
paulson@2111
    41
paulson@2111
    42
         (*The Server receives Bob's message.  He responds by sending a
paulson@3659
    43
           new session key to Alice, with a certificate for forwarding to Bob.
paulson@5066
    44
           Both agents are quoted in the 2nd certificate to prevent attacks!*)
paulson@5434
    45
    YM3  "[| evs3: yahalom;  Key KAB ~: used evs3;
paulson@3432
    46
             Says B' Server {|Agent B, Nonce NB,
paulson@3432
    47
			      Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@3659
    48
               : set evs3 |]
paulson@2111
    49
          ==> Says Server A
paulson@2111
    50
               {|Nonce NB, 
paulson@2516
    51
                 Crypt (shrK A) {|Agent B, Key KAB, Nonce NA|},
paulson@5066
    52
                 Crypt (shrK B) {|Agent A, Agent B, Key KAB, Nonce NB|}|}
paulson@3659
    53
                 # evs3 : yahalom"
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@5434
    57
    YM4  "[| evs4: yahalom;  
paulson@2284
    58
             Says S A {|Nonce NB, Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
paulson@3659
    59
                        X|}  : set evs4;
paulson@3659
    60
             Says A B {|Agent A, Nonce NA|} : set evs4 |]
paulson@3659
    61
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 : yahalom"
paulson@2111
    62
paulson@2155
    63
         (*This message models possible leaks of session keys.  The nonces
paulson@2155
    64
           identify the protocol run.  Quoting Server here ensures they are
paulson@2155
    65
           correct. *)
paulson@5359
    66
    Oops "[| evso: yahalom;  
paulson@2155
    67
             Says Server A {|Nonce NB, 
paulson@2284
    68
                             Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
paulson@3659
    69
                             X|}  : set evso |]
paulson@4537
    70
          ==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso : yahalom"
paulson@2111
    71
paulson@2111
    72
end