src/HOL/Auth/Yahalom.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@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@6335
    24
    Fake "[| evs: yahalom;  X: synth (analz (knows Spy evs)) |]
paulson@3519
    25
          ==> Says Spy B X  # evs : yahalom"
paulson@1985
    26
paulson@6335
    27
         (*A message that has been sent can be received by the
paulson@6335
    28
           intended recipient.*)
paulson@6335
    29
    Reception "[| evsr: yahalom;  Says A B X : set evsr |]
paulson@6335
    30
               ==> Gets B X # evsr : yahalom"
paulson@6335
    31
paulson@1985
    32
         (*Alice initiates a protocol run*)
paulson@5434
    33
    YM1  "[| evs1: yahalom;  Nonce NA ~: used evs1 |]
paulson@3659
    34
          ==> Says A B {|Agent A, Nonce NA|} # evs1 : yahalom"
paulson@1985
    35
paulson@6335
    36
         (*Bob's response to Alice's message.*)
paulson@5434
    37
    YM2  "[| evs2: yahalom;  Nonce NB ~: used evs2;
paulson@6335
    38
             Gets B {|Agent A, Nonce NA|} : set evs2 |]
paulson@1985
    39
          ==> Says B Server 
paulson@2516
    40
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@3659
    41
                # evs2 : yahalom"
paulson@1985
    42
paulson@1985
    43
         (*The Server receives Bob's message.  He responds by sending a
paulson@1985
    44
            new session key to Alice, with a packet for forwarding to Bob.*)
paulson@5434
    45
    YM3  "[| evs3: yahalom;  Key KAB ~: used evs3;
paulson@6335
    46
             Gets Server 
paulson@2284
    47
                  {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
paulson@3659
    48
               : set evs3 |]
paulson@1995
    49
          ==> Says Server A
paulson@3447
    50
                   {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
paulson@3447
    51
                     Crypt (shrK B) {|Agent A, Key KAB|}|}
paulson@3659
    52
                # evs3 : yahalom"
paulson@1985
    53
paulson@1995
    54
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@3961
    55
           uses the new session key to send Bob his Nonce.  The premise
paulson@5434
    56
           A ~= Server is needed to prove Says_Server_not_range.*)
paulson@5434
    57
    YM4  "[| evs4: yahalom;  A ~= Server;
paulson@6335
    58
             Gets A {|Crypt(shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|}, X|}
paulson@6335
    59
                : 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@1985
    62
paulson@2110
    63
         (*This message models possible leaks of session keys.  The Nonces
paulson@2156
    64
           identify the protocol run.  Quoting Server here ensures they are
paulson@2156
    65
           correct.*)
paulson@5359
    66
    Oops "[| evso: yahalom;  
paulson@2284
    67
             Says Server A {|Crypt (shrK A)
paulson@2284
    68
                                   {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@3659
    69
                             X|}  : set evso |]
paulson@4537
    70
          ==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso : yahalom"
paulson@2110
    71
paulson@3447
    72
paulson@3447
    73
constdefs 
paulson@3447
    74
  KeyWithNonce :: [key, nat, event list] => bool
paulson@3447
    75
  "KeyWithNonce K NB evs ==
paulson@3447
    76
     EX A B na X. 
paulson@3447
    77
       Says Server A {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|} 
nipkow@3465
    78
         : set evs"
paulson@3447
    79
paulson@1985
    80
end