src/HOL/Auth/NS_Public.thy
author paulson
Thu Dec 05 18:07:27 1996 +0100 (1996-12-05)
changeset 2318 6d3f7c7f70b0
child 2451 ce85a2aafc7a
permissions -rw-r--r--
Public-key examples
paulson@2318
     1
(*  Title:      HOL/Auth/NS_Public
paulson@2318
     2
    ID:         $Id$
paulson@2318
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2318
     4
    Copyright   1996  University of Cambridge
paulson@2318
     5
paulson@2318
     6
Inductive relation "ns_public" for the Needham-Schroeder Public-Key protocol.
paulson@2318
     7
Version incorporating Lowe's fix (inclusion of B's identify in round 2).
paulson@2318
     8
*)
paulson@2318
     9
paulson@2318
    10
NS_Public = Public + 
paulson@2318
    11
paulson@2318
    12
consts  lost    :: agent set        (*No need for it to be a variable*)
paulson@2318
    13
	ns_public  :: event list set
paulson@2318
    14
inductive ns_public
paulson@2318
    15
  intrs 
paulson@2318
    16
         (*Initial trace is empty*)
paulson@2318
    17
    Nil  "[]: ns_public"
paulson@2318
    18
paulson@2318
    19
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@2318
    20
           invent new nonces here, but he can also use NS1.  Common to
paulson@2318
    21
           all similar protocols.*)
paulson@2318
    22
    Fake "[| evs: ns_public;  B ~= Spy;  
paulson@2318
    23
             X: synth (analz (sees lost Spy evs)) |]
paulson@2318
    24
          ==> Says Spy B X  # evs : ns_public"
paulson@2318
    25
paulson@2318
    26
         (*Alice initiates a protocol run, sending a nonce to Bob*)
paulson@2318
    27
    NS1  "[| evs: ns_public;  A ~= B |]
paulson@2318
    28
          ==> Says A B (Crypt (pubK B) {|Nonce (newN evs), Agent A|}) # evs
paulson@2318
    29
                : ns_public"
paulson@2318
    30
paulson@2318
    31
         (*Bob responds to Alice's message with a further nonce*)
paulson@2318
    32
    NS2  "[| evs: ns_public;  A ~= B;
paulson@2318
    33
             Says A' B (Crypt (pubK B) {|Nonce NA, Agent A|})
paulson@2318
    34
               : set_of_list evs |]
paulson@2318
    35
          ==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce (newN evs), Agent B|})
paulson@2318
    36
                # evs  : ns_public"
paulson@2318
    37
paulson@2318
    38
         (*Alice proves her existence by sending NB back to Bob.*)
paulson@2318
    39
    NS3  "[| evs: ns_public;  A ~= B;
paulson@2318
    40
             Says B' A (Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|})
paulson@2318
    41
               : set_of_list evs;
paulson@2318
    42
             Says A  B (Crypt (pubK B) {|Nonce NA, Agent A|})
paulson@2318
    43
               : set_of_list evs |]
paulson@2318
    44
          ==> Says A B (Crypt (pubK B) (Nonce NB)) # evs : ns_public"
paulson@2318
    45
paulson@2318
    46
  (**Oops message??**)
paulson@2318
    47
paulson@2318
    48
rules
paulson@2318
    49
  (*Spy has access to his own key for spoof messages*)
paulson@2318
    50
  Spy_in_lost "Spy: lost"
paulson@2318
    51
paulson@2318
    52
end