src/HOL/Auth/Shared.thy
author nipkow
Tue Apr 08 10:48:42 1997 +0200 (1997-04-08)
changeset 2919 953a47dc0519
parent 2516 4d68fbe6378b
child 3414 804c8a178a7f
permissions -rw-r--r--
Dep. on Provers/nat_transitive
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@2516
    11
Shared = Message + List + Finite +
paulson@1934
    12
paulson@1934
    13
consts
paulson@1943
    14
  shrK    :: agent => key  (*symmetric keys*)
paulson@1967
    15
paulson@1934
    16
rules
paulson@2516
    17
  (*ALL keys are symmetric*)
paulson@2516
    18
  isSym_keys "isSymKey K"
paulson@1934
    19
paulson@1934
    20
consts  (*Initial states of agents -- parameter of the construction*)
paulson@2032
    21
  initState :: [agent set, agent] => msg set
paulson@1934
    22
paulson@1934
    23
primrec initState agent
paulson@2319
    24
        (*Server knows all long-term keys; other agents know only their own*)
paulson@2032
    25
  initState_Server  "initState lost Server     = Key `` range shrK"
paulson@2032
    26
  initState_Friend  "initState lost (Friend i) = {Key (shrK (Friend i))}"
paulson@2064
    27
  initState_Spy     "initState lost Spy        = Key``shrK``lost"
paulson@2032
    28
paulson@1934
    29
paulson@1934
    30
datatype  (*Messages, and components of agent stores*)
paulson@1934
    31
  event = Says agent agent msg
paulson@1934
    32
paulson@1934
    33
consts  
paulson@1934
    34
  sees1 :: [agent, event] => msg set
paulson@1934
    35
paulson@1934
    36
primrec sees1 event
paulson@2078
    37
           (*Spy reads all traffic whether addressed to him or not*)
paulson@2078
    38
  sees1_Says  "sees1 A (Says A' B X)  = (if A:{B,Spy} then {X} else {})"
paulson@1934
    39
paulson@1934
    40
consts  
paulson@2032
    41
  sees :: [agent set, agent, event list] => msg set
paulson@1934
    42
paulson@1934
    43
primrec sees list
paulson@2032
    44
  sees_Nil  "sees lost A []       = initState lost A"
paulson@2032
    45
  sees_Cons "sees lost A (ev#evs) = sees1 A ev Un sees lost A evs"
paulson@1934
    46
paulson@1934
    47
paulson@2516
    48
constdefs
paulson@2516
    49
  (*Set of items that might be visible to somebody: complement of the set
paulson@2516
    50
        of fresh items*)
paulson@2516
    51
  used :: event list => msg set
paulson@2516
    52
    "used evs == parts (UN lost B. sees lost B evs)"
paulson@2516
    53
paulson@2516
    54
paulson@2516
    55
rules
paulson@2516
    56
  (*Unlike the corresponding property of nonces, this cannot be proved.
paulson@2516
    57
    We have infinitely many agents and there is nothing to stop their
paulson@2516
    58
    long-term keys from exhausting all the natural numbers.  The axiom
paulson@2516
    59
    assumes that their keys are dispersed so as to leave room for infinitely
paulson@2516
    60
    many fresh session keys.  We could, alternatively, restrict agents to
paulson@2516
    61
    an unspecified finite number.*)
paulson@2516
    62
  Key_supply_ax  "KK: Fin UNIV ==> EX K. K ~: KK & Key K ~: used evs"
paulson@2516
    63
paulson@2516
    64
paulson@2451
    65
(*Agents generate random (symmetric) keys and nonces.
paulson@2451
    66
  The numeric argument is typically the length of the current trace.
paulson@2451
    67
  An injective pairing function allows multiple keys/nonces to be generated
paulson@2451
    68
	in one protocol round.  A typical candidate for npair(i,j) is
paulson@2451
    69
	2^j(2i+1)
paulson@2451
    70
*)
paulson@2376
    71
paulson@1934
    72
consts
paulson@2451
    73
  nPair :: "nat*nat => nat"
paulson@2451
    74
  newN  :: "nat => nat"
paulson@2451
    75
  newK  :: "nat => key"
paulson@1934
    76
paulson@1934
    77
rules
paulson@2376
    78
  inj_shrK        "inj shrK"
paulson@2451
    79
  inj_nPair       "inj nPair"
paulson@2451
    80
  inj_newN        "inj newN"
paulson@2451
    81
  inj_newK        "inj newK"
paulson@2032
    82
paulson@2451
    83
  newK_neq_shrK   "newK i ~= shrK A" 
paulson@1934
    84
paulson@1934
    85
end