2318
|
1 |
(* Title: HOL/Auth/Public
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1996 University of Cambridge
|
|
5 |
|
|
6 |
Theory of Public Keys (common to all symmetric-key protocols)
|
|
7 |
|
|
8 |
Server keys; initial states of agents; new nonces and keys; function "sees"
|
|
9 |
*)
|
|
10 |
|
|
11 |
|
|
12 |
open Public;
|
|
13 |
|
|
14 |
(*Holds because Friend is injective: thus cannot prove for all f*)
|
|
15 |
goal thy "(Friend x : Friend``A) = (x:A)";
|
|
16 |
by (Auto_tac());
|
|
17 |
qed "Friend_image_eq";
|
|
18 |
Addsimps [Friend_image_eq];
|
|
19 |
|
|
20 |
Addsimps [Un_insert_left, Un_insert_right];
|
|
21 |
|
|
22 |
(*By default only o_apply is built-in. But in the presence of eta-expansion
|
|
23 |
this means that some terms displayed as (f o g) will be rewritten, and others
|
|
24 |
will not!*)
|
|
25 |
Addsimps [o_def];
|
|
26 |
|
|
27 |
(*** Basic properties of pubK ***)
|
|
28 |
|
|
29 |
(*Injectiveness and freshness of new keys and nonces*)
|
|
30 |
AddIffs [inj_pubK RS inj_eq];
|
|
31 |
AddSDs [newN_length];
|
|
32 |
|
|
33 |
(** Rewrites should not refer to initState(Friend i)
|
|
34 |
-- not in normal form! **)
|
|
35 |
|
|
36 |
Addsimps [priK_neq_pubK, priK_neq_pubK RS not_sym];
|
|
37 |
|
|
38 |
goal thy "Nonce (newN evs) ~: parts (initState lost B)";
|
|
39 |
by (agent.induct_tac "B" 1);
|
|
40 |
by (Auto_tac ());
|
|
41 |
qed "newN_notin_initState";
|
|
42 |
|
|
43 |
AddIffs [newN_notin_initState];
|
|
44 |
|
|
45 |
goalw thy [keysFor_def] "keysFor (parts (initState lost C)) = {}";
|
|
46 |
by (agent.induct_tac "C" 1);
|
|
47 |
by (auto_tac (!claset addIs [range_eqI], !simpset));
|
|
48 |
qed "keysFor_parts_initState";
|
|
49 |
Addsimps [keysFor_parts_initState];
|
|
50 |
|
|
51 |
goalw thy [keysFor_def] "keysFor (Key``E) = {}";
|
|
52 |
by (Auto_tac ());
|
|
53 |
qed "keysFor_image_Key";
|
|
54 |
Addsimps [keysFor_image_Key];
|
|
55 |
|
|
56 |
|
|
57 |
(*** Function "sees" ***)
|
|
58 |
|
|
59 |
goal thy
|
|
60 |
"!!evs. lost' <= lost ==> sees lost' A evs <= sees lost A evs";
|
|
61 |
by (list.induct_tac "evs" 1);
|
|
62 |
by (agent.induct_tac "A" 1);
|
|
63 |
by (event.induct_tac "a" 2);
|
|
64 |
by (Auto_tac ());
|
|
65 |
qed "sees_mono";
|
|
66 |
|
|
67 |
(*Agents see their own private keys!*)
|
|
68 |
goal thy "A ~= Spy --> Key (priK A) : sees lost A evs";
|
|
69 |
by (list.induct_tac "evs" 1);
|
|
70 |
by (agent.induct_tac "A" 1);
|
|
71 |
by (Auto_tac ());
|
|
72 |
qed_spec_mp "sees_own_priK";
|
|
73 |
|
|
74 |
(*All public keys are visible*)
|
|
75 |
goal thy "Key (pubK A) : sees lost A evs";
|
|
76 |
by (list.induct_tac "evs" 1);
|
|
77 |
by (agent.induct_tac "A" 1);
|
|
78 |
by (Auto_tac ());
|
|
79 |
qed_spec_mp "sees_pubK";
|
|
80 |
|
|
81 |
(*Spy sees private keys of lost agents!*)
|
|
82 |
goal thy "!!A. A: lost ==> Key (priK A) : sees lost Spy evs";
|
|
83 |
by (list.induct_tac "evs" 1);
|
|
84 |
by (Auto_tac());
|
|
85 |
qed "Spy_sees_lost";
|
|
86 |
|
|
87 |
AddIffs [sees_pubK];
|
|
88 |
AddSIs [sees_own_priK, Spy_sees_lost];
|
|
89 |
|
|
90 |
(*Added for Yahalom/lost_tac*)
|
|
91 |
goal thy "!!A. [| Crypt (pubK A) X : analz (sees lost Spy evs); A: lost |] \
|
|
92 |
\ ==> X : analz (sees lost Spy evs)";
|
|
93 |
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
|
|
94 |
qed "Crypt_Spy_analz_lost";
|
|
95 |
|
|
96 |
(** Specialized rewrite rules for (sees lost A (Says...#evs)) **)
|
|
97 |
|
|
98 |
goal thy "sees lost B (Says A B X # evs) = insert X (sees lost B evs)";
|
|
99 |
by (Simp_tac 1);
|
|
100 |
qed "sees_own";
|
|
101 |
|
|
102 |
goal thy "!!A. Server ~= B ==> \
|
|
103 |
\ sees lost Server (Says A B X # evs) = sees lost Server evs";
|
|
104 |
by (Asm_simp_tac 1);
|
|
105 |
qed "sees_Server";
|
|
106 |
|
|
107 |
goal thy "!!A. Friend i ~= B ==> \
|
|
108 |
\ sees lost (Friend i) (Says A B X # evs) = sees lost (Friend i) evs";
|
|
109 |
by (Asm_simp_tac 1);
|
|
110 |
qed "sees_Friend";
|
|
111 |
|
|
112 |
goal thy "sees lost Spy (Says A B X # evs) = insert X (sees lost Spy evs)";
|
|
113 |
by (Simp_tac 1);
|
|
114 |
qed "sees_Spy";
|
|
115 |
|
|
116 |
goal thy "sees lost A (Says A' B X # evs) <= insert X (sees lost A evs)";
|
|
117 |
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
|
|
118 |
by (Fast_tac 1);
|
|
119 |
qed "sees_Says_subset_insert";
|
|
120 |
|
|
121 |
goal thy "sees lost A evs <= sees lost A (Says A' B X # evs)";
|
|
122 |
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
|
|
123 |
by (Fast_tac 1);
|
|
124 |
qed "sees_subset_sees_Says";
|
|
125 |
|
|
126 |
(*Pushing Unions into parts. One of the agents A is B, and thus sees Y.
|
|
127 |
Once used to prove new_keys_not_seen; now obsolete.*)
|
|
128 |
goal thy "(UN A. parts (sees lost A (Says B C Y # evs))) = \
|
|
129 |
\ parts {Y} Un (UN A. parts (sees lost A evs))";
|
|
130 |
by (Step_tac 1);
|
|
131 |
by (etac rev_mp 1); (*split_tac does not work on assumptions*)
|
|
132 |
by (ALLGOALS
|
|
133 |
(fast_tac (!claset addss (!simpset addsimps [parts_Un, sees_Cons]
|
|
134 |
setloop split_tac [expand_if]))));
|
|
135 |
qed "UN_parts_sees_Says";
|
|
136 |
|
|
137 |
goal thy "Says A B X : set_of_list evs --> X : sees lost Spy evs";
|
|
138 |
by (list.induct_tac "evs" 1);
|
|
139 |
by (Auto_tac ());
|
|
140 |
qed_spec_mp "Says_imp_sees_Spy";
|
|
141 |
|
|
142 |
goal thy
|
|
143 |
"!!evs. [| Says A B (Crypt (pubK C) X) : set_of_list evs; C : lost |] \
|
|
144 |
\ ==> X : analz (sees lost Spy evs)";
|
|
145 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
|
|
146 |
addss (!simpset)) 1);
|
|
147 |
qed "Says_Crypt_lost";
|
|
148 |
|
|
149 |
goal thy
|
|
150 |
"!!evs. [| Says A B (Crypt (pubK C) X) : set_of_list evs; \
|
|
151 |
\ X ~: analz (sees lost Spy evs) |] \
|
|
152 |
\ ==> C ~: lost";
|
|
153 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
|
|
154 |
addss (!simpset)) 1);
|
|
155 |
qed "Says_Crypt_not_lost";
|
|
156 |
|
|
157 |
Addsimps [sees_own, sees_Server, sees_Friend, sees_Spy];
|
|
158 |
Delsimps [sees_Cons]; (**** NOTE REMOVAL -- laws above are cleaner ****)
|
|
159 |
|
|
160 |
|
|
161 |
(** Power of the Spy **)
|
|
162 |
|
|
163 |
(*The Spy can see more than anybody else, except for their initial state*)
|
|
164 |
goal thy "sees lost A evs <= initState lost A Un sees lost Spy evs";
|
|
165 |
by (list.induct_tac "evs" 1);
|
|
166 |
by (event.induct_tac "a" 2);
|
|
167 |
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD]
|
|
168 |
addss (!simpset))));
|
|
169 |
qed "sees_agent_subset_sees_Spy";
|
|
170 |
|
|
171 |
(*The Spy can see more than anybody else who's lost their key!*)
|
|
172 |
goal thy "A: lost --> A ~= Server --> sees lost A evs <= sees lost Spy evs";
|
|
173 |
by (list.induct_tac "evs" 1);
|
|
174 |
by (event.induct_tac "a" 2);
|
|
175 |
by (agent.induct_tac "A" 1);
|
|
176 |
by (auto_tac (!claset addDs [sees_Says_subset_insert RS subsetD], (!simpset)));
|
|
177 |
qed_spec_mp "sees_lost_agent_subset_sees_Spy";
|
|
178 |
|
|
179 |
|
|
180 |
(** Simplifying parts (insert X (sees lost A evs))
|
|
181 |
= parts {X} Un parts (sees lost A evs) -- since general case loops*)
|
|
182 |
|
|
183 |
val parts_insert_sees =
|
|
184 |
parts_insert |> read_instantiate_sg (sign_of thy)
|
|
185 |
[("H", "sees lost A evs")]
|
|
186 |
|> standard;
|