src/HOL/Auth/Yahalom.thy
author paulson
Thu Sep 18 13:24:04 1997 +0200 (1997-09-18)
changeset 3683 aafe719dff14
parent 3659 eddedfe2f3f8
child 3961 6a8996fb7d99
permissions -rw-r--r--
Global change: lost->bad and sees Spy->spies
First change just gives a more sensible name.
Second change eliminates the agent parameter of "sees" to simplify
definitions and theorems
paulson@1995
     1
(*  Title:      HOL/Auth/Yahalom
paulson@1985
     2
    ID:         $Id$
paulson@1985
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1985
     4
    Copyright   1996  University of Cambridge
paulson@1985
     5
paulson@1985
     6
Inductive relation "yahalom" for the Yahalom protocol.
paulson@1985
     7
paulson@1985
     8
From page 257 of
paulson@1985
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@1985
    10
  Proc. Royal Soc. 426 (1989)
paulson@1985
    11
*)
paulson@1985
    12
paulson@1995
    13
Yahalom = Shared + 
paulson@1985
    14
paulson@3519
    15
consts  yahalom   :: event list set
paulson@3519
    16
inductive "yahalom"
paulson@1985
    17
  intrs 
paulson@1985
    18
         (*Initial trace is empty*)
paulson@3519
    19
    Nil  "[]: yahalom"
paulson@1985
    20
paulson@2032
    21
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@1985
    22
           invent new nonces here, but he can also use NS1.  Common to
paulson@1985
    23
           all similar protocols.*)
paulson@3519
    24
    Fake "[| evs: yahalom;  B ~= Spy;  
paulson@3683
    25
             X: synth (analz (spies evs)) |]
paulson@3519
    26
          ==> Says Spy B X  # evs : yahalom"
paulson@1985
    27
paulson@1985
    28
         (*Alice initiates a protocol run*)
paulson@3659
    29
    YM1  "[| evs1: yahalom;  A ~= B;  Nonce NA ~: used evs1 |]
paulson@3659
    30
          ==> Says A B {|Agent A, Nonce NA|} # evs1 : yahalom"
paulson@1985
    31
paulson@1985
    32
         (*Bob's response to Alice's message.  Bob doesn't know who 
paulson@1995
    33
	   the sender is, hence the A' in the sender field.*)
paulson@3659
    34
    YM2  "[| evs2: yahalom;  B ~= Server;  Nonce NB ~: used evs2;
paulson@3659
    35
             Says A' B {|Agent A, Nonce NA|} : set evs2 |]
paulson@1985
    36
          ==> Says B Server 
paulson@2516
    37
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@3659
    38
                # evs2 : yahalom"
paulson@1985
    39
paulson@1985
    40
         (*The Server receives Bob's message.  He responds by sending a
paulson@1985
    41
            new session key to Alice, with a packet for forwarding to Bob.*)
paulson@3659
    42
    YM3  "[| evs3: yahalom;  A ~= Server;  Key KAB ~: used evs3;
paulson@1985
    43
             Says B' Server 
paulson@2284
    44
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@3659
    45
               : set evs3 |]
paulson@1995
    46
          ==> Says Server A
paulson@3447
    47
                   {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
paulson@3447
    48
                     Crypt (shrK B) {|Agent A, Key KAB|}|}
paulson@3659
    49
                # evs3 : yahalom"
paulson@1985
    50
paulson@1995
    51
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@1995
    52
           uses the new session key to send Bob his Nonce.*)
paulson@3659
    53
    YM4  "[| evs4: yahalom;  A ~= Server;  
paulson@2284
    54
             Says S A {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@3659
    55
                        X|}  : set evs4;
paulson@3659
    56
             Says A B {|Agent A, Nonce NA|} : set evs4 |]
paulson@3659
    57
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 : yahalom"
paulson@1985
    58
paulson@2110
    59
         (*This message models possible leaks of session keys.  The Nonces
paulson@2156
    60
           identify the protocol run.  Quoting Server here ensures they are
paulson@2156
    61
           correct.*)
paulson@3659
    62
    Oops "[| evso: yahalom;  A ~= Spy;
paulson@2284
    63
             Says Server A {|Crypt (shrK A)
paulson@2284
    64
                                   {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@3659
    65
                             X|}  : set evso |]
paulson@3659
    66
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evso : yahalom"
paulson@2110
    67
paulson@3447
    68
paulson@3447
    69
constdefs 
paulson@3447
    70
  KeyWithNonce :: [key, nat, event list] => bool
paulson@3447
    71
  "KeyWithNonce K NB evs ==
paulson@3447
    72
     EX A B na X. 
paulson@3447
    73
       Says Server A {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|} 
nipkow@3465
    74
         : set evs"
paulson@3447
    75
paulson@1985
    76
end