120 lemma "\<exists>K NA. \<exists>evs \<in> recur. |
120 lemma "\<exists>K NA. \<exists>evs \<in> recur. |
121 Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|}, |
121 Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|}, |
122 END|} \<in> set evs" |
122 END|} \<in> set evs" |
123 apply (intro exI bexI) |
123 apply (intro exI bexI) |
124 apply (rule_tac [2] recur.Nil [THEN recur.RA1, |
124 apply (rule_tac [2] recur.Nil [THEN recur.RA1, |
125 THEN recur.RA3 [OF _ _ respond.One]]) |
125 THEN recur.RA3 [OF _ _ respond.One]], possibility) |
126 apply possibility |
|
127 done |
126 done |
128 |
127 |
129 |
128 |
130 (*Case two: Alice, Bob and the server*) |
129 (*Case two: Alice, Bob and the server*) |
131 lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur. |
130 lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur. |
132 Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, |
131 Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, |
133 END|} \<in> set evs" |
132 END|} \<in> set evs" |
134 apply (cut_tac Nonce_supply2 Key_supply2) |
133 apply (cut_tac Nonce_supply2 Key_supply2, clarify) |
135 apply clarify |
|
136 apply (intro exI bexI) |
134 apply (intro exI bexI) |
137 apply (rule_tac [2] |
135 apply (rule_tac [2] |
138 recur.Nil [THEN recur.RA1, |
136 recur.Nil [THEN recur.RA1, |
139 THEN recur.RA2, |
137 THEN recur.RA2, |
140 THEN recur.RA3 [OF _ _ respond.One [THEN respond.Cons]], |
138 THEN recur.RA3 [OF _ _ respond.One [THEN respond.Cons]], |
147 (*Case three: Alice, Bob, Charlie and the server |
145 (*Case three: Alice, Bob, Charlie and the server |
148 Rather slow (16 seconds) to run every time... |
146 Rather slow (16 seconds) to run every time... |
149 lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur. |
147 lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur. |
150 Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, |
148 Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, |
151 END|} \<in> set evs" |
149 END|} \<in> set evs" |
152 apply (tactic "cut_facts_tac [Nonce_supply3, Key_supply3] 1") |
150 apply (tactic "cut_facts_tac [Nonce_supply3, Key_supply3] 1", clarify) |
153 apply clarify |
|
154 apply (intro exI bexI) |
151 apply (intro exI bexI) |
155 apply (rule_tac [2] |
152 apply (rule_tac [2] |
156 recur.Nil [THEN recur.RA1, |
153 recur.Nil [THEN recur.RA1, |
157 THEN recur.RA2, THEN recur.RA2, |
154 THEN recur.RA2, THEN recur.RA2, |
158 THEN recur.RA3 |
155 THEN recur.RA3 |
208 |
205 |
209 (** Spy never sees another agent's shared key! (unless it's bad at start) **) |
206 (** Spy never sees another agent's shared key! (unless it's bad at start) **) |
210 |
207 |
211 lemma Spy_see_shrK [simp]: |
208 lemma Spy_see_shrK [simp]: |
212 "evs \<in> recur ==> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)" |
209 "evs \<in> recur ==> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)" |
213 apply (erule recur.induct) |
210 apply (erule recur.induct, auto) |
214 apply auto |
|
215 (*RA3. It's ugly to call auto twice, but it seems necessary.*) |
211 (*RA3. It's ugly to call auto twice, but it seems necessary.*) |
216 apply (auto dest: Key_in_parts_respond simp add: parts_insert_spies) |
212 apply (auto dest: Key_in_parts_respond simp add: parts_insert_spies) |
217 done |
213 done |
218 |
214 |
219 lemma Spy_analz_shrK [simp]: |
215 lemma Spy_analz_shrK [simp]: |
252 (Key K \<in> analz (Key`KK Un (spies evs))) = |
248 (Key K \<in> analz (Key`KK Un (spies evs))) = |
253 (K \<in> KK | Key K \<in> analz (spies evs))" |
249 (K \<in> KK | Key K \<in> analz (spies evs))" |
254 apply (erule recur.induct) |
250 apply (erule recur.induct) |
255 apply (drule_tac [4] RA2_analz_spies, |
251 apply (drule_tac [4] RA2_analz_spies, |
256 drule_tac [5] respond_imp_responses, |
252 drule_tac [5] respond_imp_responses, |
257 drule_tac [6] RA4_analz_spies) |
253 drule_tac [6] RA4_analz_spies, analz_freshK, spy_analz) |
258 apply analz_freshK |
|
259 apply spy_analz |
|
260 (*RA3*) |
254 (*RA3*) |
261 apply (simp_all add: resp_analz_image_freshK_lemma) |
255 apply (simp_all add: resp_analz_image_freshK_lemma) |
262 done |
256 done |
263 |
257 |
264 |
258 |
287 apply (erule recur.induct, |
281 apply (erule recur.induct, |
288 drule_tac [6] RA4_parts_spies, |
282 drule_tac [6] RA4_parts_spies, |
289 drule_tac [5] respond_imp_responses, |
283 drule_tac [5] respond_imp_responses, |
290 drule_tac [4] RA2_parts_spies) |
284 drule_tac [4] RA2_parts_spies) |
291 (*RA3 requires a further induction*) |
285 (*RA3 requires a further induction*) |
292 apply (erule_tac [5] responses.induct) |
286 apply (erule_tac [5] responses.induct, simp_all) |
293 apply simp_all |
|
294 (*Nil*) |
287 (*Nil*) |
295 apply force |
288 apply force |
296 (*Fake*) |
289 (*Fake*) |
297 apply (blast intro: parts_insertI) |
290 apply (blast intro: parts_insertI) |
298 done |
291 done |
343 ==> (Key K \<in> parts{RB} | Key K \<in> analz H)" |
336 ==> (Key K \<in> parts{RB} | Key K \<in> analz H)" |
344 apply (erule rev_mp, erule responses.induct) |
337 apply (erule rev_mp, erule responses.induct) |
345 apply (simp_all del: image_insert |
338 apply (simp_all del: image_insert |
346 add: analz_image_freshK_simps resp_analz_image_freshK_lemma) |
339 add: analz_image_freshK_simps resp_analz_image_freshK_lemma) |
347 (*Simplification using two distinct treatments of "image"*) |
340 (*Simplification using two distinct treatments of "image"*) |
348 apply (simp add: parts_insert2) |
341 apply (simp add: parts_insert2, blast) |
349 apply blast |
|
350 done |
342 done |
351 |
343 |
352 lemmas resp_analz_insert = |
344 lemmas resp_analz_insert = |
353 resp_analz_insert_lemma [OF _ raw_analz_image_freshK] |
345 resp_analz_insert_lemma [OF _ raw_analz_image_freshK] |
354 |
346 |
401 apply (simp_all add: ex_disj_distrib) |
393 apply (simp_all add: ex_disj_distrib) |
402 (** LEVEL 5 **) |
394 (** LEVEL 5 **) |
403 (*Base case of respond*) |
395 (*Base case of respond*) |
404 apply blast |
396 apply blast |
405 (*Inductive step of respond*) |
397 (*Inductive step of respond*) |
406 apply (intro allI conjI impI) |
398 apply (intro allI conjI impI, simp_all) |
407 apply simp_all |
|
408 (*by unicity, either B=Aa or B=A', a contradiction if B \<in> bad*) |
399 (*by unicity, either B=Aa or B=A', a contradiction if B \<in> bad*) |
409 apply (blast dest: unique_session_keys [OF _ respond_certificate]) |
400 apply (blast dest: unique_session_keys [OF _ respond_certificate]) |
410 apply (blast dest!: respond_certificate) |
401 apply (blast dest!: respond_certificate) |
411 apply (blast dest!: resp_analz_insert) |
402 apply (blast dest!: resp_analz_insert) |
412 done |
403 done |
447 lemma Hash_in_parts_respond: |
438 lemma Hash_in_parts_respond: |
448 "[| Hash {|Key (shrK B), M|} \<in> parts (insert RB H); |
439 "[| Hash {|Key (shrK B), M|} \<in> parts (insert RB H); |
449 (PB,RB,K) \<in> respond evs |] |
440 (PB,RB,K) \<in> respond evs |] |
450 ==> Hash {|Key (shrK B), M|} \<in> parts H" |
441 ==> Hash {|Key (shrK B), M|} \<in> parts H" |
451 apply (erule rev_mp) |
442 apply (erule rev_mp) |
452 apply (erule respond_imp_responses [THEN responses.induct]) |
443 apply (erule respond_imp_responses [THEN responses.induct], auto) |
453 apply auto |
|
454 done |
444 done |
455 |
445 |
456 (*Only RA1 or RA2 can have caused such a part of a message to appear. |
446 (*Only RA1 or RA2 can have caused such a part of a message to appear. |
457 This result is of no use to B, who cannot verify the Hash. Moreover, |
447 This result is of no use to B, who cannot verify the Hash. Moreover, |
458 it can say nothing about how recent A's message is. It might later be |
448 it can say nothing about how recent A's message is. It might later be |