author paulson
Mon, 09 Sep 1996 17:44:20 +0200
changeset 1965 789c12ea0b30
parent 1943 20574dca5a3e
child 1967 0ff58b41c037
permissions -rw-r--r--
Stronger proofs; work for Otway-Rees

(*  Title:      HOL/Auth/Shared
    ID:         $Id$
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
    Copyright   1996  University of Cambridge

Theory of Shared Keys (common to all symmetric-key protocols)

Server keys; initial states of agents; new nonces and keys; function "sees" 

IS THE Notes constructor needed??

Shared = Message + List + 

  shrK    :: agent => key  (*symmetric keys*)
  leaked  :: nat set       (*Friendly agents whose keys have leaked to Enemy*)

  isSym_shrK "isSymKey (shrK A)"

consts  (*Initial states of agents -- parameter of the construction*)
  initState :: agent => msg set

primrec initState agent
        (*Server knows all keys; other agents know only their own*)
  initState_Server  "initState Server     = Key `` range shrK"
  initState_Friend  "initState (Friend i) = {Key (shrK (Friend i))}"
    "initState Enemy = insert (Key (shrK Enemy)) (Key``shrK``Friend``leaked)"

datatype  (*Messages, and components of agent stores*)
  event = Says agent agent msg
        | Notes agent msg

  sees1 :: [agent, event] => msg set

primrec sees1 event
           (*First agent recalls all that it says, but NOT everything
             that is sent to it; it must note such things if/when received*)
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{A',Enemy} then {X} else {})"
          (*part of A's internal state*)
  sees1_Notes "sees1 A (Notes A' X)   = (if A=A' then {X} else {})"

  sees :: [agent, event list] => msg set

primrec sees list
        (*Initial knowledge includes all public keys and own private key*)
  sees_Nil  "sees A []       = initState A"
  sees_Cons "sees A (ev#evs) = sees1 A ev Un sees A evs"

(*Agents generate "random" nonces.  Different traces always yield
  different nonces.  Same applies for keys.*)
  newN :: "event list => nat"
  newK :: "event list => key"

  inj_shrK "inj shrK"

  inj_newN   "inj newN"
  fresh_newN "Nonce (newN evs) ~: parts (initState B)" 

  inj_newK   "inj newK"
  fresh_newK "Key (newK evs) ~: parts (initState B)" 
  isSym_newK "isSymKey (newK evs)"