author | paulson |
Thu, 19 Dec 1996 11:58:39 +0100 | |
changeset 2451 | ce85a2aafc7a |
parent 2449 | d30ad12b1397 |
child 2455 | 9c4444bfd44e |
permissions | -rw-r--r-- |
2449 | 1 |
(* Title: HOL/Auth/Recur |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "recur" for the Recursive Authentication protocol. |
|
7 |
*) |
|
8 |
||
9 |
open Recur; |
|
10 |
||
11 |
proof_timing:=true; |
|
12 |
HOL_quantifiers := false; |
|
13 |
Pretty.setdepth 25; |
|
14 |
||
15 |
||
16 |
(** Possibility properties: traces that reach the end |
|
17 |
ONE theorem would be more elegant and faster! |
|
18 |
By induction on a list of agents (no repetitions) |
|
19 |
**) |
|
20 |
||
21 |
(*Simplest case: Alice goes directly to the server*) |
|
22 |
goal thy |
|
23 |
"!!A. A ~= Server \ |
|
24 |
\ ==> EX K NA. EX evs: recur lost. \ |
|
25 |
\ Says Server A {|Agent A, \ |
|
26 |
\ Crypt (shrK A) {|Key K, Agent Server, Nonce NA|}, \ |
|
27 |
\ Agent Server|} \ |
|
28 |
\ : set_of_list evs"; |
|
29 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
30 |
by (rtac (recur.Nil RS recur.RA1 RS |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
31 |
(respond.One RSN (4,recur.RA3))) 2); |
2449 | 32 |
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver))); |
33 |
by (REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI])); |
|
34 |
result(); |
|
35 |
||
36 |
||
37 |
(*Case two: Alice, Bob and the server*) |
|
38 |
goal thy |
|
39 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
40 |
\ ==> EX K. EX NA. EX evs: recur lost. \ |
|
41 |
\ Says B A {|Agent A, Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \ |
|
42 |
\ Agent Server|} \ |
|
43 |
\ : set_of_list evs"; |
|
44 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
45 |
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
46 |
(respond.One RS respond.Cons RSN (4,recur.RA3)) RS |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
47 |
recur.RA4) 2); |
2449 | 48 |
by (REPEAT |
49 |
(REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI]) |
|
50 |
THEN |
|
51 |
ALLGOALS (asm_simp_tac (!simpset setsolver safe_solver)))); |
|
52 |
result(); |
|
53 |
||
54 |
||
55 |
(*Case three: Alice, Bob, Charlie and the server*) |
|
56 |
goal thy |
|
57 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
58 |
\ ==> EX K. EX NA. EX evs: recur lost. \ |
|
59 |
\ Says B A {|Agent A, Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \ |
|
60 |
\ Agent Server|} \ |
|
61 |
\ : set_of_list evs"; |
|
62 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
63 |
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS recur.RA2 RS |
2449 | 64 |
(respond.One RS respond.Cons RS respond.Cons RSN |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
65 |
(4,recur.RA3)) RS recur.RA4 RS recur.RA4) 2); |
2449 | 66 |
by (REPEAT (*SLOW: 37 seconds*) |
67 |
(REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI]) |
|
68 |
THEN |
|
69 |
ALLGOALS (asm_simp_tac (!simpset setsolver safe_solver)))); |
|
70 |
by (ALLGOALS |
|
71 |
(SELECT_GOAL (DEPTH_SOLVE |
|
72 |
(swap_res_tac [refl, conjI, disjI1, disjI2] 1 APPEND |
|
73 |
etac not_sym 1)))); |
|
74 |
result(); |
|
75 |
||
76 |
||
77 |
||
78 |
(**** Inductive proofs about recur ****) |
|
79 |
||
80 |
(*Monotonicity*) |
|
81 |
goal thy "!!evs. lost' <= lost ==> recur lost' <= recur lost"; |
|
82 |
by (rtac subsetI 1); |
|
83 |
by (etac recur.induct 1); |
|
84 |
by (REPEAT_FIRST |
|
85 |
(best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono) |
|
86 |
:: recur.intrs)))); |
|
87 |
qed "recur_mono"; |
|
88 |
||
89 |
(*Nobody sends themselves messages*) |
|
90 |
goal thy "!!evs. evs : recur lost ==> ALL A X. Says A A X ~: set_of_list evs"; |
|
91 |
by (etac recur.induct 1); |
|
92 |
by (Auto_tac()); |
|
93 |
qed_spec_mp "not_Says_to_self"; |
|
94 |
Addsimps [not_Says_to_self]; |
|
95 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
96 |
||
97 |
||
98 |
(*Simple inductive reasoning about responses*) |
|
99 |
goal thy "!!j. (j,PA,RB) : respond i ==> RB : responses i"; |
|
100 |
by (etac respond.induct 1); |
|
101 |
by (REPEAT (ares_tac responses.intrs 1)); |
|
102 |
qed "respond_imp_responses"; |
|
103 |
||
104 |
||
105 |
(** For reasoning about the encrypted portion of messages **) |
|
106 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
107 |
val RA2_analz_sees_Spy = Says_imp_sees_Spy RS analz.Inj |> standard; |
2449 | 108 |
|
109 |
goal thy "!!evs. Says C' B {|Agent B, X, Agent B, X', RA|} : set_of_list evs \ |
|
110 |
\ ==> RA : analz (sees lost Spy evs)"; |
|
111 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
112 |
qed "RA4_analz_sees_Spy"; |
2449 | 113 |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
114 |
(*RA2_analz... and RA4_analz... let us treat those cases using the same |
2449 | 115 |
argument as for the Fake case. This is possible for most, but not all, |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
116 |
proofs: Fake does not invent new nonces (as in RA2), and of course Fake |
2449 | 117 |
messages originate from the Spy. *) |
118 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
119 |
bind_thm ("RA2_parts_sees_Spy", |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
120 |
RA2_analz_sees_Spy RS (impOfSubs analz_subset_parts)); |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
121 |
bind_thm ("RA4_parts_sees_Spy", |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
122 |
RA4_analz_sees_Spy RS (impOfSubs analz_subset_parts)); |
2449 | 123 |
|
124 |
(*We instantiate the variable to "lost". Leaving it as a Var makes proofs |
|
125 |
harder to complete, since simplification does less for us.*) |
|
126 |
val parts_Fake_tac = |
|
127 |
let val tac = forw_inst_tac [("lost","lost")] |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
128 |
in tac RA2_parts_sees_Spy 4 THEN |
2449 | 129 |
forward_tac [respond_imp_responses] 5 THEN |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
130 |
tac RA4_parts_sees_Spy 6 |
2449 | 131 |
end; |
132 |
||
133 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *) |
|
134 |
fun parts_induct_tac i = SELECT_GOAL |
|
135 |
(DETERM (etac recur.induct 1 THEN parts_Fake_tac THEN |
|
136 |
(*Fake message*) |
|
137 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
138 |
impOfSubs Fake_parts_insert] |
|
139 |
addss (!simpset)) 2)) THEN |
|
140 |
(*Base case*) |
|
141 |
fast_tac (!claset addss (!simpset)) 1 THEN |
|
142 |
ALLGOALS Asm_simp_tac) i; |
|
143 |
||
144 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY |
|
145 |
sends messages containing X! **) |
|
146 |
||
147 |
||
148 |
(** Spy never sees another agent's long-term key (unless initially lost) **) |
|
149 |
||
150 |
goal thy |
|
151 |
"!!evs. (j,PB,RB) : respond i \ |
|
152 |
\ ==> Key K : parts {RB} --> (EX j'. K = newK2(i,j') & j<=j')"; |
|
153 |
be respond.induct 1; |
|
154 |
by (Auto_tac()); |
|
155 |
by (best_tac (!claset addDs [Suc_leD]) 1); |
|
156 |
qed_spec_mp "Key_in_parts_respond"; |
|
157 |
||
158 |
goal thy |
|
159 |
"!!evs. evs : recur lost \ |
|
160 |
\ ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)"; |
|
161 |
by (parts_induct_tac 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
162 |
(*RA2*) |
2449 | 163 |
by (best_tac (!claset addSEs partsEs addSDs [parts_cut] |
164 |
addss (!simpset)) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
165 |
(*RA3*) |
2449 | 166 |
by (fast_tac (!claset addDs [Key_in_parts_respond] |
167 |
addss (!simpset addsimps [parts_insert_sees])) 1); |
|
168 |
qed "Spy_see_shrK"; |
|
169 |
Addsimps [Spy_see_shrK]; |
|
170 |
||
171 |
goal thy |
|
172 |
"!!evs. evs : recur lost \ |
|
173 |
\ ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
174 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); |
|
175 |
qed "Spy_analz_shrK"; |
|
176 |
Addsimps [Spy_analz_shrK]; |
|
177 |
||
178 |
goal thy "!!A. [| Key (shrK A) : parts (sees lost Spy evs); \ |
|
179 |
\ evs : recur lost |] ==> A:lost"; |
|
180 |
by (fast_tac (!claset addDs [Spy_see_shrK]) 1); |
|
181 |
qed "Spy_see_shrK_D"; |
|
182 |
||
183 |
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D); |
|
184 |
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D]; |
|
185 |
||
186 |
||
187 |
(*** Future keys can't be seen or used! ***) |
|
188 |
||
189 |
(*Nobody can have SEEN keys that will be generated in the future. *) |
|
190 |
goal thy "!!evs. evs : recur lost ==> \ |
|
191 |
\ length evs <= i --> \ |
|
192 |
\ Key (newK2(i,j)) ~: parts (sees lost Spy evs)"; |
|
193 |
by (parts_induct_tac 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
194 |
(*RA2*) |
2449 | 195 |
by (best_tac (!claset addSEs partsEs |
196 |
addSDs [parts_cut] |
|
197 |
addDs [Suc_leD] |
|
198 |
addss (!simpset addsimps [parts_insert2])) 3); |
|
199 |
(*Fake*) |
|
200 |
by (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
201 |
impOfSubs parts_insert_subset_Un, |
|
202 |
Suc_leD] |
|
203 |
addss (!simpset)) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
204 |
(*For RA3*) |
2449 | 205 |
by (asm_simp_tac (!simpset addsimps [parts_insert_sees]) 2); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
206 |
(*RA1-RA4*) |
2449 | 207 |
by (REPEAT (best_tac (!claset addDs [Key_in_parts_respond, Suc_leD] |
208 |
addss (!simpset)) 1)); |
|
209 |
qed_spec_mp "new_keys_not_seen"; |
|
210 |
Addsimps [new_keys_not_seen]; |
|
211 |
||
212 |
(*Variant: old messages must contain old keys!*) |
|
213 |
goal thy |
|
214 |
"!!evs. [| Says A B X : set_of_list evs; \ |
|
215 |
\ Key (newK2(i,j)) : parts {X}; \ |
|
216 |
\ evs : recur lost \ |
|
217 |
\ |] ==> i < length evs"; |
|
218 |
by (rtac ccontr 1); |
|
219 |
by (dtac leI 1); |
|
220 |
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy] |
|
221 |
addIs [impOfSubs parts_mono]) 1); |
|
222 |
qed "Says_imp_old_keys"; |
|
223 |
||
224 |
||
225 |
(*** Future nonces can't be seen or used! ***) |
|
226 |
||
227 |
goal thy |
|
228 |
"!!evs. (j, PB, RB) : respond i \ |
|
229 |
\ ==> Nonce N : parts {RB} --> Nonce N : parts {PB}"; |
|
230 |
be respond.induct 1; |
|
231 |
by (Auto_tac()); |
|
232 |
qed_spec_mp "Nonce_in_parts_respond"; |
|
233 |
||
234 |
||
235 |
goal thy "!!i. evs : recur lost ==> \ |
|
236 |
\ length evs <= i --> Nonce(newN i) ~: parts (sees lost Spy evs)"; |
|
237 |
by (parts_induct_tac 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
238 |
(*For RA3*) |
2449 | 239 |
by (asm_simp_tac (!simpset addsimps [parts_insert_sees]) 4); |
240 |
by (deepen_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
241 |
addDs [Nonce_in_parts_respond, parts_cut, Suc_leD] |
|
242 |
addss (!simpset)) 0 4); |
|
243 |
(*Fake*) |
|
244 |
by (fast_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
245 |
impOfSubs parts_insert_subset_Un, |
|
246 |
Suc_leD] |
|
247 |
addss (!simpset)) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
248 |
(*RA1, RA2, RA4*) |
2449 | 249 |
by (REPEAT_FIRST (fast_tac (!claset |
250 |
addSEs partsEs |
|
251 |
addEs [leD RS notE] |
|
252 |
addDs [Suc_leD] |
|
253 |
addss (!simpset)))); |
|
254 |
qed_spec_mp "new_nonces_not_seen"; |
|
255 |
Addsimps [new_nonces_not_seen]; |
|
256 |
||
257 |
(*Variant: old messages must contain old nonces!*) |
|
258 |
goal thy "!!evs. [| Says A B X : set_of_list evs; \ |
|
259 |
\ Nonce (newN i) : parts {X}; \ |
|
260 |
\ evs : recur lost \ |
|
261 |
\ |] ==> i < length evs"; |
|
262 |
by (rtac ccontr 1); |
|
263 |
by (dtac leI 1); |
|
264 |
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy] |
|
265 |
addIs [impOfSubs parts_mono]) 1); |
|
266 |
qed "Says_imp_old_nonces"; |
|
267 |
||
268 |
||
269 |
(** Nobody can have USED keys that will be generated in the future. **) |
|
270 |
||
271 |
goal thy |
|
272 |
"!!evs. (j,PB,RB) : respond i \ |
|
273 |
\ ==> K : keysFor (parts {RB}) --> (EX A. K = shrK A)"; |
|
274 |
be (respond_imp_responses RS responses.induct) 1; |
|
275 |
by (Auto_tac()); |
|
276 |
qed_spec_mp "Key_in_keysFor_parts_respond"; |
|
277 |
||
278 |
||
279 |
goal thy "!!i. evs : recur lost ==> \ |
|
280 |
\ length evs <= i --> newK2(i,j) ~: keysFor (parts (sees lost Spy evs))"; |
|
281 |
by (parts_induct_tac 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
282 |
(*RA3*) |
2449 | 283 |
by (fast_tac (!claset addDs [Key_in_keysFor_parts_respond, Suc_leD] |
284 |
addss (!simpset addsimps [parts_insert_sees])) 4); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
285 |
(*RA2*) |
2449 | 286 |
by (fast_tac (!claset addSEs partsEs |
287 |
addDs [Suc_leD] addss (!simpset)) 3); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
288 |
(*Fake, RA1, RA4*) |
2449 | 289 |
by (REPEAT |
290 |
(best_tac |
|
291 |
(!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono), |
|
292 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono), |
|
293 |
Suc_leD] |
|
294 |
addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)] |
|
295 |
addss (!simpset)) 1)); |
|
296 |
qed_spec_mp "new_keys_not_used"; |
|
297 |
||
298 |
||
299 |
bind_thm ("new_keys_not_analzd", |
|
300 |
[analz_subset_parts RS keysFor_mono, |
|
301 |
new_keys_not_used] MRS contra_subsetD); |
|
302 |
||
303 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
304 |
||
305 |
||
306 |
||
307 |
(*** Proofs involving analz ***) |
|
308 |
||
309 |
(*For proofs involving analz. We again instantiate the variable to "lost".*) |
|
310 |
val analz_Fake_tac = |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
311 |
dres_inst_tac [("lost","lost")] RA2_analz_sees_Spy 4 THEN |
2449 | 312 |
forward_tac [respond_imp_responses] 5 THEN |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
313 |
dres_inst_tac [("lost","lost")] RA4_analz_sees_Spy 6; |
2449 | 314 |
|
315 |
||
316 |
(** Session keys are not used to encrypt other session keys **) |
|
317 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
318 |
(*Version for "responses" relation. Handles case RA3 in the theorem below. |
2449 | 319 |
Note that it holds for *any* set H (not just "sees lost Spy evs") |
320 |
satisfying the inductive hypothesis.*) |
|
321 |
goal thy |
|
322 |
"!!evs. [| RB : responses i; \ |
|
323 |
\ ALL K I. (Key K : analz (Key``(newK``I) Un H)) = \ |
|
324 |
\ (K : newK``I | Key K : analz H) |] \ |
|
325 |
\ ==> ALL K I. (Key K : analz (insert RB (Key``(newK``I) Un H))) = \ |
|
326 |
\ (K : newK``I | Key K : analz (insert RB H))"; |
|
327 |
be responses.induct 1; |
|
328 |
by (ALLGOALS |
|
329 |
(asm_simp_tac |
|
330 |
(!simpset addsimps [insert_Key_singleton, insert_Key_image, |
|
331 |
Un_assoc RS sym, pushKey_newK] |
|
332 |
setloop split_tac [expand_if]))); |
|
333 |
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1); |
|
334 |
qed "resp_analz_image_newK_lemma"; |
|
335 |
||
336 |
(*Version for the protocol. Proof is almost trivial, thanks to the lemma.*) |
|
337 |
goal thy |
|
338 |
"!!evs. evs : recur lost ==> \ |
|
339 |
\ ALL K I. (Key K : analz (Key``(newK``I) Un (sees lost Spy evs))) = \ |
|
340 |
\ (K : newK``I | Key K : analz (sees lost Spy evs))"; |
|
341 |
by (etac recur.induct 1); |
|
342 |
by analz_Fake_tac; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
343 |
be ssubst 4; (*RA2: DELETE needless definition of PA!*) |
2449 | 344 |
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma])); |
345 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [resp_analz_image_newK_lemma]))); |
|
346 |
(*Base*) |
|
347 |
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
348 |
(*RA4, RA2, Fake*) |
2449 | 349 |
by (REPEAT (spy_analz_tac 1)); |
350 |
val raw_analz_image_newK = result(); |
|
351 |
qed_spec_mp "analz_image_newK"; |
|
352 |
||
353 |
||
354 |
(*Instance of the lemma with H replaced by (sees lost Spy evs): |
|
355 |
[| RB : responses i; evs : recur lost |] |
|
356 |
==> Key xa : analz (insert RB (Key``newK``x Un sees lost Spy evs)) = |
|
357 |
(xa : newK``x | Key xa : analz (insert RB (sees lost Spy evs))) |
|
358 |
*) |
|
359 |
bind_thm ("resp_analz_image_newK", |
|
360 |
raw_analz_image_newK RSN |
|
361 |
(2, resp_analz_image_newK_lemma) RS spec RS spec); |
|
362 |
||
363 |
goal thy |
|
364 |
"!!evs. evs : recur lost ==> \ |
|
365 |
\ Key K : analz (insert (Key (newK x)) (sees lost Spy evs)) = \ |
|
366 |
\ (K = newK x | Key K : analz (sees lost Spy evs))"; |
|
367 |
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, |
|
368 |
insert_Key_singleton]) 1); |
|
369 |
by (Fast_tac 1); |
|
370 |
qed "analz_insert_Key_newK"; |
|
371 |
||
372 |
||
373 |
(** Nonces cannot appear before their time, even hashed! |
|
374 |
One is tempted to add the rule |
|
375 |
"Hash X : parts H ==> X : parts H" |
|
376 |
but we'd then lose theorems like Spy_see_shrK |
|
377 |
***) |
|
378 |
||
379 |
goal thy "!!i. evs : recur lost ==> \ |
|
380 |
\ length evs <= i --> \ |
|
381 |
\ (Nonce (newN i) : parts {X} --> \ |
|
382 |
\ Hash X ~: parts (sees lost Spy evs))"; |
|
383 |
be recur.induct 1; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
384 |
be ssubst 4; (*RA2: DELETE needless definition of PA!*) |
2449 | 385 |
by parts_Fake_tac; |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
386 |
(*RA3 requires a further induction*) |
2449 | 387 |
be responses.induct 5; |
388 |
by (ALLGOALS Asm_simp_tac); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
389 |
(*RA2*) |
2449 | 390 |
by (best_tac (!claset addDs [Suc_leD, parts_cut] |
391 |
addEs [leD RS notE, |
|
392 |
new_nonces_not_seen RSN(2,rev_notE)] |
|
393 |
addss (!simpset)) 4); |
|
394 |
(*Fake*) |
|
395 |
by (best_tac (!claset addSDs [impOfSubs analz_subset_parts, |
|
396 |
impOfSubs parts_insert_subset_Un, |
|
397 |
Suc_leD] |
|
398 |
addss (!simpset)) 2); |
|
399 |
(*Five others!*) |
|
400 |
by (REPEAT (fast_tac (!claset addEs [leD RS notE] |
|
401 |
addDs [Suc_leD] |
|
402 |
addss (!simpset)) 1)); |
|
403 |
bind_thm ("Hash_new_nonces_not_seen", |
|
404 |
result() RS mp RS mp RSN (2, rev_notE)); |
|
405 |
||
406 |
||
407 |
(** The Nonce NA uniquely identifies A's message. |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
408 |
This theorem applies to rounds RA1 and RA2! |
2449 | 409 |
**) |
410 |
||
411 |
goal thy |
|
412 |
"!!evs. [| evs : recur lost; A ~: lost |] \ |
|
413 |
\ ==> EX B' P'. ALL B P. \ |
|
414 |
\ Hash {|Key(shrK A), Agent A, Agent B, Nonce NA, P|} \ |
|
415 |
\ : parts (sees lost Spy evs) --> B=B' & P=P'"; |
|
416 |
be recur.induct 1; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
417 |
be ssubst 4; (*RA2: DELETE needless definition of PA!*) |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
418 |
(*For better simplification of RA2*) |
2449 | 419 |
by (res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 4); |
420 |
by parts_Fake_tac; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
421 |
(*RA3 requires a further induction*) |
2449 | 422 |
be responses.induct 5; |
423 |
by (ALLGOALS Asm_simp_tac); |
|
424 |
by (step_tac (!claset addSEs partsEs) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
425 |
(*RA3: inductive case*) |
2449 | 426 |
by (best_tac (!claset addss (!simpset)) 5); |
427 |
(*Fake*) |
|
428 |
by (best_tac (!claset addSIs [exI] |
|
429 |
addDs [impOfSubs analz_subset_parts, |
|
430 |
impOfSubs Fake_parts_insert] |
|
431 |
addss (!simpset)) 2); |
|
432 |
(*Base*) |
|
433 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
434 |
||
435 |
by (ALLGOALS (simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
436 |
(*RA1: creation of new Nonce. Move assertion into global context*) |
2449 | 437 |
by (expand_case_tac "NA = ?y" 1); |
438 |
by (best_tac (!claset addSIs [exI] |
|
439 |
addEs [Hash_new_nonces_not_seen] |
|
440 |
addss (!simpset)) 1); |
|
441 |
by (best_tac (!claset addss (!simpset)) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
442 |
(*RA2: creation of new Nonce*) |
2449 | 443 |
by (expand_case_tac "NA = ?y" 1); |
444 |
by (best_tac (!claset addSIs [exI] |
|
445 |
addDs [parts_cut] |
|
446 |
addEs [Hash_new_nonces_not_seen] |
|
447 |
addss (!simpset)) 1); |
|
448 |
by (best_tac (!claset addss (!simpset)) 1); |
|
449 |
val lemma = result(); |
|
450 |
||
451 |
goal thy |
|
452 |
"!!evs.[| Hash {|Key(shrK A), Agent A, Agent B, Nonce NA, P|} \ |
|
453 |
\ : parts (sees lost Spy evs); \ |
|
454 |
\ Hash {|Key(shrK A), Agent A, Agent B', Nonce NA, P'|} \ |
|
455 |
\ : parts (sees lost Spy evs); \ |
|
456 |
\ evs : recur lost; A ~: lost |] \ |
|
457 |
\ ==> B=B' & P=P'"; |
|
458 |
by (prove_unique_tac lemma 1); |
|
459 |
qed "unique_NA"; |
|
460 |
||
461 |
||
462 |
(*** Lemmas concerning the Server's response |
|
463 |
(relations "respond" and "responses") |
|
464 |
***) |
|
465 |
||
466 |
(*The response never contains Hashes*) |
|
467 |
goal thy |
|
468 |
"!!evs. (j,PB,RB) : respond i \ |
|
469 |
\ ==> Hash {|Key (shrK B), M|} : parts (insert RB H) --> \ |
|
470 |
\ Hash {|Key (shrK B), M|} : parts H"; |
|
471 |
be (respond_imp_responses RS responses.induct) 1; |
|
472 |
by (Auto_tac()); |
|
473 |
bind_thm ("Hash_in_parts_respond", result() RSN (2, rev_mp)); |
|
474 |
||
475 |
||
476 |
goal thy |
|
477 |
"!!evs. [| RB : responses i; evs : recur lost |] \ |
|
478 |
\ ==> (Key (shrK B) : analz (insert RB (sees lost Spy evs))) = (B:lost)"; |
|
479 |
be responses.induct 1; |
|
480 |
by (ALLGOALS |
|
481 |
(asm_simp_tac |
|
482 |
(!simpset addsimps [resp_analz_image_newK, insert_Key_singleton] |
|
483 |
setloop split_tac [expand_if]))); |
|
484 |
qed "shrK_in_analz_respond"; |
|
485 |
Addsimps [shrK_in_analz_respond]; |
|
486 |
||
487 |
||
488 |
goal thy |
|
489 |
"!!evs. [| RB : responses i; \ |
|
490 |
\ ALL K I. (Key K : analz (Key``(newK``I) Un H)) = \ |
|
491 |
\ (K : newK``I | Key K : analz H) |] \ |
|
492 |
\ ==> (Key K : analz (insert RB H)) --> \ |
|
493 |
\ (Key K : parts{RB} | Key K : analz H)"; |
|
494 |
be responses.induct 1; |
|
495 |
by (ALLGOALS |
|
496 |
(asm_simp_tac |
|
497 |
(!simpset addsimps [read_instantiate [("H", "?ff``?xx")] parts_insert, |
|
498 |
resp_analz_image_newK_lemma, |
|
499 |
insert_Key_singleton, insert_Key_image, |
|
500 |
Un_assoc RS sym, pushKey_newK] |
|
501 |
setloop split_tac [expand_if]))); |
|
502 |
(*The "Message" simpset gives the standard treatment of "image"*) |
|
503 |
by (simp_tac (simpset_of "Message") 1); |
|
504 |
by (fast_tac (!claset delrules [allE]) 1); |
|
505 |
qed "resp_analz_insert_lemma"; |
|
506 |
||
507 |
bind_thm ("resp_analz_insert", |
|
508 |
raw_analz_image_newK RSN |
|
509 |
(2, resp_analz_insert_lemma) RSN(2, rev_mp)); |
|
510 |
||
511 |
||
512 |
(*The Server does not send such messages. This theorem lets us avoid |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
513 |
assuming B~=Server in RA4.*) |
2449 | 514 |
goal thy |
515 |
"!!evs. evs : recur lost \ |
|
516 |
\ ==> ALL C X Y P. Says Server C {|X, Agent Server, Agent C, Y, P|} \ |
|
517 |
\ ~: set_of_list evs"; |
|
518 |
by (etac recur.induct 1); |
|
519 |
be (respond.induct) 5; |
|
520 |
by (Auto_tac()); |
|
521 |
qed_spec_mp "Says_Server_not"; |
|
522 |
AddSEs [Says_Server_not RSN (2,rev_notE)]; |
|
523 |
||
524 |
||
525 |
goal thy |
|
526 |
"!!i. (j,PB,RB) : respond i \ |
|
527 |
\ ==> EX A' B'. ALL A B N. \ |
|
528 |
\ Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB} \ |
|
529 |
\ --> (A'=A & B'=B) | (A'=B & B'=A)"; |
|
530 |
be respond.induct 1; |
|
531 |
by (ALLGOALS (asm_full_simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
532 |
(*Base case*) |
|
533 |
by (Fast_tac 1); |
|
534 |
by (Step_tac 1); |
|
535 |
by (expand_case_tac "K = ?y" 1); |
|
536 |
by (best_tac (!claset addSIs [exI] |
|
537 |
addSEs partsEs |
|
538 |
addDs [Key_in_parts_respond] |
|
539 |
addss (!simpset)) 1); |
|
540 |
by (expand_case_tac "K = ?y" 1); |
|
541 |
by (REPEAT (ares_tac [exI] 2)); |
|
542 |
by (ex_strip_tac 1); |
|
543 |
be respond.elim 1; |
|
544 |
by (REPEAT_FIRST (etac Pair_inject ORELSE' hyp_subst_tac)); |
|
545 |
by (ALLGOALS (asm_full_simp_tac |
|
546 |
(!simpset addsimps [all_conj_distrib, ex_disj_distrib]))); |
|
547 |
by (Fast_tac 1); |
|
548 |
by (Fast_tac 1); |
|
549 |
val lemma = result(); |
|
550 |
||
551 |
goal thy |
|
552 |
"!!RB. [| Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB}; \ |
|
553 |
\ Crypt (shrK A') {|Key K, Agent B', N'|} : parts {RB}; \ |
|
554 |
\ (j,PB,RB) : respond i |] \ |
|
555 |
\ ==> (A'=A & B'=B) | (A'=B & B'=A)"; |
|
556 |
by (prove_unique_tac lemma 1); (*33 seconds, due to the disjunctions*) |
|
557 |
qed "unique_session_keys"; |
|
558 |
||
559 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
560 |
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3 |
2449 | 561 |
Does not in itself guarantee security: an attack could violate |
562 |
the premises, e.g. by having A=Spy **) |
|
563 |
||
564 |
goal thy |
|
565 |
"!!j. (j, {|Hash {|Key(shrK A), Agent A, B, NA, P|}, X|}, RA) : respond i \ |
|
566 |
\ ==> Crypt (shrK A) {|Key (newK2 (i,j)), B, NA|} : parts {RA}"; |
|
567 |
be respond.elim 1; |
|
568 |
by (ALLGOALS Asm_full_simp_tac); |
|
569 |
qed "newK2_respond_lemma"; |
|
570 |
||
571 |
||
572 |
goal thy |
|
573 |
"!!evs. [| (j,PB,RB) : respond (length evs); evs : recur lost |] \ |
|
574 |
\ ==> ALL A A' N. A ~: lost & A' ~: lost --> \ |
|
575 |
\ Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB} --> \ |
|
576 |
\ Key K ~: analz (insert RB (sees lost Spy evs))"; |
|
577 |
be respond.induct 1; |
|
578 |
by (forward_tac [respond_imp_responses] 2); |
|
579 |
by (ALLGOALS |
|
580 |
(asm_simp_tac |
|
581 |
(!simpset addsimps |
|
582 |
([analz_image_newK, not_parts_not_analz, |
|
583 |
read_instantiate [("H", "?ff``?xx")] parts_insert, |
|
584 |
Un_assoc RS sym, resp_analz_image_newK, |
|
585 |
insert_Key_singleton, analz_insert_Key_newK]) |
|
586 |
setloop split_tac [expand_if]))); |
|
587 |
by (ALLGOALS (simp_tac (simpset_of "Message"))); |
|
588 |
by (Fast_tac 1); |
|
589 |
by (step_tac (!claset addSEs [MPair_parts]) 1); |
|
590 |
(** LEVEL 6 **) |
|
591 |
by (fast_tac (!claset addDs [resp_analz_insert, Key_in_parts_respond] |
|
592 |
addSEs [new_keys_not_seen RS not_parts_not_analz |
|
593 |
RSN(2,rev_notE)] |
|
594 |
addss (!simpset)) 4); |
|
595 |
by (fast_tac (!claset addSDs [newK2_respond_lemma]) 3); |
|
596 |
by (best_tac (!claset addSEs partsEs |
|
597 |
addDs [Key_in_parts_respond] |
|
598 |
addss (!simpset)) 2); |
|
599 |
by (thin_tac "ALL x.?P(x)" 1); |
|
600 |
be respond.elim 1; |
|
601 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
602 |
by (step_tac (!claset addss (!simpset)) 1); |
|
603 |
by (best_tac (!claset addSEs partsEs |
|
604 |
addDs [Key_in_parts_respond] |
|
605 |
addss (!simpset)) 1); |
|
606 |
qed_spec_mp "respond_Spy_not_see_encrypted_key"; |
|
607 |
||
608 |
||
609 |
goal thy |
|
610 |
"!!evs. [| A ~: lost; A' ~: lost; \ |
|
611 |
\ evs : recur lost |] \ |
|
612 |
\ ==> Says Server B RB : set_of_list evs --> \ |
|
613 |
\ Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB} --> \ |
|
614 |
\ Key K ~: analz (sees lost Spy evs)"; |
|
615 |
by (etac recur.induct 1); |
|
616 |
by analz_Fake_tac; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
617 |
be ssubst 4; (*RA2: DELETE needless definition of PA!*) |
2449 | 618 |
by (ALLGOALS |
619 |
(asm_simp_tac |
|
620 |
(!simpset addsimps [not_parts_not_analz, analz_insert_Key_newK] |
|
621 |
setloop split_tac [expand_if]))); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
622 |
(*RA4*) |
2449 | 623 |
by (spy_analz_tac 4); |
624 |
(*Fake*) |
|
625 |
by (spy_analz_tac 1); |
|
626 |
by (step_tac (!claset delrules [impCE]) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
627 |
(*RA2*) |
2449 | 628 |
by (spy_analz_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
629 |
(*RA3, case 2: K is an old key*) |
2449 | 630 |
by (fast_tac (!claset addSDs [resp_analz_insert] |
631 |
addSEs partsEs |
|
632 |
addDs [Key_in_parts_respond] |
|
633 |
addEs [Says_imp_old_keys RS less_irrefl]) 2); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
634 |
(*RA3, case 1: use lemma previously proved by induction*) |
2449 | 635 |
by (fast_tac (!claset addSEs [respond_Spy_not_see_encrypted_key RSN |
636 |
(2,rev_notE)]) 1); |
|
637 |
bind_thm ("Spy_not_see_encrypted_key", result() RS mp RSN (2, rev_mp)); |
|
638 |
||
639 |
||
640 |
goal thy |
|
641 |
"!!evs. [| Says Server B RB : set_of_list evs; \ |
|
642 |
\ Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB}; \ |
|
643 |
\ C ~: {A,A',Server}; \ |
|
644 |
\ A ~: lost; A' ~: lost; evs : recur lost |] \ |
|
645 |
\ ==> Key K ~: analz (sees lost C evs)"; |
|
646 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1); |
|
647 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1); |
|
648 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key)); |
|
649 |
by (REPEAT_FIRST (fast_tac (!claset addIs [recur_mono RS subsetD]))); |
|
650 |
qed "Agent_not_see_encrypted_key"; |
|
651 |
||
652 |
||
653 |
(**** Authenticity properties for Agents ****) |
|
654 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
655 |
(*Only RA1 or RA2 can have caused such a part of a message to appear.*) |
2449 | 656 |
goal thy |
657 |
"!!evs. [| Hash {|Key(shrK A), Agent A, Agent B, NA, P|} \ |
|
658 |
\ : parts (sees lost Spy evs); \ |
|
659 |
\ A ~: lost; evs : recur lost |] \ |
|
660 |
\ ==> Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|}, \ |
|
661 |
\ Agent A, Agent B, NA, P|} \ |
|
662 |
\ : set_of_list evs"; |
|
663 |
be rev_mp 1; |
|
664 |
by (parts_induct_tac 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
665 |
(*RA3*) |
2449 | 666 |
by (fast_tac (!claset addSDs [Hash_in_parts_respond]) 2); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
667 |
(*RA2*) |
2449 | 668 |
by ((REPEAT o CHANGED) (*Push in XA*) |
669 |
(res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 1)); |
|
670 |
by (best_tac (!claset addSEs partsEs |
|
671 |
addDs [parts_cut] |
|
672 |
addss (!simpset)) 1); |
|
673 |
qed_spec_mp "Hash_auth_sender"; |
|
674 |
||
675 |
||
676 |
goal thy "!!i. {|Hash {|Key (shrK Server), M|}, M|} : responses i ==> R"; |
|
677 |
be setup_induction 1; |
|
678 |
be responses.induct 1; |
|
679 |
by (ALLGOALS Asm_simp_tac); |
|
680 |
qed "responses_no_Hash_Server"; |
|
681 |
||
682 |
||
683 |
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE); |
|
684 |
||
685 |
||
686 |
(** These two results should subsume (for all agents) the guarantees proved |
|
687 |
separately for A and B in the Otway-Rees protocol. |
|
688 |
**) |
|
689 |
||
690 |
||
691 |
(*Crucial property: If the encrypted message appears, and A has used NA |
|
692 |
in a run, then it originated with the Server!*) |
|
693 |
goal thy |
|
694 |
"!!evs. [| A ~: lost; A ~= Spy; evs : recur lost |] \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
695 |
\ ==> Crypt (shrK A) {|Key K, Agent A', NA|} : parts (sees lost Spy evs) \ |
2449 | 696 |
\ --> Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|}, \ |
697 |
\ Agent A, Agent B, NA, P|} \ |
|
698 |
\ : set_of_list evs \ |
|
699 |
\ --> (EX C RC. Says Server C RC : set_of_list evs & \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
700 |
\ Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RC})"; |
2449 | 701 |
by (parts_induct_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
702 |
(*RA4*) |
2449 | 703 |
by (best_tac (!claset addSEs [MPair_parts] |
704 |
addSDs [Hash_auth_sender] |
|
705 |
addSIs [disjI2]) 4); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
706 |
(*RA1: it cannot be a new Nonce, contradiction.*) |
2449 | 707 |
by (fast_tac (!claset delrules [impCE] |
708 |
addSEs [nonce_not_seen_now, MPair_parts] |
|
709 |
addDs [parts.Body]) 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
710 |
(*RA2: it cannot be a new Nonce, contradiction.*) |
2449 | 711 |
by ((REPEAT o CHANGED) (*Push in XA*) |
712 |
(res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 1)); |
|
713 |
by (deepen_tac (!claset delrules [impCE] |
|
714 |
addSIs [disjI2] |
|
715 |
addSEs [MPair_parts] |
|
716 |
addDs [parts_cut, parts.Body] |
|
717 |
addss (!simpset)) 0 1); |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
718 |
(*RA3*) (** LEVEL 5 **) |
2449 | 719 |
by (REPEAT (safe_step_tac (!claset addSEs [responses_no_Hash_Server] |
720 |
delrules [impCE]) 1)); |
|
721 |
by (full_simp_tac (!simpset addsimps [parts_insert_sees]) 1); |
|
722 |
by (Fast_tac 1); |
|
723 |
qed_spec_mp "Crypt_imp_Server_msg"; |
|
724 |
||
725 |
||
726 |
(*Corollary: if A receives B's message and the nonce NA agrees |
|
727 |
then the key really did come from the Server!*) |
|
728 |
goal thy |
|
729 |
"!!evs. [| Says B' A RA : set_of_list evs; \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
730 |
\ Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RA}; \ |
2449 | 731 |
\ Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|}, \ |
732 |
\ Agent A, Agent B, NA, P|} \ |
|
733 |
\ : set_of_list evs; \ |
|
734 |
\ A ~: lost; A ~= Spy; evs : recur lost |] \ |
|
735 |
\ ==> EX C RC. Says Server C RC : set_of_list evs & \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
736 |
\ Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RC}"; |
2449 | 737 |
by (best_tac (!claset addSIs [Crypt_imp_Server_msg] |
738 |
addDs [Says_imp_sees_Spy RS parts.Inj RSN (2,parts_cut)] |
|
739 |
addss (!simpset)) 1); |
|
740 |
qed "Agent_trust"; |
|
741 |
||
742 |
||
743 |
(*Overall guarantee: if A receives B's message and the nonce NA agrees |
|
744 |
then the only other agent who knows the key is B.*) |
|
745 |
goal thy |
|
746 |
"!!evs. [| Says B' A RA : set_of_list evs; \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
747 |
\ Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RA}; \ |
2449 | 748 |
\ Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|}, \ |
749 |
\ Agent A, Agent B, NA, P|} \ |
|
750 |
\ : set_of_list evs; \ |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
751 |
\ C ~: {A,A',Server}; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
752 |
\ A ~: lost; A' ~: lost; A ~= Spy; evs : recur lost |] \ |
2449 | 753 |
\ ==> Key K ~: analz (sees lost C evs)"; |
754 |
by (dtac Agent_trust 1 THEN REPEAT_FIRST assume_tac); |
|
755 |
by (fast_tac (!claset addSEs [Agent_not_see_encrypted_key RSN(2,rev_notE)]) 1); |
|
756 |
qed "Agent_secrecy"; |
|
757 |