src/HOL/Auth/Shared.thy
author paulson
Mon Sep 09 17:44:20 1996 +0200 (1996-09-09)
changeset 1965 789c12ea0b30
parent 1943 20574dca5a3e
child 1967 0ff58b41c037
permissions -rw-r--r--
Stronger proofs; work for Otway-Rees
     1 (*  Title:      HOL/Auth/Shared
     2     ID:         $Id$
     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1996  University of Cambridge
     5 
     6 Theory of Shared Keys (common to all symmetric-key protocols)
     7 
     8 Server keys; initial states of agents; new nonces and keys; function "sees" 
     9 
    10 IS THE Notes constructor needed??
    11 *)
    12 
    13 Shared = Message + List + 
    14 
    15 consts
    16   shrK    :: agent => key  (*symmetric keys*)
    17   leaked  :: nat set       (*Friendly agents whose keys have leaked to Enemy*)
    18 
    19 rules
    20   isSym_shrK "isSymKey (shrK A)"
    21 
    22 consts  (*Initial states of agents -- parameter of the construction*)
    23   initState :: agent => msg set
    24 
    25 primrec initState agent
    26         (*Server knows all keys; other agents know only their own*)
    27   initState_Server  "initState Server     = Key `` range shrK"
    28   initState_Friend  "initState (Friend i) = {Key (shrK (Friend i))}"
    29   initState_Enemy
    30     "initState Enemy = insert (Key (shrK Enemy)) (Key``shrK``Friend``leaked)"
    31 
    32 datatype  (*Messages, and components of agent stores*)
    33   event = Says agent agent msg
    34         | Notes agent msg
    35 
    36 consts  
    37   sees1 :: [agent, event] => msg set
    38 
    39 primrec sees1 event
    40            (*First agent recalls all that it says, but NOT everything
    41              that is sent to it; it must note such things if/when received*)
    42   sees1_Says  "sees1 A (Says A' B X)  = (if A:{A',Enemy} then {X} else {})"
    43           (*part of A's internal state*)
    44   sees1_Notes "sees1 A (Notes A' X)   = (if A=A' then {X} else {})"
    45 
    46 consts  
    47   sees :: [agent, event list] => msg set
    48 
    49 primrec sees list
    50         (*Initial knowledge includes all public keys and own private key*)
    51   sees_Nil  "sees A []       = initState A"
    52   sees_Cons "sees A (ev#evs) = sees1 A ev Un sees A evs"
    53 
    54 
    55 (*Agents generate "random" nonces.  Different traces always yield
    56   different nonces.  Same applies for keys.*)
    57 consts
    58   newN :: "event list => nat"
    59   newK :: "event list => key"
    60 
    61 rules
    62   inj_shrK "inj shrK"
    63 
    64   inj_newN   "inj newN"
    65   fresh_newN "Nonce (newN evs) ~: parts (initState B)" 
    66 
    67   inj_newK   "inj newK"
    68   fresh_newK "Key (newK evs) ~: parts (initState B)" 
    69   isSym_newK "isSymKey (newK evs)"
    70 
    71 end