author | paulson |
Thu, 24 Oct 1996 10:31:17 +0200 | |
changeset 2122 | cb302f6c9c06 |
parent 2103 | bfd2e8cca89c |
child 2131 | 3106a99d30a5 |
permissions | -rw-r--r-- |
1934 | 1 |
(* Title: HOL/Auth/NS_Shared |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "ns_shared" for Needham-Schroeder Shared-Key protocol. |
|
7 |
||
8 |
From page 247 of |
|
9 |
Burrows, Abadi and Needham. A Logic of Authentication. |
|
10 |
Proc. Royal Soc. 426 (1989) |
|
11 |
*) |
|
12 |
||
13 |
open NS_Shared; |
|
14 |
||
1943 | 15 |
proof_timing:=true; |
1997 | 16 |
HOL_quantifiers := false; |
17 |
||
18 |
||
2015 | 19 |
(*Weak liveness: there are traces that reach the end*) |
1997 | 20 |
goal thy |
21 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
2032 | 22 |
\ ==> EX N K. EX evs: ns_shared lost. \ |
1997 | 23 |
\ Says A B (Crypt {|Nonce N, Nonce N|} K) : set_of_list evs"; |
24 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
2032 | 25 |
by (rtac (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2); |
1997 | 26 |
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver))); |
27 |
by (REPEAT_FIRST (resolve_tac [refl, conjI])); |
|
28 |
by (ALLGOALS (fast_tac (!claset addss (!simpset setsolver safe_solver)))); |
|
2015 | 29 |
result(); |
30 |
||
1943 | 31 |
|
1934 | 32 |
(**** Inductive proofs about ns_shared ****) |
33 |
||
2103 | 34 |
(*Monotonicity*) |
2032 | 35 |
goal thy "!!evs. lost' <= lost ==> ns_shared lost' <= ns_shared lost"; |
36 |
by (rtac subsetI 1); |
|
37 |
by (etac ns_shared.induct 1); |
|
38 |
by (REPEAT_FIRST |
|
39 |
(best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono) |
|
40 |
:: ns_shared.intrs)))); |
|
41 |
qed "ns_shared_mono"; |
|
42 |
||
43 |
||
1934 | 44 |
(*Nobody sends themselves messages*) |
2032 | 45 |
goal thy "!!evs. evs : ns_shared lost ==> ALL A X. Says A A X ~: set_of_list evs"; |
46 |
by (etac ns_shared.induct 1); |
|
1934 | 47 |
by (Auto_tac()); |
48 |
qed_spec_mp "not_Says_to_self"; |
|
49 |
Addsimps [not_Says_to_self]; |
|
50 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
51 |
||
1943 | 52 |
(*For reasoning about the encrypted portion of message NS3*) |
1934 | 53 |
goal thy "!!evs. (Says S A (Crypt {|N, B, K, X|} KA)) : set_of_list evs ==> \ |
2032 | 54 |
\ X : parts (sees lost Spy evs)"; |
1934 | 55 |
by (fast_tac (!claset addSEs partsEs |
2032 | 56 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
57 |
qed "NS3_msg_in_parts_sees_Spy"; |
|
58 |
||
2070 | 59 |
goal thy |
60 |
"!!evs. Says S A (Crypt {|NA, B, K, X|} (shrK A)) : set_of_list evs ==> \ |
|
61 |
\ K : parts (sees lost Spy evs)"; |
|
62 |
by (fast_tac (!claset addSEs partsEs |
|
63 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
|
64 |
qed "Reveal_parts_sees_Spy"; |
|
65 |
||
2032 | 66 |
val parts_Fake_tac = |
2070 | 67 |
dres_inst_tac [("lost","lost")] NS3_msg_in_parts_sees_Spy 5 THEN |
68 |
forw_inst_tac [("lost","lost")] Reveal_parts_sees_Spy 8; |
|
69 |
||
70 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *) |
|
71 |
fun parts_induct_tac i = SELECT_GOAL |
|
72 |
(DETERM (etac ns_shared.induct 1 THEN parts_Fake_tac THEN |
|
73 |
(*Fake message*) |
|
74 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
75 |
impOfSubs Fake_parts_insert] |
|
76 |
addss (!simpset)) 2)) THEN |
|
77 |
(*Base case*) |
|
78 |
fast_tac (!claset addss (!simpset)) 1 THEN |
|
79 |
ALLGOALS Asm_simp_tac) i; |
|
80 |
||
1934 | 81 |
|
2032 | 82 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY |
2015 | 83 |
sends messages containing X! **) |
1934 | 84 |
|
2103 | 85 |
(*Spy never sees another agent's shared key!*) |
1934 | 86 |
goal thy |
2032 | 87 |
"!!evs. [| evs : ns_shared lost; A ~: lost |] \ |
88 |
\ ==> Key (shrK A) ~: parts (sees lost Spy evs)"; |
|
2070 | 89 |
by (parts_induct_tac 1); |
1934 | 90 |
by (Auto_tac()); |
2032 | 91 |
qed "Spy_not_see_shrK"; |
1934 | 92 |
|
2032 | 93 |
bind_thm ("Spy_not_analz_shrK", |
94 |
[analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD); |
|
1934 | 95 |
|
2032 | 96 |
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK]; |
1934 | 97 |
|
1965 | 98 |
(*We go to some trouble to preserve R in the 3rd and 4th subgoals |
1967 | 99 |
As usual fast_tac cannot be used because it uses the equalities too soon*) |
1934 | 100 |
val major::prems = |
2032 | 101 |
goal thy "[| Key (shrK A) : parts (sees lost Spy evs); \ |
102 |
\ evs : ns_shared lost; \ |
|
103 |
\ A:lost ==> R \ |
|
1934 | 104 |
\ |] ==> R"; |
2032 | 105 |
by (rtac ccontr 1); |
106 |
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1); |
|
1934 | 107 |
by (swap_res_tac prems 2); |
1967 | 108 |
by (ALLGOALS (fast_tac (!claset addIs prems))); |
2032 | 109 |
qed "Spy_see_shrK_E"; |
1934 | 110 |
|
2032 | 111 |
bind_thm ("Spy_analz_shrK_E", |
112 |
analz_subset_parts RS subsetD RS Spy_see_shrK_E); |
|
1934 | 113 |
|
2032 | 114 |
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E]; |
1934 | 115 |
|
116 |
||
117 |
goal thy |
|
2032 | 118 |
"!!evs. evs : ns_shared lost ==> \ |
119 |
\ (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
2027 | 120 |
by (best_tac (!claset addIs [impOfSubs (subset_insertI RS analz_mono)] |
2032 | 121 |
addss (!simpset)) 1); |
1943 | 122 |
qed "shrK_mem_analz"; |
1934 | 123 |
|
1967 | 124 |
Addsimps [shrK_mem_analz]; |
125 |
||
1934 | 126 |
|
2070 | 127 |
|
1934 | 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 length comparison, and Union over C, are essential for the |
|
135 |
induction! *) |
|
2032 | 136 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
1934 | 137 |
\ length evs <= length evs' --> \ |
2032 | 138 |
\ Key (newK evs') ~: (UN C. parts (sees lost C evs))"; |
2070 | 139 |
by (parts_induct_tac 1); |
2015 | 140 |
by (ALLGOALS (fast_tac (!claset addDs [impOfSubs analz_subset_parts, |
2032 | 141 |
impOfSubs parts_insert_subset_Un, |
142 |
Suc_leD] |
|
143 |
addss (!simpset)))); |
|
1934 | 144 |
val lemma = result(); |
145 |
||
146 |
(*Variant needed for the main theorem below*) |
|
147 |
goal thy |
|
2032 | 148 |
"!!evs. [| evs : ns_shared lost; length evs <= length evs' |] \ |
149 |
\ ==> Key (newK evs') ~: parts (sees lost C evs)"; |
|
1934 | 150 |
by (fast_tac (!claset addDs [lemma]) 1); |
151 |
qed "new_keys_not_seen"; |
|
152 |
Addsimps [new_keys_not_seen]; |
|
153 |
||
154 |
(*Another variant: old messages must contain old keys!*) |
|
155 |
goal thy |
|
156 |
"!!evs. [| Says A B X : set_of_list evs; \ |
|
157 |
\ Key (newK evt) : parts {X}; \ |
|
2032 | 158 |
\ evs : ns_shared lost \ |
1934 | 159 |
\ |] ==> length evt < length evs"; |
2032 | 160 |
by (rtac ccontr 1); |
161 |
by (dtac leI 1); |
|
162 |
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy] |
|
2015 | 163 |
addIs [impOfSubs parts_mono]) 1); |
1934 | 164 |
qed "Says_imp_old_keys"; |
165 |
||
166 |
||
2070 | 167 |
|
168 |
(*** Future nonces can't be seen or used! [proofs resemble those above] ***) |
|
169 |
||
170 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
|
171 |
\ length evs <= length evt --> \ |
|
172 |
\ Nonce (newN evt) ~: (UN C. parts (sees lost C evs))"; |
|
173 |
by (etac ns_shared.induct 1); |
|
174 |
(*auto_tac does not work here, as it performs safe_tac first*) |
|
175 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2] |
|
176 |
addcongs [disj_cong]))); |
|
177 |
by (REPEAT_FIRST (fast_tac (!claset |
|
178 |
addSEs partsEs |
|
179 |
addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
180 |
addDs [impOfSubs analz_subset_parts, |
|
181 |
impOfSubs parts_insert_subset_Un, |
|
182 |
Suc_leD] |
|
183 |
addss (!simpset)))); |
|
184 |
val lemma = result(); |
|
185 |
||
186 |
(*Variant needed below*) |
|
187 |
goal thy |
|
188 |
"!!evs. [| evs : ns_shared lost; length evs <= length evs' |] \ |
|
189 |
\ ==> Nonce (newN evs') ~: parts (sees lost C evs)"; |
|
190 |
by (fast_tac (!claset addDs [lemma]) 1); |
|
191 |
qed "new_nonces_not_seen"; |
|
192 |
Addsimps [new_nonces_not_seen]; |
|
193 |
||
194 |
||
1934 | 195 |
(*Nobody can have USED keys that will be generated in the future. |
196 |
...very like new_keys_not_seen*) |
|
2032 | 197 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
1934 | 198 |
\ length evs <= length evs' --> \ |
2032 | 199 |
\ newK evs' ~: keysFor (UN C. parts (sees lost C evs))"; |
2070 | 200 |
by (parts_induct_tac 1); |
1934 | 201 |
(*NS1 and NS2*) |
2070 | 202 |
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [3,2])); |
1934 | 203 |
(*Fake and NS3*) |
2070 | 204 |
by (EVERY |
205 |
(map |
|
206 |
(best_tac |
|
207 |
(!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono), |
|
208 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono), |
|
209 |
Suc_leD] |
|
210 |
addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)] |
|
211 |
addss (!simpset))) |
|
212 |
[2,1])); |
|
1934 | 213 |
(*NS4 and NS5: nonce exchange*) |
1997 | 214 |
by (ALLGOALS (deepen_tac (!claset addSDs [Says_imp_old_keys] |
2032 | 215 |
addIs [less_SucI, impOfSubs keysFor_mono] |
2070 | 216 |
addss (!simpset addsimps [le_def])) 1)); |
1934 | 217 |
val lemma = result(); |
218 |
||
219 |
goal thy |
|
2032 | 220 |
"!!evs. [| evs : ns_shared lost; length evs <= length evs' |] \ |
221 |
\ ==> newK evs' ~: keysFor (parts (sees lost C evs))"; |
|
1934 | 222 |
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1); |
223 |
qed "new_keys_not_used"; |
|
224 |
||
225 |
bind_thm ("new_keys_not_analzd", |
|
2032 | 226 |
[analz_subset_parts RS keysFor_mono, |
227 |
new_keys_not_used] MRS contra_subsetD); |
|
1934 | 228 |
|
229 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
230 |
||
231 |
||
232 |
(** Lemmas concerning the form of items passed in messages **) |
|
233 |
||
2015 | 234 |
(*Describes the form of K, X and K' when the Server sends this message.*) |
1934 | 235 |
goal thy |
236 |
"!!evs. [| Says Server A (Crypt {|N, Agent B, K, X|} K') : set_of_list evs; \ |
|
2032 | 237 |
\ evs : ns_shared lost |] \ |
238 |
\ ==> (EX evt: ns_shared lost. \ |
|
2015 | 239 |
\ K = Key(newK evt) & \ |
240 |
\ X = (Crypt {|K, Agent A|} (shrK B)) & \ |
|
241 |
\ K' = shrK A)"; |
|
2032 | 242 |
by (etac rev_mp 1); |
243 |
by (etac ns_shared.induct 1); |
|
2015 | 244 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
1934 | 245 |
qed "Says_Server_message_form"; |
246 |
||
247 |
||
2070 | 248 |
(*If the encrypted message appears then it originated with the Server*) |
1934 | 249 |
goal thy |
2070 | 250 |
"!!evs. [| Crypt {|NA, Agent B, Key K, X|} (shrK A) \ |
251 |
\ : parts (sees lost Spy evs); \ |
|
252 |
\ A ~: lost; evs : ns_shared lost |] \ |
|
253 |
\ ==> X = (Crypt {|Key K, Agent A|} (shrK B)) & \ |
|
254 |
\ Says Server A \ |
|
255 |
\ (Crypt {|NA, Agent B, Key K, \ |
|
256 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
257 |
\ : set_of_list evs"; |
|
258 |
by (etac rev_mp 1); |
|
2032 | 259 |
by (etac ns_shared.induct 1); |
260 |
by parts_Fake_tac; |
|
2015 | 261 |
(*Fake case*) |
1967 | 262 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert] |
2032 | 263 |
addDs [impOfSubs analz_subset_parts] |
264 |
addss (!simpset)) 2); |
|
2015 | 265 |
by (Auto_tac()); |
2070 | 266 |
qed "A_trust_NS2"; |
1934 | 267 |
|
1965 | 268 |
|
269 |
(*EITHER describes the form of X when the following message is sent, |
|
270 |
OR reduces it to the Fake case. |
|
271 |
Use Says_Server_message_form if applicable.*) |
|
1934 | 272 |
goal thy |
2070 | 273 |
"!!evs. [| Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A)) \ |
274 |
\ : set_of_list evs; evs : ns_shared lost |] \ |
|
275 |
\ ==> (EX evt: ns_shared lost. K = newK evt & \ |
|
276 |
\ length evt < length evs & \ |
|
277 |
\ X = (Crypt {|Key K, Agent A|} (shrK B))) \ |
|
278 |
\ | X : analz (sees lost Spy evs)"; |
|
2103 | 279 |
by (case_tac "A : lost" 1); |
2032 | 280 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
2103 | 281 |
addss (!simpset)) 1); |
2070 | 282 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj] 1); |
2015 | 283 |
by (fast_tac (!claset addEs partsEs |
2070 | 284 |
addSDs [A_trust_NS2, Says_Server_message_form] |
285 |
addIs [Says_imp_old_keys] |
|
286 |
addss (!simpset)) 1); |
|
1934 | 287 |
qed "Says_S_message_form"; |
288 |
||
289 |
||
290 |
||
291 |
(**** |
|
292 |
The following is to prove theorems of the form |
|
293 |
||
2032 | 294 |
Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==> |
295 |
Key K : analz (sees lost Spy evs) |
|
1934 | 296 |
|
297 |
A more general formula must be proved inductively. |
|
298 |
||
299 |
****) |
|
300 |
||
301 |
||
302 |
(*NOT useful in this form, but it says that session keys are not used |
|
303 |
to encrypt messages containing other keys, in the actual protocol. |
|
304 |
We require that agents should behave like this subsequently also.*) |
|
305 |
goal thy |
|
2032 | 306 |
"!!evs. evs : ns_shared lost ==> \ |
307 |
\ (Crypt X (newK evt)) : parts (sees lost Spy evs) & \ |
|
308 |
\ Key K : parts {X} --> Key K : parts (sees lost Spy evs)"; |
|
309 |
by (etac ns_shared.induct 1); |
|
310 |
by parts_Fake_tac; |
|
2070 | 311 |
by (ALLGOALS Asm_simp_tac); |
1934 | 312 |
(*Deals with Faked messages*) |
313 |
by (best_tac (!claset addSEs partsEs |
|
2032 | 314 |
addDs [impOfSubs parts_insert_subset_Un] |
1965 | 315 |
addss (!simpset)) 2); |
316 |
(*Base, NS4 and NS5*) |
|
1934 | 317 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
318 |
result(); |
|
319 |
||
320 |
||
321 |
(** Session keys are not used to encrypt other session keys **) |
|
322 |
||
2070 | 323 |
(*Describes the form of Key K when the following message is sent. The use of |
324 |
"parts" strengthens the induction hyp for proving the Fake case. The |
|
325 |
assumption A ~: lost prevents its being a Faked message. *) |
|
326 |
goal thy |
|
327 |
"!!evs. evs: ns_shared lost ==> \ |
|
328 |
\ Crypt {|NA, Agent B, Key K, X|} (shrK A) \ |
|
329 |
\ : parts (sees lost Spy evs) & A ~: lost \ |
|
330 |
\ --> (EX evt: ns_shared lost. K = newK evt)"; |
|
331 |
by (parts_induct_tac 1); |
|
332 |
by (Auto_tac()); |
|
333 |
val lemma = result() RS mp; |
|
334 |
||
335 |
||
336 |
(*EITHER describes the form of Key K when the following message is sent, |
|
337 |
OR reduces it to the Fake case.*) |
|
338 |
goal thy |
|
339 |
"!!evs. [| Says S A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
340 |
\ : set_of_list evs; \ |
|
341 |
\ evs : ns_shared lost |] \ |
|
342 |
\ ==> (EX evt: ns_shared lost. K = newK evt) \ |
|
343 |
\ | Key K : analz (sees lost Spy evs)"; |
|
2103 | 344 |
by (case_tac "A : lost" 1); |
2070 | 345 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
2103 | 346 |
addss (!simpset)) 1); |
2070 | 347 |
by (forward_tac [lemma] 1); |
348 |
by (fast_tac (!claset addEs partsEs |
|
349 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
|
350 |
by (Fast_tac 1); |
|
351 |
qed "Reveal_message_form"; |
|
352 |
||
2015 | 353 |
(*The equality makes the induction hypothesis easier to apply*) |
1934 | 354 |
goal thy |
2032 | 355 |
"!!evs. evs : ns_shared lost ==> \ |
356 |
\ ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \ |
|
357 |
\ (K : newK``E | Key K : analz (sees lost Spy evs))"; |
|
358 |
by (etac ns_shared.induct 1); |
|
359 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
2070 | 360 |
by (dtac Reveal_message_form 8); |
361 |
by (REPEAT_FIRST (eresolve_tac [bexE, conjE, disjE] ORELSE' hyp_subst_tac)); |
|
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
362 |
by (REPEAT_FIRST (resolve_tac [allI, analz_image_newK_lemma])); |
1934 | 363 |
by (ALLGOALS |
364 |
(asm_simp_tac |
|
365 |
(!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK] |
|
2032 | 366 |
@ pushes) |
1934 | 367 |
setloop split_tac [expand_if]))); |
2070 | 368 |
(** LEVEL 6 **) |
369 |
(*Reveal case 2, NS3, Fake*) |
|
370 |
by (EVERY (map spy_analz_tac [7,5,2])); |
|
371 |
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1)); |
|
372 |
(*NS3, NS2, Base*) |
|
1934 | 373 |
by (REPEAT (Fast_tac 3)); |
374 |
qed_spec_mp "analz_image_newK"; |
|
375 |
||
376 |
||
377 |
goal thy |
|
2032 | 378 |
"!!evs. evs : ns_shared lost ==> \ |
379 |
\ Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \ |
|
380 |
\ (K = newK evt | Key K : analz (sees lost Spy evs))"; |
|
1934 | 381 |
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, |
2032 | 382 |
insert_Key_singleton]) 1); |
1934 | 383 |
by (Fast_tac 1); |
384 |
qed "analz_insert_Key_newK"; |
|
385 |
||
386 |
||
2015 | 387 |
(** The session key K uniquely identifies the message, if encrypted |
388 |
with a secure key **) |
|
1965 | 389 |
|
1934 | 390 |
goal thy |
2070 | 391 |
"!!evs. evs : ns_shared lost ==> \ |
392 |
\ EX A' NA' B' X'. ALL A NA B X. \ |
|
393 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
394 |
\ : set_of_list evs --> A=A' & NA=NA' & B=B' & X=X'"; |
|
2032 | 395 |
by (etac ns_shared.induct 1); |
396 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
2070 | 397 |
by (REPEAT_FIRST (eresolve_tac [conjE, bexE, disjE] ORELSE' hyp_subst_tac)); |
398 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
399 |
by (step_tac (!claset delrules [conjI]) 1); |
|
400 |
(*NS3*) |
|
401 |
by (ex_strip_tac 2); |
|
402 |
by (Fast_tac 2); |
|
403 |
(*NS2: it can't be a new key*) |
|
404 |
by (expand_case_tac "K = ?y" 1); |
|
405 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); |
|
406 |
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl] |
|
407 |
delrules [conjI] (*prevent split-up into 4 subgoals*) |
|
408 |
addss (!simpset addsimps [parts_insertI])) 1); |
|
1934 | 409 |
val lemma = result(); |
410 |
||
411 |
(*In messages of this form, the session key uniquely identifies the rest*) |
|
412 |
goal thy |
|
2070 | 413 |
"!!evs. [| Says Server A \ |
414 |
\ (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
415 |
\ : set_of_list evs; \ |
|
416 |
\ Says Server A' \ |
|
417 |
\ (Crypt {|NA', Agent B', Key K, X'|} (shrK A')) \ |
|
418 |
\ : set_of_list evs; \ |
|
419 |
\ evs : ns_shared lost |] ==> A=A' & NA=NA' & B=B' & X = X'"; |
|
2032 | 420 |
by (dtac lemma 1); |
2070 | 421 |
by (REPEAT (etac exE 1)); |
1965 | 422 |
(*Duplicate the assumption*) |
2070 | 423 |
by (forw_inst_tac [("psi", "ALL A.?P(A)")] asm_rl 1); |
424 |
by (fast_tac (!claset addSDs [ spec] |
|
425 |
delrules [conjI] addss (!simpset)) 1); |
|
1934 | 426 |
qed "unique_session_keys"; |
427 |
||
428 |
||
2032 | 429 |
(** Crucial secrecy property: Spy does not see the keys sent in msg NS2 **) |
2015 | 430 |
|
1934 | 431 |
goal thy |
2032 | 432 |
"!!evs. [| A ~: lost; B ~: lost; \ |
433 |
\ evs : ns_shared lost; evt: ns_shared lost |] \ |
|
2015 | 434 |
\ ==> Says Server A \ |
2070 | 435 |
\ (Crypt {|NA, Agent B, Key K, \ |
436 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
437 |
\ : set_of_list evs --> \ |
|
438 |
\ (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs) --> \ |
|
2050
1b3343fa1278
Moved sees_lost_agent_subset_sees_Spy to common file, and simplified main thm
paulson
parents:
2045
diff
changeset
|
439 |
\ Key K ~: analz (sees lost Spy evs)"; |
2032 | 440 |
by (etac ns_shared.induct 1); |
2070 | 441 |
by (forward_tac [Reveal_message_form] 8); |
442 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
443 |
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac)); |
|
1934 | 444 |
by (ALLGOALS |
2015 | 445 |
(asm_simp_tac |
1934 | 446 |
(!simpset addsimps ([analz_subset_parts RS contra_subsetD, |
2032 | 447 |
analz_insert_Key_newK] @ pushes) |
1934 | 448 |
setloop split_tac [expand_if]))); |
449 |
(*NS2*) |
|
2015 | 450 |
by (fast_tac (!claset addIs [parts_insertI] |
2032 | 451 |
addEs [Says_imp_old_keys RS less_irrefl] |
452 |
addss (!simpset)) 2); |
|
2070 | 453 |
(*Revl case 2, OR4, OR2, Fake*) |
454 |
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac)); |
|
455 |
(*NS3 and Revl subcases*) (**LEVEL 7 **) |
|
456 |
by (step_tac (!claset delrules [impCE]) 1); |
|
457 |
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 2); |
|
458 |
be conjE 2; |
|
459 |
by (mp_tac 2); |
|
460 |
(**LEVEL 11 **) |
|
461 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 2); |
|
462 |
ba 3; |
|
463 |
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 2); |
|
464 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 2); |
|
465 |
(*NS3*) |
|
466 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 1); |
|
467 |
ba 2; |
|
468 |
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 1); |
|
469 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1); |
|
470 |
val lemma = result() RS mp RS mp RSN(2,rev_notE); |
|
2015 | 471 |
|
472 |
||
473 |
(*Final version: Server's message in the most abstract form*) |
|
474 |
goal thy |
|
2070 | 475 |
"!!evs. [| Says Server A \ |
476 |
\ (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs; \ |
|
477 |
\ (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs); \ |
|
478 |
\ A ~: lost; B ~: lost; evs : ns_shared lost \ |
|
479 |
\ |] ==> K ~: analz (sees lost Spy evs)"; |
|
2015 | 480 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); |
481 |
by (fast_tac (!claset addSEs [lemma]) 1); |
|
2032 | 482 |
qed "Spy_not_see_encrypted_key"; |
483 |
||
484 |
||
485 |
goal thy |
|
2070 | 486 |
"!!evs. [| C ~: {A,B,Server}; \ |
487 |
\ Says Server A \ |
|
488 |
\ (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs; \ |
|
489 |
\ (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs); \ |
|
490 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
|
2032 | 491 |
\ ==> K ~: analz (sees lost C evs)"; |
492 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1); |
|
493 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1); |
|
494 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key)); |
|
495 |
by (REPEAT_FIRST (fast_tac (!claset addIs [ns_shared_mono RS subsetD]))); |
|
496 |
qed "Agent_not_see_encrypted_key"; |
|
2070 | 497 |
|
498 |
||
499 |
||
500 |
(**** Guarantees available at various stages of protocol ***) |
|
501 |
||
502 |
A_trust_NS2 RS conjunct2 RS Spy_not_see_encrypted_key; |
|
503 |
||
504 |
||
505 |
(*If the encrypted message appears then it originated with the Server*) |
|
506 |
goal thy |
|
507 |
"!!evs. [| Crypt {|Key K, Agent A|} (shrK B) : parts (sees lost Spy evs); \ |
|
508 |
\ B ~: lost; evs : ns_shared lost |] \ |
|
509 |
\ ==> EX NA. Says Server A \ |
|
510 |
\ (Crypt {|NA, Agent B, Key K, \ |
|
511 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
512 |
\ : set_of_list evs"; |
|
513 |
by (etac rev_mp 1); |
|
514 |
by (etac ns_shared.induct 1); |
|
515 |
by parts_Fake_tac; |
|
516 |
(*Fake case*) |
|
517 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert] |
|
518 |
addDs [impOfSubs analz_subset_parts] |
|
519 |
addss (!simpset)) 2); |
|
520 |
by (Auto_tac()); |
|
521 |
qed "B_trust_NS3"; |
|
522 |
||
523 |
||
524 |
goal thy |
|
2103 | 525 |
"!!evs. [| B ~: lost; evs : ns_shared lost |] \ |
526 |
\ ==> Key K ~: analz (sees lost Spy evs) --> \ |
|
527 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
528 |
\ : set_of_list evs --> \ |
|
529 |
\ Crypt (Nonce NB) K : parts (sees lost Spy evs) --> \ |
|
530 |
\ Says B A (Crypt (Nonce NB) K) : set_of_list evs"; |
|
2070 | 531 |
by (etac ns_shared.induct 1); |
532 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
533 |
by parts_Fake_tac; |
|
2103 | 534 |
by (TRYALL (rtac impI)); |
535 |
by (REPEAT_FIRST |
|
536 |
(dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD))); |
|
537 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
538 |
(**LEVEL 6**) |
|
539 |
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert] |
|
540 |
addDs [impOfSubs analz_subset_parts]) 1); |
|
541 |
by (Fast_tac 2); |
|
542 |
by (REPEAT_FIRST (rtac impI ORELSE' etac conjE ORELSE' hyp_subst_tac)); |
|
2070 | 543 |
(*Contradiction from the assumption |
544 |
Crypt (Nonce NB) (newK evsa) : parts (sees lost Spy evsa) *) |
|
545 |
bd Crypt_imp_invKey_keysFor 1; |
|
2103 | 546 |
(**LEVEL 10**) |
2070 | 547 |
by (Asm_full_simp_tac 1); |
2103 | 548 |
br disjI1 1; |
2070 | 549 |
by (thin_tac "?PP-->?QQ" 1); |
550 |
by (case_tac "Ba : lost" 1); |
|
551 |
by (dtac Says_Crypt_lost 1 THEN assume_tac 1 THEN Fast_tac 1); |
|
552 |
by (dtac (Says_imp_sees_Spy RS parts.Inj RS B_trust_NS3) 1 THEN |
|
553 |
REPEAT (assume_tac 1)); |
|
2103 | 554 |
by (fast_tac (!claset addDs [unique_session_keys]) 1); |
555 |
val lemma = result(); |
|
556 |
||
557 |
goal thy |
|
558 |
"!!evs. [| Crypt (Nonce NB) K : parts (sees lost Spy evs); \ |
|
559 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
560 |
\ : set_of_list evs; \ |
|
561 |
\ ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs; \ |
|
562 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
|
563 |
\ ==> Says B A (Crypt (Nonce NB) K) : set_of_list evs"; |
|
564 |
by (fast_tac (!claset addSIs [lemma RS mp RS mp RS mp] |
|
565 |
addSEs [Spy_not_see_encrypted_key RSN (2, rev_notE)]) 1); |
|
2070 | 566 |
qed "A_trust_NS4"; |