2090
|
1 |
(* Title: HOL/Auth/OtwayRees
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1996 University of Cambridge
|
|
5 |
|
|
6 |
Inductive relation "otway" for the Otway-Rees protocol.
|
|
7 |
|
|
8 |
Simplified version with minimal encryption but explicit messages
|
|
9 |
|
|
10 |
From page 11 of
|
|
11 |
Abadi and Needham. Prudent Engineering Practice for Cryptographic Protocols.
|
|
12 |
IEEE Trans. SE 22 (1), 1996
|
|
13 |
*)
|
|
14 |
|
|
15 |
open OtwayRees_AN;
|
|
16 |
|
|
17 |
proof_timing:=true;
|
|
18 |
HOL_quantifiers := false;
|
|
19 |
|
|
20 |
|
|
21 |
(*Weak liveness: there are traces that reach the end*)
|
|
22 |
goal thy
|
|
23 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \
|
|
24 |
\ ==> EX K. EX NA. EX evs: otway lost. \
|
|
25 |
\ Says B A (Crypt {|Nonce NA, Agent A, Agent B, Key K|} (shrK A)) \
|
|
26 |
\ : set_of_list evs";
|
|
27 |
by (REPEAT (resolve_tac [exI,bexI] 1));
|
|
28 |
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
|
|
29 |
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
|
|
30 |
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
|
|
31 |
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
|
|
32 |
result();
|
|
33 |
|
|
34 |
|
|
35 |
(**** Inductive proofs about otway ****)
|
|
36 |
|
2106
|
37 |
(*Monotonicity*)
|
2090
|
38 |
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
|
|
39 |
by (rtac subsetI 1);
|
|
40 |
by (etac otway.induct 1);
|
|
41 |
by (REPEAT_FIRST
|
|
42 |
(best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
|
|
43 |
:: otway.intrs))));
|
|
44 |
qed "otway_mono";
|
|
45 |
|
|
46 |
(*Nobody sends themselves messages*)
|
|
47 |
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
|
|
48 |
by (etac otway.induct 1);
|
|
49 |
by (Auto_tac());
|
|
50 |
qed_spec_mp "not_Says_to_self";
|
|
51 |
Addsimps [not_Says_to_self];
|
|
52 |
AddSEs [not_Says_to_self RSN (2, rev_notE)];
|
|
53 |
|
|
54 |
|
|
55 |
(** For reasoning about the encrypted portion of messages **)
|
|
56 |
|
|
57 |
goal thy "!!evs. Says S B {|X, X'|} : set_of_list evs ==> \
|
|
58 |
\ X : analz (sees lost Spy evs)";
|
|
59 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
|
|
60 |
qed "OR4_analz_sees_Spy";
|
|
61 |
|
|
62 |
goal thy "!!evs. Says B' A (Crypt {|N,Agent A,B,K|} K') : set_of_list evs ==> \
|
|
63 |
\ K : parts (sees lost Spy evs)";
|
|
64 |
by (fast_tac (!claset addSEs partsEs
|
|
65 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
|
|
66 |
qed "Reveal_parts_sees_Spy";
|
|
67 |
|
|
68 |
(*OR2_analz... and OR4_analz... let us treat those cases using the same
|
|
69 |
argument as for the Fake case. This is possible for most, but not all,
|
|
70 |
proofs: Fake does not invent new nonces (as in OR2), and of course Fake
|
|
71 |
messages originate from the Spy. *)
|
|
72 |
|
|
73 |
bind_thm ("OR4_parts_sees_Spy",
|
|
74 |
OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
|
|
75 |
|
|
76 |
(*We instantiate the variable to "lost". Leaving it as a Var makes proofs
|
|
77 |
harder to complete, since simplification does less for us.*)
|
|
78 |
val parts_Fake_tac =
|
|
79 |
forw_inst_tac [("lost","lost")] OR4_parts_sees_Spy 6 THEN
|
|
80 |
forw_inst_tac [("lost","lost")] Reveal_parts_sees_Spy 7;
|
|
81 |
|
|
82 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
|
|
83 |
fun parts_induct_tac i = SELECT_GOAL
|
|
84 |
(DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
|
|
85 |
(*Fake message*)
|
|
86 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
|
|
87 |
impOfSubs Fake_parts_insert]
|
|
88 |
addss (!simpset)) 2)) THEN
|
|
89 |
(*Base case*)
|
|
90 |
fast_tac (!claset addss (!simpset)) 1 THEN
|
|
91 |
ALLGOALS Asm_simp_tac) i;
|
|
92 |
|
|
93 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
|
|
94 |
sends messages containing X! **)
|
|
95 |
|
|
96 |
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
|
|
97 |
goal thy
|
|
98 |
"!!evs. [| evs : otway lost; A ~: lost |] \
|
|
99 |
\ ==> Key (shrK A) ~: parts (sees lost Spy evs)";
|
|
100 |
by (parts_induct_tac 1);
|
|
101 |
by (Auto_tac());
|
|
102 |
qed "Spy_not_see_shrK";
|
|
103 |
|
|
104 |
bind_thm ("Spy_not_analz_shrK",
|
|
105 |
[analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
|
|
106 |
|
|
107 |
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
|
|
108 |
|
|
109 |
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
|
|
110 |
As usual fast_tac cannot be used because it uses the equalities too soon*)
|
|
111 |
val major::prems =
|
|
112 |
goal thy "[| Key (shrK A) : parts (sees lost Spy evs); \
|
|
113 |
\ evs : otway lost; \
|
|
114 |
\ A:lost ==> R \
|
|
115 |
\ |] ==> R";
|
|
116 |
by (rtac ccontr 1);
|
|
117 |
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
|
|
118 |
by (swap_res_tac prems 2);
|
|
119 |
by (ALLGOALS (fast_tac (!claset addIs prems)));
|
|
120 |
qed "Spy_see_shrK_E";
|
|
121 |
|
|
122 |
bind_thm ("Spy_analz_shrK_E",
|
|
123 |
analz_subset_parts RS subsetD RS Spy_see_shrK_E);
|
|
124 |
|
|
125 |
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
|
|
126 |
|
|
127 |
|
|
128 |
(*** Future keys can't be seen or used! ***)
|
|
129 |
|
|
130 |
(*Nobody can have SEEN keys that will be generated in the future.
|
|
131 |
This has to be proved anew for each protocol description,
|
|
132 |
but should go by similar reasoning every time. Hardest case is the
|
|
133 |
standard Fake rule.
|
|
134 |
The Union over C is essential for the induction! *)
|
|
135 |
goal thy "!!evs. evs : otway lost ==> \
|
|
136 |
\ length evs <= length evs' --> \
|
|
137 |
\ Key (newK evs') ~: (UN C. parts (sees lost C evs))";
|
|
138 |
by (parts_induct_tac 1);
|
|
139 |
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
|
|
140 |
impOfSubs parts_insert_subset_Un,
|
|
141 |
Suc_leD]
|
|
142 |
addss (!simpset))));
|
|
143 |
val lemma = result();
|
|
144 |
|
|
145 |
(*Variant needed for the main theorem below*)
|
|
146 |
goal thy
|
|
147 |
"!!evs. [| evs : otway lost; length evs <= length evs' |] \
|
|
148 |
\ ==> Key (newK evs') ~: parts (sees lost C evs)";
|
|
149 |
by (fast_tac (!claset addDs [lemma]) 1);
|
|
150 |
qed "new_keys_not_seen";
|
|
151 |
Addsimps [new_keys_not_seen];
|
|
152 |
|
|
153 |
(*Another variant: old messages must contain old keys!*)
|
|
154 |
goal thy
|
|
155 |
"!!evs. [| Says A B X : set_of_list evs; \
|
|
156 |
\ Key (newK evt) : parts {X}; \
|
|
157 |
\ evs : otway lost \
|
|
158 |
\ |] ==> length evt < length evs";
|
|
159 |
by (rtac ccontr 1);
|
|
160 |
by (dtac leI 1);
|
|
161 |
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
|
|
162 |
addIs [impOfSubs parts_mono]) 1);
|
|
163 |
qed "Says_imp_old_keys";
|
|
164 |
|
|
165 |
|
|
166 |
(*** Future nonces can't be seen or used! [proofs resemble those above] ***)
|
|
167 |
|
|
168 |
goal thy "!!evs. evs : otway lost ==> \
|
|
169 |
\ length evs <= length evt --> \
|
|
170 |
\ Nonce (newN evt) ~: (UN C. parts (sees lost C evs))";
|
|
171 |
by (etac otway.induct 1);
|
|
172 |
(*auto_tac does not work here, as it performs safe_tac first*)
|
|
173 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2]
|
|
174 |
addcongs [disj_cong])));
|
|
175 |
by (REPEAT_FIRST (fast_tac (!claset
|
|
176 |
addSEs partsEs
|
|
177 |
addSDs [Says_imp_sees_Spy RS parts.Inj]
|
|
178 |
addDs [impOfSubs analz_subset_parts,
|
|
179 |
impOfSubs parts_insert_subset_Un,
|
|
180 |
Suc_leD]
|
|
181 |
addss (!simpset))));
|
|
182 |
val lemma = result();
|
|
183 |
|
|
184 |
(*Variant needed for the main theorem below*)
|
|
185 |
goal thy
|
|
186 |
"!!evs. [| evs : otway lost; length evs <= length evs' |] \
|
|
187 |
\ ==> Nonce (newN evs') ~: parts (sees lost C evs)";
|
|
188 |
by (fast_tac (!claset addDs [lemma]) 1);
|
|
189 |
qed "new_nonces_not_seen";
|
|
190 |
Addsimps [new_nonces_not_seen];
|
|
191 |
|
|
192 |
|
|
193 |
(*Nobody can have USED keys that will be generated in the future.
|
|
194 |
...very like new_keys_not_seen*)
|
|
195 |
goal thy "!!evs. evs : otway lost ==> \
|
|
196 |
\ length evs <= length evs' --> \
|
|
197 |
\ newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
|
|
198 |
by (parts_induct_tac 1);
|
|
199 |
(*OR1 and OR3*)
|
|
200 |
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
|
|
201 |
(*Fake, OR2, OR4: these messages send unknown (X) components*)
|
2106
|
202 |
by (REPEAT
|
|
203 |
(best_tac
|
2090
|
204 |
(!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
|
|
205 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono),
|
|
206 |
Suc_leD]
|
|
207 |
addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
|
2106
|
208 |
addss (!simpset)) 1));
|
2090
|
209 |
val lemma = result();
|
|
210 |
|
|
211 |
goal thy
|
|
212 |
"!!evs. [| evs : otway lost; length evs <= length evs' |] \
|
|
213 |
\ ==> newK evs' ~: keysFor (parts (sees lost C evs))";
|
|
214 |
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
|
|
215 |
qed "new_keys_not_used";
|
|
216 |
|
|
217 |
bind_thm ("new_keys_not_analzd",
|
|
218 |
[analz_subset_parts RS keysFor_mono,
|
|
219 |
new_keys_not_used] MRS contra_subsetD);
|
|
220 |
|
|
221 |
Addsimps [new_keys_not_used, new_keys_not_analzd];
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
(*** Proofs involving analz ***)
|
|
226 |
|
|
227 |
(*Describes the form of Key K when the following message is sent. The use of
|
|
228 |
"parts" strengthens the induction hyp for proving the Fake case. The
|
|
229 |
assumption A ~: lost prevents its being a Faked message. (Based
|
|
230 |
on NS_Shared/Says_S_message_form) *)
|
|
231 |
goal thy
|
|
232 |
"!!evs. evs: otway lost ==> \
|
|
233 |
\ Crypt {|N, Agent A, B, Key K|} (shrK A) : parts (sees lost Spy evs) \
|
|
234 |
\ --> A ~: lost --> (EX evt: otway lost. K = newK evt)";
|
|
235 |
by (parts_induct_tac 1);
|
|
236 |
by (Auto_tac());
|
|
237 |
qed_spec_mp "Reveal_message_lemma";
|
|
238 |
|
|
239 |
(*EITHER describes the form of Key K when the following message is sent,
|
|
240 |
OR reduces it to the Fake case.*)
|
|
241 |
|
|
242 |
goal thy
|
|
243 |
"!!evs. [| Says B' A (Crypt {|N, Agent A, B, Key K|} (shrK A)) \
|
|
244 |
\ : set_of_list evs; \
|
|
245 |
\ evs : otway lost |] \
|
|
246 |
\ ==> (EX evt: otway lost. K = newK evt) \
|
|
247 |
\ | Key K : analz (sees lost Spy evs)";
|
|
248 |
br (Reveal_message_lemma RS disjCI) 1;
|
|
249 |
ba 1;
|
|
250 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
|
|
251 |
addDs [impOfSubs analz_subset_parts]) 1);
|
|
252 |
by (fast_tac (!claset addSDs [Says_Crypt_lost]) 1);
|
|
253 |
qed "Reveal_message_form";
|
|
254 |
|
|
255 |
|
|
256 |
(*For proofs involving analz. We again instantiate the variable to "lost".*)
|
|
257 |
val analz_Fake_tac =
|
|
258 |
dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
|
|
259 |
forw_inst_tac [("lost","lost")] Reveal_message_form 7;
|
|
260 |
|
|
261 |
|
|
262 |
(****
|
|
263 |
The following is to prove theorems of the form
|
|
264 |
|
|
265 |
Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
|
|
266 |
Key K : analz (sees lost Spy evs)
|
|
267 |
|
|
268 |
A more general formula must be proved inductively.
|
|
269 |
|
|
270 |
****)
|
|
271 |
|
|
272 |
|
|
273 |
(** Session keys are not used to encrypt other session keys **)
|
|
274 |
|
|
275 |
(*The equality makes the induction hypothesis easier to apply*)
|
|
276 |
goal thy
|
|
277 |
"!!evs. evs : otway lost ==> \
|
|
278 |
\ ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
|
|
279 |
\ (K : newK``E | Key K : analz (sees lost Spy evs))";
|
|
280 |
by (etac otway.induct 1);
|
|
281 |
by analz_Fake_tac;
|
|
282 |
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
|
|
283 |
by (REPEAT ((eresolve_tac [bexE, disjE] ORELSE' hyp_subst_tac) 7));
|
|
284 |
by (ALLGOALS (*Takes 28 secs*)
|
|
285 |
(asm_simp_tac
|
|
286 |
(!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
|
|
287 |
@ pushes)
|
|
288 |
setloop split_tac [expand_if])));
|
|
289 |
(** LEVEL 5 **)
|
2106
|
290 |
(*Reveal case 2, OR4, Fake*)
|
2090
|
291 |
by (EVERY (map spy_analz_tac [6, 4, 2]));
|
|
292 |
(*Reveal case 1, OR3, Base*)
|
|
293 |
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
|
|
294 |
qed_spec_mp "analz_image_newK";
|
|
295 |
|
|
296 |
|
|
297 |
goal thy
|
|
298 |
"!!evs. evs : otway lost ==> \
|
|
299 |
\ Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
|
|
300 |
\ (K = newK evt | Key K : analz (sees lost Spy evs))";
|
|
301 |
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK,
|
|
302 |
insert_Key_singleton]) 1);
|
|
303 |
by (Fast_tac 1);
|
|
304 |
qed "analz_insert_Key_newK";
|
|
305 |
|
|
306 |
|
|
307 |
(*** The Key K uniquely identifies the Server's message. **)
|
|
308 |
|
|
309 |
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
|
|
310 |
|
|
311 |
goal thy
|
|
312 |
"!!evs. evs : otway lost ==> \
|
|
313 |
\ EX A' B' NA' NB'. ALL A B NA NB. \
|
|
314 |
\ Says Server B \
|
|
315 |
\ {|Crypt {|NA, Agent A, Agent B, K|} (shrK A), \
|
|
316 |
\ Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs \
|
|
317 |
\ --> A=A' & B=B' & NA=NA' & NB=NB'";
|
|
318 |
by (etac otway.induct 1);
|
|
319 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
|
|
320 |
by (Step_tac 1);
|
|
321 |
(*Remaining cases: OR3 and OR4*)
|
|
322 |
by (ex_strip_tac 2);
|
|
323 |
by (Fast_tac 2);
|
|
324 |
by (expand_case_tac "K = ?y" 1);
|
|
325 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
|
|
326 |
(*...we assume X is a very new message, and handle this case by contradiction*)
|
|
327 |
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
|
|
328 |
delrules [conjI] (*prevent split-up into 4 subgoals*)
|
|
329 |
addss (!simpset addsimps [parts_insertI])) 1);
|
|
330 |
val lemma = result();
|
|
331 |
|
|
332 |
|
|
333 |
goal thy
|
|
334 |
"!!evs. [| Says Server B \
|
|
335 |
\ {|Crypt {|NA, Agent A, Agent B, K|} (shrK A), \
|
|
336 |
\ Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} \
|
|
337 |
\ : set_of_list evs; \
|
|
338 |
\ Says Server B' \
|
|
339 |
\ {|Crypt {|NA', Agent A', Agent B', K|} (shrK A'), \
|
|
340 |
\ Crypt {|NB', Agent A', Agent B', K|} (shrK B')|} \
|
|
341 |
\ : set_of_list evs; \
|
|
342 |
\ evs : otway lost |] \
|
|
343 |
\ ==> A=A' & B=B' & NA=NA' & NB=NB'";
|
|
344 |
by (dtac lemma 1);
|
|
345 |
by (REPEAT (etac exE 1));
|
|
346 |
(*Duplicate the assumption*)
|
|
347 |
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
|
|
348 |
by (fast_tac (!claset addSDs [spec]) 1);
|
|
349 |
qed "unique_session_keys";
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
(**** Authenticity properties relating to NA ****)
|
|
354 |
|
|
355 |
(*If the encrypted message appears then it originated with the Server!*)
|
|
356 |
goal thy
|
|
357 |
"!!evs. [| A ~: lost; evs : otway lost |] \
|
|
358 |
\ ==> Crypt {|NA, Agent A, Agent B, Key K|} (shrK A) \
|
|
359 |
\ : parts (sees lost Spy evs) \
|
|
360 |
\ --> (EX NB. Says Server B \
|
|
361 |
\ {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A), \
|
|
362 |
\ Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
363 |
\ : set_of_list evs)";
|
|
364 |
by (parts_induct_tac 1);
|
|
365 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
|
|
366 |
(*OR3*)
|
|
367 |
by (Fast_tac 1);
|
|
368 |
qed_spec_mp "NA_Crypt_imp_Server_msg";
|
|
369 |
|
|
370 |
|
|
371 |
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
|
|
372 |
then the key really did come from the Server! CANNOT prove this of the
|
|
373 |
bad form of this protocol, even though we can prove
|
2106
|
374 |
Spy_not_see_encrypted_key. (We can implicitly infer freshness of
|
|
375 |
the Server's message from its nonce NA.)*)
|
2090
|
376 |
goal thy
|
|
377 |
"!!evs. [| Says B' A (Crypt {|NA, Agent A, Agent B, Key K|} (shrK A)) \
|
|
378 |
\ : set_of_list evs; \
|
|
379 |
\ A ~: lost; evs : otway lost |] \
|
|
380 |
\ ==> EX NB. Says Server B \
|
|
381 |
\ {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A), \
|
|
382 |
\ Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
383 |
\ : set_of_list evs";
|
|
384 |
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
|
|
385 |
addEs partsEs
|
|
386 |
addDs [Says_imp_sees_Spy RS parts.Inj]) 1);
|
|
387 |
qed "A_trust_OR4";
|
|
388 |
|
|
389 |
|
|
390 |
(*Describes the form of K and NA when the Server sends this message.*)
|
|
391 |
goal thy
|
|
392 |
"!!evs. [| Says Server B \
|
|
393 |
\ {|Crypt {|NA, Agent A, Agent B, K|} (shrK A), \
|
|
394 |
\ Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
|
|
395 |
\ evs : otway lost |] \
|
|
396 |
\ ==> (EX evt: otway lost. K = Key(newK evt)) & \
|
|
397 |
\ (EX i. NA = Nonce i) & \
|
|
398 |
\ (EX j. NB = Nonce j)";
|
|
399 |
by (etac rev_mp 1);
|
|
400 |
by (etac otway.induct 1);
|
|
401 |
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
|
|
402 |
qed "Says_Server_message_form";
|
|
403 |
|
|
404 |
|
|
405 |
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
|
|
406 |
Does not in itself guarantee security: an attack could violate
|
|
407 |
the premises, e.g. by having A=Spy **)
|
|
408 |
|
|
409 |
goal thy
|
|
410 |
"!!evs. [| A ~: lost; B ~: lost; evs : otway lost; evt : otway lost |] \
|
|
411 |
\ ==> Says Server B \
|
|
412 |
\ {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A), \
|
|
413 |
\ Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
414 |
\ : set_of_list evs --> \
|
|
415 |
\ Says A Spy {|NA, Key K|} ~: set_of_list evs --> \
|
|
416 |
\ Key K ~: analz (sees lost Spy evs)";
|
|
417 |
by (etac otway.induct 1);
|
|
418 |
by analz_Fake_tac;
|
|
419 |
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
|
|
420 |
by (ALLGOALS
|
|
421 |
(asm_full_simp_tac
|
|
422 |
(!simpset addsimps ([analz_subset_parts RS contra_subsetD,
|
|
423 |
analz_insert_Key_newK] @ pushes)
|
|
424 |
setloop split_tac [expand_if])));
|
|
425 |
(** LEVEL 4 **)
|
|
426 |
(*OR3*)
|
|
427 |
by (fast_tac (!claset addSIs [parts_insertI]
|
|
428 |
addEs [Says_imp_old_keys RS less_irrefl]
|
|
429 |
addss (!simpset addsimps [parts_insert2])) 2);
|
|
430 |
(*Reveal case 2, OR4, Fake*)
|
|
431 |
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
|
|
432 |
(*Reveal case 1*) (** LEVEL 6 **)
|
2106
|
433 |
by (case_tac "Aa : lost" 1);
|
2090
|
434 |
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
|
2106
|
435 |
by (dtac (Says_imp_sees_Spy RS analz.Inj) 1);
|
|
436 |
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
|
2090
|
437 |
(*So now we have Aa ~: lost *)
|
|
438 |
by (dtac A_trust_OR4 1);
|
|
439 |
by (REPEAT (assume_tac 1));
|
|
440 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
|
|
441 |
val lemma = result() RS mp RS mp RSN(2,rev_notE);
|
|
442 |
|
|
443 |
goal thy
|
2106
|
444 |
"!!evs. [| Says Server B \
|
|
445 |
\ {|Crypt {|NA, Agent A, Agent B, K|} (shrK A), \
|
2090
|
446 |
\ Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
|
|
447 |
\ Says A Spy {|NA, K|} ~: set_of_list evs; \
|
|
448 |
\ A ~: lost; B ~: lost; evs : otway lost |] \
|
|
449 |
\ ==> K ~: analz (sees lost Spy evs)";
|
|
450 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
|
|
451 |
by (fast_tac (!claset addSEs [lemma]) 1);
|
|
452 |
qed "Spy_not_see_encrypted_key";
|
|
453 |
|
|
454 |
|
|
455 |
goal thy
|
2106
|
456 |
"!!evs. [| C ~: {A,B,Server}; \
|
|
457 |
\ Says Server B \
|
|
458 |
\ {|Crypt {|NA, Agent A, Agent B, K|} (shrK A), \
|
2090
|
459 |
\ Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
|
|
460 |
\ Says A Spy {|NA, K|} ~: set_of_list evs; \
|
|
461 |
\ A ~: lost; B ~: lost; evs : otway lost |] \
|
|
462 |
\ ==> K ~: analz (sees lost C evs)";
|
|
463 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
|
|
464 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
|
|
465 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
|
|
466 |
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
|
|
467 |
qed "Agent_not_see_encrypted_key";
|
|
468 |
|
|
469 |
|
|
470 |
(**** Authenticity properties relating to NB ****)
|
|
471 |
|
|
472 |
(*If the encrypted message appears then it originated with the Server!*)
|
|
473 |
goal thy
|
2106
|
474 |
"!!evs. [| B ~: lost; evs : otway lost |] \
|
|
475 |
\ ==> Crypt {|NB, Agent A, Agent B, Key K|} (shrK B) \
|
|
476 |
\ : parts (sees lost Spy evs) \
|
2090
|
477 |
\ --> (EX NA. Says Server B \
|
|
478 |
\ {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A), \
|
|
479 |
\ Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
480 |
\ : set_of_list evs)";
|
|
481 |
by (parts_induct_tac 1);
|
|
482 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
|
|
483 |
(*OR3*)
|
|
484 |
by (Fast_tac 1);
|
|
485 |
qed_spec_mp "NB_Crypt_imp_Server_msg";
|
|
486 |
|
|
487 |
|
|
488 |
(*Guarantee for B: if it gets a message with matching NB then the Server
|
|
489 |
has sent the correct message.*)
|
|
490 |
goal thy
|
2106
|
491 |
"!!evs. [| B ~: lost; evs : otway lost; \
|
|
492 |
\ Says S B {|X, Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
493 |
\ : set_of_list evs |] \
|
|
494 |
\ ==> EX NA. Says Server B \
|
2090
|
495 |
\ {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A), \
|
|
496 |
\ Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
|
|
497 |
\ : set_of_list evs";
|
|
498 |
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
|
|
499 |
addEs partsEs
|
|
500 |
addDs [Says_imp_sees_Spy RS parts.Inj]) 1);
|
|
501 |
qed "B_trust_OR3";
|