src/HOL/Auth/Shared.thy
author paulson
Thu Dec 19 11:58:39 1996 +0100 (1996-12-19)
changeset 2451 ce85a2aafc7a
parent 2376 f5c61fd9b9b6
child 2516 4d68fbe6378b
permissions -rw-r--r--
Extensive tidying and simplification, largely stemming from
changing newN and newK to take an integer argument
paulson@1934
     1
(*  Title:      HOL/Auth/Shared
paulson@1934
     2
    ID:         $Id$
paulson@1934
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1934
     4
    Copyright   1996  University of Cambridge
paulson@1934
     5
paulson@1934
     6
Theory of Shared Keys (common to all symmetric-key protocols)
paulson@1934
     7
paulson@1934
     8
Server keys; initial states of agents; new nonces and keys; function "sees" 
paulson@1934
     9
*)
paulson@1934
    10
paulson@1934
    11
Shared = Message + List + 
paulson@1934
    12
paulson@1934
    13
consts
paulson@1943
    14
  shrK    :: agent => key  (*symmetric keys*)
paulson@1967
    15
paulson@1934
    16
rules
paulson@1943
    17
  isSym_shrK "isSymKey (shrK A)"
paulson@1934
    18
paulson@1934
    19
consts  (*Initial states of agents -- parameter of the construction*)
paulson@2032
    20
  initState :: [agent set, agent] => msg set
paulson@1934
    21
paulson@1934
    22
primrec initState agent
paulson@2319
    23
        (*Server knows all long-term keys; other agents know only their own*)
paulson@2032
    24
  initState_Server  "initState lost Server     = Key `` range shrK"
paulson@2032
    25
  initState_Friend  "initState lost (Friend i) = {Key (shrK (Friend i))}"
paulson@2064
    26
  initState_Spy     "initState lost Spy        = Key``shrK``lost"
paulson@2032
    27
paulson@1934
    28
paulson@1934
    29
datatype  (*Messages, and components of agent stores*)
paulson@1934
    30
  event = Says agent agent msg
paulson@1934
    31
paulson@1934
    32
consts  
paulson@1934
    33
  sees1 :: [agent, event] => msg set
paulson@1934
    34
paulson@1934
    35
primrec sees1 event
paulson@2078
    36
           (*Spy reads all traffic whether addressed to him or not*)
paulson@2078
    37
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{B,Spy} then {X} else {})"
paulson@1934
    38
paulson@1934
    39
consts  
paulson@2032
    40
  sees :: [agent set, agent, event list] => msg set
paulson@1934
    41
paulson@1934
    42
primrec sees list
paulson@2032
    43
  sees_Nil  "sees lost A []       = initState lost A"
paulson@2032
    44
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
paulson@1934
    45
paulson@1934
    46
paulson@2451
    47
(*Agents generate random (symmetric) keys and nonces.
paulson@2451
    48
  The numeric argument is typically the length of the current trace.
paulson@2451
    49
  An injective pairing function allows multiple keys/nonces to be generated
paulson@2451
    50
	in one protocol round.  A typical candidate for npair(i,j) is
paulson@2451
    51
	2^j(2i+1)
paulson@2451
    52
*)
paulson@2376
    53
paulson@1934
    54
consts
paulson@2451
    55
  nPair :: "nat*nat => nat"
paulson@2451
    56
  newN  :: "nat => nat"
paulson@2451
    57
  newK  :: "nat => key"
paulson@1934
    58
paulson@1934
    59
rules
paulson@2376
    60
  inj_shrK        "inj shrK"
paulson@2451
    61
  inj_nPair       "inj nPair"
paulson@2451
    62
  inj_newN        "inj newN"
paulson@2451
    63
  inj_newK        "inj newK"
paulson@2032
    64
paulson@2451
    65
  newK_neq_shrK   "newK i ~= shrK A" 
paulson@2451
    66
  isSym_newK      "isSymKey (newK i)"
paulson@1934
    67
paulson@1934
    68
end