author | paulson |
Thu, 07 Nov 1996 10:15:57 +0100 | |
changeset 2165 | 63dfe7f19cad |
parent 2160 | ad4382e546fc |
child 2170 | c5e460f1ebb4 |
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*) |
2131 | 53 |
goal thy "!!evs. Says S A (Crypt {|N, B, K, X|} KA) : set_of_list evs \ |
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 |
2131 | 60 |
"!!evs. Says Server A (Crypt {|NA, B, K, X|} (shrK A)) : set_of_list evs \ |
61 |
\ ==> K : parts (sees lost Spy evs)"; |
|
2070 | 62 |
by (fast_tac (!claset addSEs partsEs |
63 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
|
2131 | 64 |
qed "Oops_parts_sees_Spy"; |
2070 | 65 |
|
2032 | 66 |
val parts_Fake_tac = |
2070 | 67 |
dres_inst_tac [("lost","lost")] NS3_msg_in_parts_sees_Spy 5 THEN |
2131 | 68 |
forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 8; |
2070 | 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 |
|
2131 | 85 |
(*Spy never sees another agent's shared key! (unless it's lost at start)*) |
1934 | 86 |
goal thy |
2131 | 87 |
"!!evs. evs : ns_shared lost \ |
88 |
\ ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)"; |
|
2070 | 89 |
by (parts_induct_tac 1); |
1934 | 90 |
by (Auto_tac()); |
2131 | 91 |
qed "Spy_see_shrK"; |
92 |
Addsimps [Spy_see_shrK]; |
|
1934 | 93 |
|
2131 | 94 |
goal thy |
95 |
"!!evs. evs : ns_shared lost \ |
|
96 |
\ ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
97 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); |
|
98 |
qed "Spy_analz_shrK"; |
|
99 |
Addsimps [Spy_analz_shrK]; |
|
1934 | 100 |
|
2131 | 101 |
goal thy "!!A. [| Key (shrK A) : parts (sees lost Spy evs); \ |
102 |
\ evs : ns_shared lost |] ==> A:lost"; |
|
103 |
by (fast_tac (!claset addDs [Spy_see_shrK]) 1); |
|
104 |
qed "Spy_see_shrK_D"; |
|
1934 | 105 |
|
2131 | 106 |
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D); |
107 |
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D]; |
|
1934 | 108 |
|
2070 | 109 |
|
1934 | 110 |
(*** Future keys can't be seen or used! ***) |
111 |
||
2160 | 112 |
(*Nobody can have SEEN keys that will be generated in the future. *) |
113 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
|
1934 | 114 |
\ length evs <= length evs' --> \ |
2160 | 115 |
\ Key (newK evs') ~: parts (sees lost Spy evs)"; |
2070 | 116 |
by (parts_induct_tac 1); |
2015 | 117 |
by (ALLGOALS (fast_tac (!claset addDs [impOfSubs analz_subset_parts, |
2032 | 118 |
impOfSubs parts_insert_subset_Un, |
119 |
Suc_leD] |
|
120 |
addss (!simpset)))); |
|
2160 | 121 |
qed_spec_mp "new_keys_not_seen"; |
1934 | 122 |
Addsimps [new_keys_not_seen]; |
123 |
||
2160 | 124 |
(*Variant: old messages must contain old keys!*) |
1934 | 125 |
goal thy |
126 |
"!!evs. [| Says A B X : set_of_list evs; \ |
|
127 |
\ Key (newK evt) : parts {X}; \ |
|
2160 | 128 |
\ evs : ns_shared lost \ |
1934 | 129 |
\ |] ==> length evt < length evs"; |
2032 | 130 |
by (rtac ccontr 1); |
131 |
by (dtac leI 1); |
|
132 |
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy] |
|
2015 | 133 |
addIs [impOfSubs parts_mono]) 1); |
1934 | 134 |
qed "Says_imp_old_keys"; |
135 |
||
136 |
||
2070 | 137 |
|
2160 | 138 |
(*** Future nonces can't be seen or used! ***) |
2070 | 139 |
|
2160 | 140 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
2070 | 141 |
\ length evs <= length evt --> \ |
2160 | 142 |
\ Nonce (newN evt) ~: parts (sees lost Spy evs)"; |
143 |
by (parts_induct_tac 1); |
|
144 |
by (REPEAT_FIRST |
|
145 |
(fast_tac (!claset addSEs partsEs |
|
146 |
addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
147 |
addDs [impOfSubs analz_subset_parts, |
|
148 |
impOfSubs parts_insert_subset_Un, Suc_leD] |
|
149 |
addss (!simpset)))); |
|
150 |
qed_spec_mp "new_nonces_not_seen"; |
|
2070 | 151 |
Addsimps [new_nonces_not_seen]; |
152 |
||
153 |
||
1934 | 154 |
(*Nobody can have USED keys that will be generated in the future. |
155 |
...very like new_keys_not_seen*) |
|
2160 | 156 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
1934 | 157 |
\ length evs <= length evs' --> \ |
2160 | 158 |
\ newK evs' ~: keysFor (parts (sees lost Spy evs))"; |
2070 | 159 |
by (parts_induct_tac 1); |
1934 | 160 |
(*NS1 and NS2*) |
2070 | 161 |
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [3,2])); |
1934 | 162 |
(*Fake and NS3*) |
2070 | 163 |
by (EVERY |
164 |
(map |
|
165 |
(best_tac |
|
166 |
(!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono), |
|
167 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono), |
|
168 |
Suc_leD] |
|
169 |
addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)] |
|
170 |
addss (!simpset))) |
|
171 |
[2,1])); |
|
1934 | 172 |
(*NS4 and NS5: nonce exchange*) |
1997 | 173 |
by (ALLGOALS (deepen_tac (!claset addSDs [Says_imp_old_keys] |
2032 | 174 |
addIs [less_SucI, impOfSubs keysFor_mono] |
2070 | 175 |
addss (!simpset addsimps [le_def])) 1)); |
2160 | 176 |
qed_spec_mp "new_keys_not_used"; |
1934 | 177 |
|
178 |
bind_thm ("new_keys_not_analzd", |
|
2032 | 179 |
[analz_subset_parts RS keysFor_mono, |
180 |
new_keys_not_used] MRS contra_subsetD); |
|
1934 | 181 |
|
182 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
183 |
||
184 |
||
185 |
(** Lemmas concerning the form of items passed in messages **) |
|
186 |
||
2015 | 187 |
(*Describes the form of K, X and K' when the Server sends this message.*) |
1934 | 188 |
goal thy |
189 |
"!!evs. [| Says Server A (Crypt {|N, Agent B, K, X|} K') : set_of_list evs; \ |
|
2032 | 190 |
\ evs : ns_shared lost |] \ |
191 |
\ ==> (EX evt: ns_shared lost. \ |
|
2015 | 192 |
\ K = Key(newK evt) & \ |
193 |
\ X = (Crypt {|K, Agent A|} (shrK B)) & \ |
|
194 |
\ K' = shrK A)"; |
|
2032 | 195 |
by (etac rev_mp 1); |
196 |
by (etac ns_shared.induct 1); |
|
2015 | 197 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
1934 | 198 |
qed "Says_Server_message_form"; |
199 |
||
200 |
||
2070 | 201 |
(*If the encrypted message appears then it originated with the Server*) |
1934 | 202 |
goal thy |
2070 | 203 |
"!!evs. [| Crypt {|NA, Agent B, Key K, X|} (shrK A) \ |
204 |
\ : parts (sees lost Spy evs); \ |
|
205 |
\ A ~: lost; evs : ns_shared lost |] \ |
|
206 |
\ ==> X = (Crypt {|Key K, Agent A|} (shrK B)) & \ |
|
207 |
\ Says Server A \ |
|
208 |
\ (Crypt {|NA, Agent B, Key K, \ |
|
209 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
210 |
\ : set_of_list evs"; |
|
211 |
by (etac rev_mp 1); |
|
2131 | 212 |
by (parts_induct_tac 1); |
2015 | 213 |
by (Auto_tac()); |
2070 | 214 |
qed "A_trust_NS2"; |
1934 | 215 |
|
1965 | 216 |
|
217 |
(*EITHER describes the form of X when the following message is sent, |
|
218 |
OR reduces it to the Fake case. |
|
219 |
Use Says_Server_message_form if applicable.*) |
|
1934 | 220 |
goal thy |
2070 | 221 |
"!!evs. [| Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A)) \ |
222 |
\ : set_of_list evs; evs : ns_shared lost |] \ |
|
223 |
\ ==> (EX evt: ns_shared lost. K = newK evt & \ |
|
224 |
\ length evt < length evs & \ |
|
225 |
\ X = (Crypt {|Key K, Agent A|} (shrK B))) \ |
|
226 |
\ | X : analz (sees lost Spy evs)"; |
|
2103 | 227 |
by (case_tac "A : lost" 1); |
2032 | 228 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
2103 | 229 |
addss (!simpset)) 1); |
2070 | 230 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj] 1); |
2015 | 231 |
by (fast_tac (!claset addEs partsEs |
2070 | 232 |
addSDs [A_trust_NS2, Says_Server_message_form] |
233 |
addIs [Says_imp_old_keys] |
|
234 |
addss (!simpset)) 1); |
|
1934 | 235 |
qed "Says_S_message_form"; |
236 |
||
237 |
||
2131 | 238 |
(*For proofs involving analz. We again instantiate the variable to "lost".*) |
239 |
val analz_Fake_tac = |
|
240 |
forw_inst_tac [("lost","lost")] Says_Server_message_form 8 THEN |
|
241 |
forw_inst_tac [("lost","lost")] Says_S_message_form 5 THEN |
|
242 |
Full_simp_tac 7 THEN |
|
243 |
REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac); |
|
244 |
||
1934 | 245 |
|
246 |
(**** |
|
247 |
The following is to prove theorems of the form |
|
248 |
||
2032 | 249 |
Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==> |
250 |
Key K : analz (sees lost Spy evs) |
|
1934 | 251 |
|
252 |
A more general formula must be proved inductively. |
|
253 |
||
254 |
****) |
|
255 |
||
256 |
||
257 |
(*NOT useful in this form, but it says that session keys are not used |
|
258 |
to encrypt messages containing other keys, in the actual protocol. |
|
259 |
We require that agents should behave like this subsequently also.*) |
|
260 |
goal thy |
|
2032 | 261 |
"!!evs. evs : ns_shared lost ==> \ |
262 |
\ (Crypt X (newK evt)) : parts (sees lost Spy evs) & \ |
|
263 |
\ Key K : parts {X} --> Key K : parts (sees lost Spy evs)"; |
|
264 |
by (etac ns_shared.induct 1); |
|
265 |
by parts_Fake_tac; |
|
2070 | 266 |
by (ALLGOALS Asm_simp_tac); |
1934 | 267 |
(*Deals with Faked messages*) |
268 |
by (best_tac (!claset addSEs partsEs |
|
2032 | 269 |
addDs [impOfSubs parts_insert_subset_Un] |
1965 | 270 |
addss (!simpset)) 2); |
271 |
(*Base, NS4 and NS5*) |
|
1934 | 272 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
273 |
result(); |
|
274 |
||
275 |
||
276 |
(** Session keys are not used to encrypt other session keys **) |
|
277 |
||
2015 | 278 |
(*The equality makes the induction hypothesis easier to apply*) |
1934 | 279 |
goal thy |
2032 | 280 |
"!!evs. evs : ns_shared lost ==> \ |
281 |
\ ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \ |
|
282 |
\ (K : newK``E | Key K : analz (sees lost Spy evs))"; |
|
283 |
by (etac ns_shared.induct 1); |
|
2131 | 284 |
by analz_Fake_tac; |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
285 |
by (REPEAT_FIRST (resolve_tac [allI, analz_image_newK_lemma])); |
1934 | 286 |
by (ALLGOALS |
287 |
(asm_simp_tac |
|
288 |
(!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK] |
|
2032 | 289 |
@ pushes) |
1934 | 290 |
setloop split_tac [expand_if]))); |
2131 | 291 |
(*NS3, Fake*) |
292 |
by (EVERY (map spy_analz_tac [5,2])); |
|
2070 | 293 |
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1)); |
294 |
(*NS3, NS2, Base*) |
|
1934 | 295 |
by (REPEAT (Fast_tac 3)); |
296 |
qed_spec_mp "analz_image_newK"; |
|
297 |
||
298 |
||
299 |
goal thy |
|
2032 | 300 |
"!!evs. evs : ns_shared lost ==> \ |
301 |
\ Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \ |
|
302 |
\ (K = newK evt | Key K : analz (sees lost Spy evs))"; |
|
1934 | 303 |
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, |
2032 | 304 |
insert_Key_singleton]) 1); |
1934 | 305 |
by (Fast_tac 1); |
306 |
qed "analz_insert_Key_newK"; |
|
307 |
||
308 |
||
2015 | 309 |
(** The session key K uniquely identifies the message, if encrypted |
310 |
with a secure key **) |
|
1965 | 311 |
|
1934 | 312 |
goal thy |
2070 | 313 |
"!!evs. evs : ns_shared lost ==> \ |
314 |
\ EX A' NA' B' X'. ALL A NA B X. \ |
|
315 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
316 |
\ : set_of_list evs --> A=A' & NA=NA' & B=B' & X=X'"; |
|
2032 | 317 |
by (etac ns_shared.induct 1); |
2070 | 318 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
2131 | 319 |
by (Step_tac 1); |
2070 | 320 |
(*NS3*) |
321 |
by (ex_strip_tac 2); |
|
322 |
by (Fast_tac 2); |
|
323 |
(*NS2: it can't be a new key*) |
|
324 |
by (expand_case_tac "K = ?y" 1); |
|
325 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); |
|
326 |
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl] |
|
327 |
delrules [conjI] (*prevent split-up into 4 subgoals*) |
|
328 |
addss (!simpset addsimps [parts_insertI])) 1); |
|
1934 | 329 |
val lemma = result(); |
330 |
||
331 |
(*In messages of this form, the session key uniquely identifies the rest*) |
|
332 |
goal thy |
|
2070 | 333 |
"!!evs. [| Says Server A \ |
334 |
\ (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
335 |
\ : set_of_list evs; \ |
|
336 |
\ Says Server A' \ |
|
337 |
\ (Crypt {|NA', Agent B', Key K, X'|} (shrK A')) \ |
|
338 |
\ : set_of_list evs; \ |
|
339 |
\ evs : ns_shared lost |] ==> A=A' & NA=NA' & B=B' & X = X'"; |
|
2032 | 340 |
by (dtac lemma 1); |
2070 | 341 |
by (REPEAT (etac exE 1)); |
1965 | 342 |
(*Duplicate the assumption*) |
2070 | 343 |
by (forw_inst_tac [("psi", "ALL A.?P(A)")] asm_rl 1); |
344 |
by (fast_tac (!claset addSDs [ spec] |
|
345 |
delrules [conjI] addss (!simpset)) 1); |
|
1934 | 346 |
qed "unique_session_keys"; |
347 |
||
348 |
||
2032 | 349 |
(** Crucial secrecy property: Spy does not see the keys sent in msg NS2 **) |
2015 | 350 |
|
1934 | 351 |
goal thy |
2032 | 352 |
"!!evs. [| A ~: lost; B ~: lost; \ |
353 |
\ evs : ns_shared lost; evt: ns_shared lost |] \ |
|
2015 | 354 |
\ ==> Says Server A \ |
2070 | 355 |
\ (Crypt {|NA, Agent B, Key K, \ |
356 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
357 |
\ : set_of_list evs --> \ |
|
358 |
\ (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
|
359 |
\ Key K ~: analz (sees lost Spy evs)"; |
2032 | 360 |
by (etac ns_shared.induct 1); |
2131 | 361 |
by analz_Fake_tac; |
1934 | 362 |
by (ALLGOALS |
2015 | 363 |
(asm_simp_tac |
1934 | 364 |
(!simpset addsimps ([analz_subset_parts RS contra_subsetD, |
2032 | 365 |
analz_insert_Key_newK] @ pushes) |
1934 | 366 |
setloop split_tac [expand_if]))); |
367 |
(*NS2*) |
|
2015 | 368 |
by (fast_tac (!claset addIs [parts_insertI] |
2032 | 369 |
addEs [Says_imp_old_keys RS less_irrefl] |
370 |
addss (!simpset)) 2); |
|
2131 | 371 |
(*OR4, OR2, Fake*) |
2070 | 372 |
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac)); |
2131 | 373 |
(*NS3 and Oops subcases*) (**LEVEL 7 **) |
2070 | 374 |
by (step_tac (!claset delrules [impCE]) 1); |
375 |
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 2); |
|
376 |
be conjE 2; |
|
377 |
by (mp_tac 2); |
|
378 |
(**LEVEL 11 **) |
|
379 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 2); |
|
380 |
ba 3; |
|
381 |
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 2); |
|
382 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 2); |
|
383 |
(*NS3*) |
|
384 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 1); |
|
385 |
ba 2; |
|
386 |
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 1); |
|
387 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1); |
|
388 |
val lemma = result() RS mp RS mp RSN(2,rev_notE); |
|
2015 | 389 |
|
390 |
||
391 |
(*Final version: Server's message in the most abstract form*) |
|
392 |
goal thy |
|
2070 | 393 |
"!!evs. [| Says Server A \ |
394 |
\ (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs; \ |
|
395 |
\ (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs); \ |
|
396 |
\ A ~: lost; B ~: lost; evs : ns_shared lost \ |
|
397 |
\ |] ==> K ~: analz (sees lost Spy evs)"; |
|
2015 | 398 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); |
399 |
by (fast_tac (!claset addSEs [lemma]) 1); |
|
2032 | 400 |
qed "Spy_not_see_encrypted_key"; |
401 |
||
402 |
||
403 |
goal thy |
|
2070 | 404 |
"!!evs. [| C ~: {A,B,Server}; \ |
405 |
\ Says Server A \ |
|
406 |
\ (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs; \ |
|
407 |
\ (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs); \ |
|
408 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
|
2032 | 409 |
\ ==> K ~: analz (sees lost C evs)"; |
410 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1); |
|
411 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1); |
|
412 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key)); |
|
413 |
by (REPEAT_FIRST (fast_tac (!claset addIs [ns_shared_mono RS subsetD]))); |
|
414 |
qed "Agent_not_see_encrypted_key"; |
|
2070 | 415 |
|
416 |
||
417 |
||
418 |
(**** Guarantees available at various stages of protocol ***) |
|
419 |
||
420 |
A_trust_NS2 RS conjunct2 RS Spy_not_see_encrypted_key; |
|
421 |
||
422 |
||
423 |
(*If the encrypted message appears then it originated with the Server*) |
|
424 |
goal thy |
|
425 |
"!!evs. [| Crypt {|Key K, Agent A|} (shrK B) : parts (sees lost Spy evs); \ |
|
426 |
\ B ~: lost; evs : ns_shared lost |] \ |
|
427 |
\ ==> EX NA. Says Server A \ |
|
428 |
\ (Crypt {|NA, Agent B, Key K, \ |
|
429 |
\ Crypt {|Key K, Agent A|} (shrK B)|} (shrK A)) \ |
|
430 |
\ : set_of_list evs"; |
|
431 |
by (etac rev_mp 1); |
|
432 |
by (etac ns_shared.induct 1); |
|
433 |
by parts_Fake_tac; |
|
434 |
(*Fake case*) |
|
435 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert] |
|
436 |
addDs [impOfSubs analz_subset_parts] |
|
437 |
addss (!simpset)) 2); |
|
438 |
by (Auto_tac()); |
|
439 |
qed "B_trust_NS3"; |
|
440 |
||
441 |
||
442 |
goal thy |
|
2103 | 443 |
"!!evs. [| B ~: lost; evs : ns_shared lost |] \ |
444 |
\ ==> Key K ~: analz (sees lost Spy evs) --> \ |
|
445 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
|
446 |
\ : set_of_list evs --> \ |
|
447 |
\ Crypt (Nonce NB) K : parts (sees lost Spy evs) --> \ |
|
448 |
\ Says B A (Crypt (Nonce NB) K) : set_of_list evs"; |
|
2070 | 449 |
by (etac ns_shared.induct 1); |
450 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
451 |
by parts_Fake_tac; |
|
2103 | 452 |
by (TRYALL (rtac impI)); |
453 |
by (REPEAT_FIRST |
|
454 |
(dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD))); |
|
455 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
456 |
(**LEVEL 6**) |
|
457 |
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert] |
|
458 |
addDs [impOfSubs analz_subset_parts]) 1); |
|
459 |
by (Fast_tac 2); |
|
460 |
by (REPEAT_FIRST (rtac impI ORELSE' etac conjE ORELSE' hyp_subst_tac)); |
|
2070 | 461 |
(*Contradiction from the assumption |
462 |
Crypt (Nonce NB) (newK evsa) : parts (sees lost Spy evsa) *) |
|
463 |
bd Crypt_imp_invKey_keysFor 1; |
|
2103 | 464 |
(**LEVEL 10**) |
2070 | 465 |
by (Asm_full_simp_tac 1); |
2103 | 466 |
br disjI1 1; |
2070 | 467 |
by (thin_tac "?PP-->?QQ" 1); |
468 |
by (case_tac "Ba : lost" 1); |
|
469 |
by (dtac Says_Crypt_lost 1 THEN assume_tac 1 THEN Fast_tac 1); |
|
470 |
by (dtac (Says_imp_sees_Spy RS parts.Inj RS B_trust_NS3) 1 THEN |
|
471 |
REPEAT (assume_tac 1)); |
|
2103 | 472 |
by (fast_tac (!claset addDs [unique_session_keys]) 1); |
473 |
val lemma = result(); |
|
474 |
||
475 |
goal thy |
|
2131 | 476 |
"!!evs. [| Crypt (Nonce NB) K : parts (sees lost Spy evs); \ |
2103 | 477 |
\ Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A)) \ |
2131 | 478 |
\ : set_of_list evs; \ |
2103 | 479 |
\ ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs; \ |
2131 | 480 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
2103 | 481 |
\ ==> Says B A (Crypt (Nonce NB) K) : set_of_list evs"; |
482 |
by (fast_tac (!claset addSIs [lemma RS mp RS mp RS mp] |
|
483 |
addSEs [Spy_not_see_encrypted_key RSN (2, rev_notE)]) 1); |
|
2070 | 484 |
qed "A_trust_NS4"; |