author | paulson |
Fri, 21 Jul 2000 18:01:36 +0200 | |
changeset 9403 | aad13b59b8d9 |
parent 6740 | 5b5bf511fdd5 |
child 9736 | 332fab43628f |
permissions | -rw-r--r-- |
5430 | 1 |
(* Title: HOL/Auth/NSP_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 |
||
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
14 |
fun impOfAlways th = |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
15 |
normalize_thm [RSspec,RSmp] |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
16 |
(th RS Always_includes_reachable RS subsetD RS CollectD); |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
17 |
|
5430 | 18 |
AddEs spies_partsEs; |
19 |
AddDs [impOfSubs analz_subset_parts]; |
|
20 |
AddDs [impOfSubs Fake_parts_insert]; |
|
21 |
||
22 |
AddIffs [Spy_in_bad]; |
|
23 |
||
24 |
(*For other theories, e.g. Mutex and Lift, using AddIffs slows proofs down. |
|
25 |
Here, it facilitates re-use of the Auth proofs.*) |
|
26 |
||
27 |
AddIffs (map simp_of_act [Fake_def, NS1_def, NS2_def, NS3_def]); |
|
28 |
||
29 |
Addsimps [Nprg_def RS def_prg_simps]; |
|
30 |
||
5648 | 31 |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
32 |
(*A "possibility property": there are traces that reach the end. |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
33 |
Replace by LEADSTO proof!*) |
5430 | 34 |
Goal "A ~= B ==> EX NB. EX s: reachable Nprg. \ |
35 |
\ Says A B (Crypt (pubK B) (Nonce NB)) : set s"; |
|
36 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
37 |
by (res_inst_tac [("act", "NS3")] reachable.Acts 2); |
|
38 |
by (res_inst_tac [("act", "NS2")] reachable.Acts 3); |
|
39 |
by (res_inst_tac [("act", "NS1")] reachable.Acts 4); |
|
5536 | 40 |
by (rtac reachable.Init 5); |
5648 | 41 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [Nprg_def]))); |
5536 | 42 |
by (REPEAT_FIRST (rtac exI )); |
5430 | 43 |
by possibility_tac; |
44 |
result(); |
|
45 |
||
46 |
||
47 |
(**** Inductive proofs about ns_public ****) |
|
48 |
||
49 |
(*can be used to simulate analz_mono_contra_tac |
|
50 |
val analz_impI = read_instantiate_sg (sign_of thy) |
|
51 |
[("P", "?Y ~: analz (spies ?evs)")] impI; |
|
52 |
||
53 |
val spies_Says_analz_contraD = |
|
54 |
spies_subset_spies_Says RS analz_mono RS contra_subsetD; |
|
55 |
||
56 |
by (rtac analz_impI 2); |
|
57 |
by (auto_tac (claset() addSDs [spies_Says_analz_contraD], simpset())); |
|
58 |
*) |
|
59 |
||
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
60 |
fun ns_constrains_tac i = |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
61 |
SELECT_GOAL |
6709 | 62 |
(EVERY [REPEAT (etac Always_ConstrainsI 1), |
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
63 |
REPEAT (resolve_tac [StableI, stableI, |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
64 |
constrains_imp_Constrains] 1), |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
65 |
rtac constrainsI 1, |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
66 |
Full_simp_tac 1, |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
67 |
REPEAT (FIRSTGOAL (etac disjE)), |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
68 |
ALLGOALS (clarify_tac (claset() delrules [impI,impCE])), |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
69 |
REPEAT (FIRSTGOAL analz_mono_contra_tac), |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
70 |
ALLGOALS Asm_simp_tac]) i; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
71 |
|
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
72 |
(*Tactic for proving secrecy theorems*) |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
73 |
val ns_induct_tac = |
5430 | 74 |
(SELECT_GOAL o EVERY) |
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
75 |
[rtac AlwaysI 1, |
5430 | 76 |
Force_tac 1, |
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
77 |
(*"reachable" gets in here*) |
6740 | 78 |
rtac (Always_reachable RS Always_ConstrainsI RS StableI) 1, |
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
79 |
ns_constrains_tac 1]; |
5430 | 80 |
|
81 |
||
82 |
(** Theorems of the form X ~: parts (spies evs) imply that NOBODY |
|
83 |
sends messages containing X! **) |
|
84 |
||
85 |
(*Spy never sees another agent's private key! (unless it's bad at start)*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
86 |
Goal "Nprg : Always {s. (Key (priK A) : parts (spies s)) = (A : bad)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
87 |
by (ns_induct_tac 1); |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
88 |
by (Blast_tac 1); |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
89 |
qed "Spy_see_priK"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
90 |
Addsimps [impOfAlways Spy_see_priK]; |
5430 | 91 |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
92 |
Goal "Nprg : Always {s. (Key (priK A) : analz (spies s)) = (A : bad)}"; |
6709 | 93 |
by (rtac (Always_reachable RS Always_weaken) 1); |
5430 | 94 |
by Auto_tac; |
95 |
qed "Spy_analz_priK"; |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
96 |
Addsimps [impOfAlways Spy_analz_priK]; |
5430 | 97 |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
98 |
(** |
5430 | 99 |
AddSDs [Spy_see_priK RSN (2, rev_iffD1), |
100 |
Spy_analz_priK RSN (2, rev_iffD1)]; |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
101 |
**) |
5430 | 102 |
|
103 |
||
104 |
(**** Authenticity properties obtained from NS2 ****) |
|
105 |
||
106 |
(*It is impossible to re-use a nonce in both NS1 and NS2, provided the nonce |
|
107 |
is secret. (Honest users generate fresh nonces.)*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
108 |
Goal |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
109 |
"Nprg \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
110 |
\ : Always {s. Nonce NA ~: analz (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
111 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
112 |
\ Crypt (pubK C) {|NA', Nonce NA|} ~: parts (spies s)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
113 |
by (ns_induct_tac 1); |
5430 | 114 |
by (ALLGOALS Blast_tac); |
115 |
qed "no_nonce_NS1_NS2"; |
|
116 |
||
117 |
(*Adding it to the claset slows down proofs...*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
118 |
val nonce_NS1_NS2_E = impOfAlways no_nonce_NS1_NS2 RSN (2, rev_notE); |
5430 | 119 |
|
120 |
||
121 |
(*Unicity for NS1: nonce NA identifies agents A and B*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
122 |
Goal |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
123 |
"Nprg \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
124 |
\ : Always {s. Nonce NA ~: analz (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
125 |
\ (EX A' B'. ALL A B. \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
126 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
127 |
\ A=A' & B=B')}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
128 |
by (ns_induct_tac 1); |
5430 | 129 |
by (ALLGOALS (simp_tac (simpset() addsimps [all_conj_distrib]))); |
130 |
(*NS1*) |
|
131 |
by (expand_case_tac "NA = ?y" 2 THEN Blast_tac 2); |
|
132 |
(*Fake*) |
|
133 |
by (Blast_tac 1); |
|
134 |
val lemma = result(); |
|
135 |
||
136 |
Goal "[| Crypt(pubK B) {|Nonce NA, Agent A|} : parts(spies s); \ |
|
137 |
\ Crypt(pubK B') {|Nonce NA, Agent A'|} : parts(spies s); \ |
|
138 |
\ Nonce NA ~: analz (spies s); \ |
|
139 |
\ s : reachable Nprg |] \ |
|
140 |
\ ==> A=A' & B=B'"; |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
141 |
by (prove_unique_tac (impOfAlways lemma) 1); |
5430 | 142 |
qed "unique_NA"; |
143 |
||
144 |
||
145 |
(*Secrecy: Spy does not see the nonce sent in msg NS1 if A and B are secure*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
146 |
Goal "[| A ~: bad; B ~: bad |] \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
147 |
\ ==> Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
148 |
\ {s. Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) : set s \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
149 |
\ --> Nonce NA ~: analz (spies s)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
150 |
by (ns_induct_tac 1); |
5430 | 151 |
(*NS3*) |
152 |
by (blast_tac (claset() addEs [nonce_NS1_NS2_E]) 4); |
|
153 |
(*NS2*) |
|
154 |
by (blast_tac (claset() addDs [unique_NA]) 3); |
|
155 |
(*NS1*) |
|
156 |
by (Blast_tac 2); |
|
157 |
(*Fake*) |
|
158 |
by (spy_analz_tac 1); |
|
159 |
qed "Spy_not_see_NA"; |
|
160 |
||
161 |
||
162 |
(*Authentication for A: if she receives message 2 and has used NA |
|
163 |
to start a run, then B has sent message 2.*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
164 |
val prems = |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
165 |
goal thy "[| A ~: bad; B ~: bad |] \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
166 |
\ ==> Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
167 |
\ {s. Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) : set s & \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
168 |
\ Crypt(pubK A) {|Nonce NA, Nonce NB|} : parts (knows Spy s) \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
169 |
\ --> Says B A (Crypt(pubK A) {|Nonce NA, Nonce NB|}): set s}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
170 |
(*insert an invariant for use in some of the subgoals*) |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
171 |
by (cut_facts_tac ([prems MRS Spy_not_see_NA] @ prems) 1); |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
172 |
by (ns_induct_tac 1); |
5430 | 173 |
by (ALLGOALS Clarify_tac); |
174 |
(*NS2*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
175 |
by (blast_tac (claset() addDs [unique_NA]) 3); |
5430 | 176 |
(*NS1*) |
177 |
by (Blast_tac 2); |
|
178 |
(*Fake*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
179 |
by (Blast_tac 1); |
5430 | 180 |
qed "A_trusts_NS2"; |
181 |
||
182 |
||
183 |
(*If the encrypted message appears then it originated with Alice in NS1*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
184 |
Goal "Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
185 |
\ {s. Nonce NA ~: analz (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
186 |
\ Crypt (pubK B) {|Nonce NA, Agent A|} : parts (spies s) \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
187 |
\ --> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set s}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
188 |
by (ns_induct_tac 1); |
5430 | 189 |
by (Blast_tac 1); |
190 |
qed "B_trusts_NS1"; |
|
191 |
||
192 |
||
193 |
||
194 |
(**** Authenticity properties obtained from NS2 ****) |
|
195 |
||
196 |
(*Unicity for NS2: nonce NB identifies nonce NA and agent A |
|
197 |
[proof closely follows that for unique_NA] *) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
198 |
Goal |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
199 |
"Nprg \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
200 |
\ : Always {s. Nonce NB ~: analz (spies s) --> \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
201 |
\ (EX A' NA'. ALL A NA. \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
202 |
\ Crypt (pubK A) {|Nonce NA, Nonce NB|} : parts (spies s) \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
203 |
\ --> A=A' & NA=NA')}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
204 |
by (ns_induct_tac 1); |
5430 | 205 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib]))); |
206 |
(*NS2*) |
|
207 |
by (expand_case_tac "NB = ?y" 2 THEN Blast_tac 2); |
|
208 |
(*Fake*) |
|
209 |
by (Blast_tac 1); |
|
210 |
val lemma = result(); |
|
211 |
||
212 |
Goal "[| Crypt(pubK A) {|Nonce NA, Nonce NB|} : parts(spies s); \ |
|
213 |
\ Crypt(pubK A'){|Nonce NA', Nonce NB|} : parts(spies s); \ |
|
214 |
\ Nonce NB ~: analz (spies s); \ |
|
215 |
\ s : reachable Nprg |] \ |
|
216 |
\ ==> A=A' & NA=NA'"; |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
217 |
by (prove_unique_tac (impOfAlways lemma) 1); |
5430 | 218 |
qed "unique_NB"; |
219 |
||
220 |
||
221 |
(*NB remains secret PROVIDED Alice never responds with round 3*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
222 |
Goal "[| A ~: bad; B ~: bad |] \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
223 |
\ ==> Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
224 |
\ {s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s & \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
225 |
\ (ALL C. Says A C (Crypt (pubK C) (Nonce NB)) ~: set s) \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
226 |
\ --> Nonce NB ~: analz (spies s)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
227 |
by (ns_induct_tac 1); |
5430 | 228 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib]))); |
229 |
by (ALLGOALS Clarify_tac); |
|
230 |
(*NS3: because NB determines A*) |
|
231 |
by (blast_tac (claset() addDs [unique_NB]) 4); |
|
232 |
(*NS2: by freshness and unicity of NB*) |
|
233 |
by (blast_tac (claset() addEs [nonce_NS1_NS2_E]) 3); |
|
234 |
(*NS1: by freshness*) |
|
235 |
by (Blast_tac 2); |
|
236 |
(*Fake*) |
|
237 |
by (spy_analz_tac 1); |
|
238 |
qed "Spy_not_see_NB"; |
|
239 |
||
240 |
||
241 |
||
242 |
(*Authentication for B: if he receives message 3 and has used NB |
|
243 |
in message 2, then A has sent message 3--to somebody....*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
244 |
val prems = |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
245 |
goal thy "[| A ~: bad; B ~: bad |] \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
246 |
\ ==> Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
247 |
\ {s. Crypt (pubK B) (Nonce NB) : parts (spies s) & \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
248 |
\ Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
249 |
\ --> (EX C. Says A C (Crypt (pubK C) (Nonce NB)) : set s)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
250 |
(*insert an invariant for use in some of the subgoals*) |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
251 |
by (cut_facts_tac ([prems MRS Spy_not_see_NB] @ prems) 1); |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
252 |
by (ns_induct_tac 1); |
5430 | 253 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [ex_disj_distrib]))); |
254 |
by (ALLGOALS Clarify_tac); |
|
255 |
(*NS3: because NB determines A (this use of unique_NB is more robust) *) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
256 |
by (blast_tac (claset() addIs [unique_NB RS conjunct1]) 3); |
5430 | 257 |
(*NS1: by freshness*) |
258 |
by (Blast_tac 2); |
|
259 |
(*Fake*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
260 |
by (Blast_tac 1); |
5430 | 261 |
qed "B_trusts_NS3"; |
262 |
||
263 |
||
264 |
(*Can we strengthen the secrecy theorem? NO*) |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
265 |
Goal "[| A ~: bad; B ~: bad |] \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
266 |
\ ==> Nprg : Always \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
267 |
\ {s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s \ |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
268 |
\ --> Nonce NB ~: analz (spies s)}"; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
269 |
by (ns_induct_tac 1); |
5430 | 270 |
by (ALLGOALS Clarify_tac); |
271 |
(*NS2: by freshness and unicity of NB*) |
|
272 |
by (blast_tac (claset() addEs [nonce_NS1_NS2_E]) 3); |
|
273 |
(*NS1: by freshness*) |
|
274 |
by (Blast_tac 2); |
|
275 |
(*Fake*) |
|
276 |
by (spy_analz_tac 1); |
|
277 |
(*NS3: unicity of NB identifies A and NA, but not B*) |
|
278 |
by (forw_inst_tac [("A'","A")] (Says_imp_spies RS parts.Inj RS unique_NB) 1 |
|
279 |
THEN REPEAT (eresolve_tac [asm_rl, Says_imp_spies RS parts.Inj] 1)); |
|
280 |
by Auto_tac; |
|
281 |
by (rename_tac "s B' C" 1); |
|
282 |
||
283 |
(* |
|
284 |
THIS IS THE ATTACK! |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
285 |
[| A ~: bad; B ~: bad |] |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
286 |
==> Nprg |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
287 |
: Always |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
288 |
{s. Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s --> |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
289 |
Nonce NB ~: analz (knows Spy s)} |
5430 | 290 |
1. !!s B' C. |
291 |
[| A ~: bad; B ~: bad; s : reachable Nprg; |
|
292 |
Says A C (Crypt (pubK C) {|Nonce NA, Agent A|}) : set s; |
|
6673
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
293 |
Says B' A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
294 |
C : bad; Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB|}) : set s; |
ca95af28fb33
redid proofs to use "always" rather than "reachable" (somewhat)
paulson
parents:
6570
diff
changeset
|
295 |
Nonce NB ~: analz (knows Spy s) |] |
5430 | 296 |
==> False |
297 |
*) |