src/HOL/Auth/Yahalom2.thy
author paulson
Thu Sep 23 13:06:31 1999 +0200 (1999-09-23)
changeset 7584 5be4bb8e4e3f
parent 6335 7e4bffaa2a3e
child 11185 1b737b4c2108
permissions -rw-r--r--
tidied; added lemma restrict_to_left
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@6335
    27
    Fake "[| evs: yahalom;  X: synth (analz (knows Spy evs)) |]
paulson@3519
    28
          ==> Says Spy B X  # evs : yahalom"
paulson@2111
    29
paulson@6335
    30
         (*A message that has been sent can be received by the
paulson@6335
    31
           intended recipient.*)
paulson@6335
    32
    Reception "[| evsr: yahalom;  Says A B X : set evsr |]
paulson@6335
    33
               ==> Gets B X # evsr : yahalom"
paulson@6335
    34
paulson@2111
    35
         (*Alice initiates a protocol run*)
paulson@5434
    36
    YM1  "[| evs1: yahalom;  Nonce NA ~: used evs1 |]
paulson@3659
    37
          ==> Says A B {|Agent A, Nonce NA|} # evs1 : yahalom"
paulson@2111
    38
paulson@6335
    39
         (*Bob's response to Alice's message.*)
paulson@5434
    40
    YM2  "[| evs2: yahalom;  Nonce NB ~: used evs2;
paulson@6335
    41
             Gets B {|Agent A, Nonce NA|} : set evs2 |]
paulson@3432
    42
          ==> Says B Server 
paulson@3432
    43
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@3659
    44
                # evs2 : yahalom"
paulson@2111
    45
paulson@2111
    46
         (*The Server receives Bob's message.  He responds by sending a
paulson@3659
    47
           new session key to Alice, with a certificate for forwarding to Bob.
paulson@5066
    48
           Both agents are quoted in the 2nd certificate to prevent attacks!*)
paulson@5434
    49
    YM3  "[| evs3: yahalom;  Key KAB ~: used evs3;
paulson@6335
    50
             Gets Server {|Agent B, Nonce NB,
paulson@6335
    51
			   Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@3659
    52
               : set evs3 |]
paulson@2111
    53
          ==> Says Server A
paulson@2111
    54
               {|Nonce NB, 
paulson@2516
    55
                 Crypt (shrK A) {|Agent B, Key KAB, Nonce NA|},
paulson@5066
    56
                 Crypt (shrK B) {|Agent A, Agent B, Key KAB, Nonce NB|}|}
paulson@3659
    57
                 # evs3 : yahalom"
paulson@2111
    58
paulson@2111
    59
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@2111
    60
           uses the new session key to send Bob his Nonce.*)
paulson@5434
    61
    YM4  "[| evs4: yahalom;  
paulson@6335
    62
             Gets A {|Nonce NB, Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
paulson@6335
    63
                      X|}  : set evs4;
paulson@3659
    64
             Says A B {|Agent A, Nonce NA|} : set evs4 |]
paulson@3659
    65
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 : yahalom"
paulson@2111
    66
paulson@2155
    67
         (*This message models possible leaks of session keys.  The nonces
paulson@2155
    68
           identify the protocol run.  Quoting Server here ensures they are
paulson@2155
    69
           correct. *)
paulson@5359
    70
    Oops "[| evso: yahalom;  
paulson@2155
    71
             Says Server A {|Nonce NB, 
paulson@2284
    72
                             Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
paulson@3659
    73
                             X|}  : set evso |]
paulson@4537
    74
          ==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso : yahalom"
paulson@2111
    75
paulson@2111
    76
end