src/HOL/Auth/Yahalom.thy
author paulson
Wed Jun 18 15:38:35 1997 +0200 (1997-06-18)
changeset 3447 c7c8c0db05b9
parent 2516 4d68fbe6378b
child 3465 e85c24717cad
permissions -rw-r--r--
Defines KeyWithNonce, which is used to prove the secrecy of NB
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@2378
    15
consts  yahalom   :: agent set => event list set
paulson@2032
    16
inductive "yahalom lost"
paulson@1985
    17
  intrs 
paulson@1985
    18
         (*Initial trace is empty*)
paulson@2032
    19
    Nil  "[]: yahalom lost"
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@2032
    24
    Fake "[| evs: yahalom lost;  B ~= Spy;  
paulson@2032
    25
             X: synth (analz (sees lost Spy evs)) |]
paulson@2032
    26
          ==> Says Spy B X  # evs : yahalom lost"
paulson@1985
    27
paulson@1985
    28
         (*Alice initiates a protocol run*)
paulson@2516
    29
    YM1  "[| evs: yahalom lost;  A ~= B;  Nonce NA ~: used evs |]
paulson@2516
    30
          ==> Says A B {|Agent A, Nonce NA|} # evs : yahalom lost"
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@2516
    34
    YM2  "[| evs: yahalom lost;  B ~= Server;  Nonce NB ~: used evs;
paulson@1995
    35
             Says A' B {|Agent A, Nonce NA|} : set_of_list evs |]
paulson@1985
    36
          ==> Says B Server 
paulson@2516
    37
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@2516
    38
                # evs : yahalom lost"
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@2516
    42
    YM3  "[| evs: yahalom lost;  A ~= Server;  Key KAB ~: used evs;
paulson@1985
    43
             Says B' Server 
paulson@2284
    44
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@1985
    45
               : set_of_list evs |]
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@3447
    49
                # evs : yahalom lost"
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@2125
    53
    YM4  "[| evs: yahalom lost;  A ~= Server;  A ~= B;  
paulson@2284
    54
             Says S A {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@2125
    55
                        X|}  : set_of_list evs;
paulson@1995
    56
             Says A B {|Agent A, Nonce NA|} : set_of_list evs |]
paulson@2284
    57
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs : yahalom lost"
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@2125
    62
    Oops "[| evs: yahalom lost;  A ~= Spy;
paulson@2284
    63
             Says Server A {|Crypt (shrK A)
paulson@2284
    64
                                   {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@2125
    65
                             X|}  : set_of_list evs |]
paulson@2110
    66
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evs : yahalom lost"
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|} 
paulson@3447
    74
         : set_of_list evs"
paulson@3447
    75
paulson@1985
    76
end