author | wenzelm |
Tue, 06 May 1997 15:27:35 +0200 | |
changeset 3118 | 24dae6222579 |
parent 2637 | e9b203f854ae |
child 3121 | cbb6c0c1c58a |
permissions | -rw-r--r-- |
2318 | 1 |
(* Title: HOL/Auth/NS_Public_Bad |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "ns_public" for the Needham-Schroeder Public-Key protocol. |
|
7 |
Flawed version, vulnerable to Lowe's attack. |
|
8 |
||
9 |
From page 260 of |
|
10 |
Burrows, Abadi and Needham. A Logic of Authentication. |
|
11 |
Proc. Royal Soc. 426 (1989) |
|
12 |
*) |
|
13 |
||
14 |
open NS_Public_Bad; |
|
15 |
||
16 |
proof_timing:=true; |
|
17 |
HOL_quantifiers := false; |
|
18 |
||
2637
e9b203f854ae
reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents:
2536
diff
changeset
|
19 |
val op addss = op unsafe_addss; |
e9b203f854ae
reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents:
2536
diff
changeset
|
20 |
|
2318 | 21 |
AddIffs [Spy_in_lost]; |
22 |
||
23 |
(*Replacing the variable by a constant improves search speed by 50%!*) |
|
24 |
val Says_imp_sees_Spy' = |
|
25 |
read_instantiate_sg (sign_of thy) [("lost","lost")] Says_imp_sees_Spy; |
|
26 |
||
27 |
||
28 |
(*A "possibility property": there are traces that reach the end*) |
|
29 |
goal thy |
|
2480 | 30 |
"!!A B. A ~= B ==> EX NB. EX evs: ns_public. \ |
31 |
\ Says A B (Crypt (pubK B) (Nonce NB)) : set_of_list evs"; |
|
2318 | 32 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
33 |
by (rtac (ns_public.Nil RS ns_public.NS1 RS ns_public.NS2 RS ns_public.NS3) 2); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
34 |
by possibility_tac; |
2318 | 35 |
result(); |
36 |
||
37 |
||
38 |
(**** Inductive proofs about ns_public ****) |
|
39 |
||
40 |
(*Nobody sends themselves messages*) |
|
41 |
goal thy "!!evs. evs : ns_public ==> ALL A X. Says A A X ~: set_of_list evs"; |
|
42 |
by (etac ns_public.induct 1); |
|
43 |
by (Auto_tac()); |
|
44 |
qed_spec_mp "not_Says_to_self"; |
|
45 |
Addsimps [not_Says_to_self]; |
|
46 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
47 |
||
48 |
||
49 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *) |
|
50 |
fun parts_induct_tac i = SELECT_GOAL |
|
51 |
(DETERM (etac ns_public.induct 1 THEN |
|
52 |
(*Fake message*) |
|
53 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
54 |
impOfSubs Fake_parts_insert] |
|
55 |
addss (!simpset)) 2)) THEN |
|
56 |
(*Base case*) |
|
57 |
fast_tac (!claset addss (!simpset)) 1 THEN |
|
58 |
ALLGOALS Asm_simp_tac) i; |
|
59 |
||
60 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY |
|
61 |
sends messages containing X! **) |
|
62 |
||
63 |
(*Spy never sees another agent's private key! (unless it's lost at start)*) |
|
64 |
goal thy |
|
65 |
"!!evs. evs : ns_public \ |
|
66 |
\ ==> (Key (priK A) : parts (sees lost Spy evs)) = (A : lost)"; |
|
67 |
by (parts_induct_tac 1); |
|
68 |
by (Auto_tac()); |
|
69 |
qed "Spy_see_priK"; |
|
70 |
Addsimps [Spy_see_priK]; |
|
71 |
||
72 |
goal thy |
|
73 |
"!!evs. evs : ns_public \ |
|
74 |
\ ==> (Key (priK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
75 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); |
|
76 |
qed "Spy_analz_priK"; |
|
77 |
Addsimps [Spy_analz_priK]; |
|
78 |
||
79 |
goal thy "!!A. [| Key (priK A) : parts (sees lost Spy evs); \ |
|
80 |
\ evs : ns_public |] ==> A:lost"; |
|
81 |
by (fast_tac (!claset addDs [Spy_see_priK]) 1); |
|
82 |
qed "Spy_see_priK_D"; |
|
83 |
||
84 |
bind_thm ("Spy_analz_priK_D", analz_subset_parts RS subsetD RS Spy_see_priK_D); |
|
85 |
AddSDs [Spy_see_priK_D, Spy_analz_priK_D]; |
|
86 |
||
87 |
||
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
88 |
fun analz_induct_tac i = |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
89 |
etac ns_public.induct i THEN |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
90 |
ALLGOALS (asm_simp_tac |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
91 |
(!simpset addsimps [not_parts_not_analz] |
2480 | 92 |
setloop split_tac [expand_if])); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
93 |
|
2318 | 94 |
|
95 |
(**** Authenticity properties obtained from NS2 ****) |
|
96 |
||
97 |
(*It is impossible to re-use a nonce in both NS1 and NS2, provided the nonce |
|
98 |
is secret. (Honest users generate fresh nonces.)*) |
|
99 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
100 |
"!!evs. [| Nonce NA ~: analz (sees lost Spy evs); \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
101 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs); \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
102 |
\ evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
103 |
\ ==> Crypt (pubK C) {|NA', Nonce NA|} ~: parts (sees lost Spy evs)"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
104 |
by (etac rev_mp 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
105 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
106 |
by (analz_induct_tac 1); |
2318 | 107 |
(*NS3*) |
2497 | 108 |
by (fast_tac (!claset addSEs partsEs) 4); |
2318 | 109 |
(*NS2*) |
2497 | 110 |
by (fast_tac (!claset addSEs partsEs) 3); |
2318 | 111 |
(*Fake*) |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
112 |
by (deepen_tac (!claset addSIs [analz_insertI] |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
113 |
addDs [impOfSubs analz_subset_parts, |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
114 |
impOfSubs Fake_parts_insert] |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
115 |
addss (!simpset)) 0 2); |
2318 | 116 |
(*Base*) |
2374 | 117 |
by (fast_tac (!claset addss (!simpset)) 1); |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
118 |
qed "no_nonce_NS1_NS2"; |
2318 | 119 |
|
120 |
||
2480 | 121 |
(*Unicity for NS1: nonce NA identifies agents A and B*) |
2318 | 122 |
goal thy |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
123 |
"!!evs. [| Nonce NA ~: analz (sees lost Spy evs); evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
124 |
\ ==> EX A' B'. ALL A B. \ |
2318 | 125 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs) --> \ |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
126 |
\ A=A' & B=B'"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
127 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
128 |
by (analz_induct_tac 1); |
2318 | 129 |
(*NS1*) |
2497 | 130 |
by (simp_tac (!simpset addsimps [all_conj_distrib]) 3); |
2318 | 131 |
by (expand_case_tac "NA = ?y" 3 THEN |
2497 | 132 |
REPEAT (fast_tac (!claset addSEs partsEs) 3)); |
2318 | 133 |
(*Base*) |
134 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
135 |
(*Fake*) |
|
2497 | 136 |
by (simp_tac (!simpset addsimps [all_conj_distrib, parts_insert_sees]) 1); |
2374 | 137 |
by (step_tac (!claset addSIs [analz_insertI]) 1); |
2318 | 138 |
by (ex_strip_tac 1); |
139 |
by (best_tac (!claset delrules [conjI] |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
140 |
addSDs [impOfSubs Fake_parts_insert] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
141 |
addDs [impOfSubs analz_subset_parts] |
2318 | 142 |
addss (!simpset)) 1); |
143 |
val lemma = result(); |
|
144 |
||
145 |
goal thy |
|
146 |
"!!evs. [| Crypt(pubK B) {|Nonce NA, Agent A|} : parts(sees lost Spy evs); \ |
|
147 |
\ Crypt(pubK B') {|Nonce NA, Agent A'|} : parts(sees lost Spy evs); \ |
|
148 |
\ Nonce NA ~: analz (sees lost Spy evs); \ |
|
149 |
\ evs : ns_public |] \ |
|
150 |
\ ==> A=A' & B=B'"; |
|
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
151 |
by (prove_unique_tac lemma 1); |
2318 | 152 |
qed "unique_NA"; |
153 |
||
154 |
||
155 |
(*Secrecy: Spy does not see the nonce sent in msg NS1 if A and B are secure*) |
|
156 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
157 |
"!!evs. [| Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) : set_of_list evs; \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
158 |
\ A ~: lost; B ~: lost; evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
159 |
\ ==> Nonce NA ~: analz (sees lost Spy evs)"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
160 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
161 |
by (analz_induct_tac 1); |
2318 | 162 |
(*NS3*) |
163 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
|
164 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 4); |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
165 |
(*NS2*) |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
166 |
by (deepen_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
167 |
addSEs [MPair_parts] |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
168 |
addDs [parts.Body, unique_NA]) 0 3); |
2318 | 169 |
(*NS1*) |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
170 |
by (fast_tac (!claset addSEs sees_Spy_partsEs |
2497 | 171 |
addIs [impOfSubs analz_subset_parts]) 2); |
2318 | 172 |
(*Fake*) |
2497 | 173 |
by (spy_analz_tac 1); |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
174 |
qed "Spy_not_see_NA"; |
2318 | 175 |
|
176 |
||
177 |
(*Authentication for A: if she receives message 2 and has used NA |
|
178 |
to start a run, then B has sent message 2.*) |
|
179 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
180 |
"!!evs. [| Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs;\ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
181 |
\ Says B' A (Crypt(pubK A) {|Nonce NA, Nonce NB|}): set_of_list evs;\ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
182 |
\ A ~: lost; B ~: lost; evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
183 |
\ ==> Says B A (Crypt(pubK A) {|Nonce NA, Nonce NB|}): set_of_list evs"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
184 |
by (etac rev_mp 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
185 |
(*prepare induction over Crypt (pubK A) {|NA,NB|} : parts H*) |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
186 |
by (etac (Says_imp_sees_Spy' RS parts.Inj RS rev_mp) 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
187 |
by (etac ns_public.induct 1); |
2318 | 188 |
by (ALLGOALS Asm_simp_tac); |
189 |
(*NS1*) |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
190 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 2); |
2318 | 191 |
(*Fake*) |
192 |
by (REPEAT_FIRST (resolve_tac [impI, conjI])); |
|
193 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
194 |
by (forward_tac [Spy_not_see_NA] 1 THEN REPEAT (assume_tac 1)); |
|
2324 | 195 |
by (best_tac (!claset addSIs [disjI2] |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
196 |
addSDs [impOfSubs Fake_parts_insert] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
197 |
addDs [impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
198 |
addss (!simpset)) 1); |
2318 | 199 |
(*NS2*) |
200 |
by (Step_tac 1); |
|
201 |
by (forward_tac [Spy_not_see_NA] 1 THEN REPEAT (assume_tac 1)); |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
202 |
by (deepen_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
203 |
addDs [unique_NA]) 1 1); |
2318 | 204 |
qed "A_trusts_NS2"; |
205 |
||
206 |
(*If the encrypted message appears then it originated with Alice in NS1*) |
|
207 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
208 |
"!!evs. [| Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees lost Spy evs); \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
209 |
\ Nonce NA ~: analz (sees lost Spy evs); \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
210 |
\ evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
211 |
\ ==> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set_of_list evs"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
212 |
by (etac rev_mp 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
213 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
214 |
by (analz_induct_tac 1); |
2318 | 215 |
(*Fake*) |
216 |
by (best_tac (!claset addSIs [disjI2] |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
217 |
addSDs [impOfSubs Fake_parts_insert] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
218 |
addIs [analz_insertI] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
219 |
addDs [impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
220 |
addss (!simpset)) 2); |
2318 | 221 |
(*Base*) |
222 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
223 |
qed_spec_mp "B_trusts_NS1"; |
|
224 |
||
225 |
||
226 |
||
227 |
(**** Authenticity properties obtained from NS2 ****) |
|
228 |
||
2480 | 229 |
(*Unicity for NS2: nonce NB identifies agent A and nonce NA |
2318 | 230 |
[proof closely follows that for unique_NA] *) |
231 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
232 |
"!!evs. [| Nonce NB ~: analz (sees lost Spy evs); evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
233 |
\ ==> EX A' NA'. ALL A NA. \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
234 |
\ Crypt (pubK A) {|Nonce NA, Nonce NB|} \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
235 |
\ : parts (sees lost Spy evs) --> A=A' & NA=NA'"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
236 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
237 |
by (analz_induct_tac 1); |
2318 | 238 |
(*NS2*) |
2497 | 239 |
by (simp_tac (!simpset addsimps [all_conj_distrib]) 3); |
2318 | 240 |
by (expand_case_tac "NB = ?y" 3 THEN |
2497 | 241 |
REPEAT (fast_tac (!claset addSEs partsEs) 3)); |
2318 | 242 |
(*Base*) |
243 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
244 |
(*Fake*) |
|
2497 | 245 |
by (simp_tac (!simpset addsimps [all_conj_distrib, parts_insert_sees]) 1); |
2374 | 246 |
by (step_tac (!claset addSIs [analz_insertI]) 1); |
2318 | 247 |
by (ex_strip_tac 1); |
248 |
by (best_tac (!claset delrules [conjI] |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
249 |
addSDs [impOfSubs Fake_parts_insert] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
250 |
addDs [impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
251 |
addss (!simpset)) 1); |
2318 | 252 |
val lemma = result(); |
253 |
||
254 |
goal thy |
|
255 |
"!!evs. [| Crypt(pubK A) {|Nonce NA, Nonce NB|} : parts(sees lost Spy evs); \ |
|
256 |
\ Crypt(pubK A'){|Nonce NA', Nonce NB|} : parts(sees lost Spy evs); \ |
|
257 |
\ Nonce NB ~: analz (sees lost Spy evs); \ |
|
258 |
\ evs : ns_public |] \ |
|
259 |
\ ==> A=A' & NA=NA'"; |
|
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
260 |
by (prove_unique_tac lemma 1); |
2318 | 261 |
qed "unique_NB"; |
262 |
||
263 |
||
264 |
(*NB remains secret PROVIDED Alice never responds with round 3*) |
|
265 |
goal thy |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
266 |
"!!evs.[| Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs;\ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
267 |
\ (ALL C. Says A C (Crypt (pubK C) (Nonce NB)) ~: set_of_list evs); \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
268 |
\ A ~: lost; B ~: lost; evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
269 |
\ ==> Nonce NB ~: analz (sees lost Spy evs)"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
270 |
by (etac rev_mp 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
271 |
by (etac rev_mp 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
272 |
by (analz_induct_tac 1); |
2318 | 273 |
(*NS1*) |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
274 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 2); |
2318 | 275 |
(*Fake*) |
2497 | 276 |
by (spy_analz_tac 1); |
2318 | 277 |
(*NS2 and NS3*) |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
278 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
279 |
by (step_tac (!claset delrules [allI]) 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
280 |
by (Fast_tac 5); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
281 |
by (fast_tac (!claset addSIs [impOfSubs analz_subset_parts]) 1); |
2318 | 282 |
(*NS2*) |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
283 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 2); |
2497 | 284 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
285 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 1); |
|
2318 | 286 |
(*NS3*) |
287 |
by (forw_inst_tac [("A'","A")] (Says_imp_sees_Spy' RS parts.Inj RS unique_NB) 1 |
|
288 |
THEN REPEAT (eresolve_tac [asm_rl, Says_imp_sees_Spy' RS parts.Inj] 1)); |
|
289 |
by (Fast_tac 1); |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
290 |
qed "Spy_not_see_NB"; |
2318 | 291 |
|
292 |
||
293 |
||
294 |
(*Authentication for B: if he receives message 3 and has used NB |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
295 |
in message 2, then A has sent message 3--to somebody....*) |
2318 | 296 |
goal thy |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
297 |
"!!evs. [| Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
298 |
\ : set_of_list evs; \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
299 |
\ Says A' B (Crypt (pubK B) (Nonce NB)): set_of_list evs; \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
300 |
\ A ~: lost; B ~: lost; evs : ns_public |] \ |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
301 |
\ ==> EX C. Says A C (Crypt (pubK C) (Nonce NB)) : set_of_list evs"; |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
302 |
by (etac rev_mp 1); |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
303 |
(*prepare induction over Crypt (pubK B) NB : parts H*) |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
304 |
by (etac (Says_imp_sees_Spy' RS parts.Inj RS rev_mp) 1); |
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
305 |
by (analz_induct_tac 1); |
2318 | 306 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib]))); |
307 |
(*NS1*) |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
308 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 2); |
2318 | 309 |
(*Fake*) |
310 |
by (REPEAT_FIRST (resolve_tac [impI, conjI])); |
|
311 |
by (fast_tac (!claset addss (!simpset)) 1); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
312 |
by (rtac (ccontr RS disjI2) 1); |
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
313 |
by (forward_tac [Spy_not_see_NB] 1 THEN (REPEAT_FIRST assume_tac) |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
314 |
THEN Fast_tac 1); |
2318 | 315 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert] |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
316 |
addDs [impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
317 |
addss (!simpset)) 1); |
2318 | 318 |
(*NS3*) |
319 |
by (Step_tac 1); |
|
2536
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
320 |
by (forward_tac [Spy_not_see_NB] 1 THEN (REPEAT_FIRST assume_tac) |
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
paulson
parents:
2516
diff
changeset
|
321 |
THEN Fast_tac 1); |
2318 | 322 |
by (best_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2497
diff
changeset
|
323 |
addDs [unique_NB]) 1); |
2318 | 324 |
qed "B_trusts_NS3"; |
325 |
||
326 |
||
327 |
(*Can we strengthen the secrecy theorem? NO*) |
|
328 |
goal thy |
|
329 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] \ |
|
330 |
\ ==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evs \ |
|
331 |
\ --> Nonce NB ~: analz (sees lost Spy evs)"; |
|
2418
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
paulson
parents:
2374
diff
changeset
|
332 |
by (analz_induct_tac 1); |
2318 | 333 |
(*NS1*) |
334 |
by (fast_tac (!claset addSEs partsEs |
|
2497 | 335 |
addSDs [Says_imp_sees_Spy' RS parts.Inj]) 2); |
2318 | 336 |
(*Fake*) |
2497 | 337 |
by (spy_analz_tac 1); |
2318 | 338 |
(*NS2 and NS3*) |
339 |
by (Step_tac 1); |
|
2497 | 340 |
by (fast_tac (!claset addSIs [impOfSubs analz_subset_parts, usedI]) 1); |
2318 | 341 |
(*NS2*) |
342 |
by (fast_tac (!claset addSEs partsEs |
|
2497 | 343 |
addSDs [Says_imp_sees_Spy' RS parts.Inj]) 2); |
2318 | 344 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] |
345 |
addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 1); |
|
346 |
(*NS3*) |
|
347 |
by (forw_inst_tac [("A'","A")] (Says_imp_sees_Spy' RS parts.Inj RS unique_NB) 1 |
|
348 |
THEN REPEAT (eresolve_tac [asm_rl, Says_imp_sees_Spy' RS parts.Inj] 1)); |
|
349 |
by (Step_tac 1); |
|
350 |
||
351 |
(* |
|
352 |
THIS IS THE ATTACK! |
|
353 |
Level 9 |
|
354 |
!!evs. [| A ~: lost; B ~: lost; evs : ns_public |] |
|
355 |
==> Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) |
|
356 |
: set_of_list evs --> |
|
357 |
Nonce NB ~: analz (sees lost Spy evs) |
|
358 |
1. !!evs Aa Ba B' NAa NBa evsa. |
|
359 |
[| A ~: lost; B ~: lost; evsa : ns_public; A ~= Ba; |
|
360 |
Says B' A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evsa; |
|
361 |
Says A Ba (Crypt (pubK Ba) {|Nonce NA, Agent A|}) : set_of_list evsa; |
|
362 |
Ba : lost; |
|
363 |
Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set_of_list evsa; |
|
364 |
Nonce NB ~: analz (sees lost Spy evsa) |] |
|
365 |
==> False |
|
366 |
*) |
|
367 |
||
368 |
||
369 |