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