| author | wenzelm |
| Sun, 28 Dec 1997 14:58:56 +0100 | |
| changeset 4489 | 749600cb5573 |
| parent 4477 | b3e5857d8d99 |
| child 4509 | 828148415197 |
| permissions | -rw-r--r-- |
| 1934 | 1 |
(* Title: HOL/Auth/NS_Shared |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "ns_shared" for Needham-Schroeder Shared-Key protocol. |
|
7 |
||
8 |
From page 247 of |
|
9 |
Burrows, Abadi and Needham. A Logic of Authentication. |
|
10 |
Proc. Royal Soc. 426 (1989) |
|
11 |
*) |
|
12 |
||
13 |
open NS_Shared; |
|
14 |
||
| 4449 | 15 |
set proof_timing; |
| 1997 | 16 |
HOL_quantifiers := false; |
17 |
||
| 4470 | 18 |
AddEs spies_partsEs; |
19 |
AddDs [impOfSubs analz_subset_parts]; |
|
20 |
AddDs [impOfSubs Fake_parts_insert]; |
|
21 |
||
| 1997 | 22 |
|
| 2323 | 23 |
(*A "possibility property": there are traces that reach the end*) |
| 1997 | 24 |
goal thy |
|
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset
|
25 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
26 |
\ ==> EX N K. EX evs: ns_shared. \ |
| 3465 | 27 |
\ Says A B (Crypt K {|Nonce N, Nonce N|}) : set evs";
|
| 1997 | 28 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
29 |
by (rtac (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
30 |
ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2); |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
31 |
by possibility_tac; |
| 2015 | 32 |
result(); |
33 |
||
|
3675
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
34 |
goal thy |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
35 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
36 |
\ ==> EX evs: ns_shared. \ |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
37 |
\ Says A B (Crypt ?K {|Nonce ?N, Nonce ?N|}) : set evs";
|
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
38 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
39 |
by (rtac (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
40 |
ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2); |
|
70dd312b70b2
Deleted the redundant simprule not_parts_not_analz
paulson
parents:
3651
diff
changeset
|
41 |
by possibility_tac; |
| 1943 | 42 |
|
| 1934 | 43 |
(**** Inductive proofs about ns_shared ****) |
44 |
||
45 |
(*Nobody sends themselves messages*) |
|
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
46 |
goal thy "!!evs. evs : ns_shared ==> ALL A X. Says A A X ~: set evs"; |
| 2032 | 47 |
by (etac ns_shared.induct 1); |
|
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4470
diff
changeset
|
48 |
by Auto_tac; |
| 1934 | 49 |
qed_spec_mp "not_Says_to_self"; |
50 |
Addsimps [not_Says_to_self]; |
|
51 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
52 |
||
| 1943 | 53 |
(*For reasoning about the encrypted portion of message NS3*) |
| 3465 | 54 |
goal thy "!!evs. Says S A (Crypt KA {|N, B, K, X|}) : set evs \
|
| 3683 | 55 |
\ ==> X : parts (spies evs)"; |
| 4470 | 56 |
by (Blast_tac 1); |
| 3683 | 57 |
qed "NS3_msg_in_parts_spies"; |
| 2032 | 58 |
|
| 2070 | 59 |
goal thy |
| 3465 | 60 |
"!!evs. Says Server A (Crypt (shrK A) {|NA, B, K, X|}) : set evs \
|
| 3683 | 61 |
\ ==> K : parts (spies evs)"; |
| 4470 | 62 |
by (Blast_tac 1); |
| 3683 | 63 |
qed "Oops_parts_spies"; |
| 2070 | 64 |
|
| 3683 | 65 |
(*For proving the easier theorems about X ~: parts (spies evs).*) |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
66 |
fun parts_induct_tac i = |
| 4331 | 67 |
EVERY [etac ns_shared.induct i, |
68 |
REPEAT (FIRSTGOAL analz_mono_contra_tac), |
|
69 |
forward_tac [Oops_parts_spies] (i+7), |
|
70 |
forward_tac [NS3_msg_in_parts_spies] (i+4), |
|
71 |
prove_simple_subgoals_tac i]; |
|
| 2070 | 72 |
|
| 1934 | 73 |
|
| 3683 | 74 |
(** Theorems of the form X ~: parts (spies evs) imply that NOBODY |
| 2015 | 75 |
sends messages containing X! **) |
| 1934 | 76 |
|
| 3683 | 77 |
(*Spy never sees another agent's shared key! (unless it's bad at start)*) |
| 1934 | 78 |
goal thy |
| 3683 | 79 |
"!!evs. evs : ns_shared ==> (Key (shrK A) : parts (spies evs)) = (A : bad)"; |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
80 |
by (parts_induct_tac 1); |
| 3961 | 81 |
by (ALLGOALS Blast_tac); |
| 2131 | 82 |
qed "Spy_see_shrK"; |
83 |
Addsimps [Spy_see_shrK]; |
|
| 1934 | 84 |
|
| 2131 | 85 |
goal thy |
| 3683 | 86 |
"!!evs. evs : ns_shared ==> (Key (shrK A) : analz (spies evs)) = (A : bad)"; |
|
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4470
diff
changeset
|
87 |
by Auto_tac; |
| 2131 | 88 |
qed "Spy_analz_shrK"; |
89 |
Addsimps [Spy_analz_shrK]; |
|
| 1934 | 90 |
|
| 4470 | 91 |
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), |
92 |
Spy_analz_shrK RSN (2, rev_iffD1)]; |
|
| 1934 | 93 |
|
| 2070 | 94 |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
95 |
(*Nobody can have used non-existent keys!*) |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
96 |
goal thy "!!evs. evs : ns_shared ==> \ |
| 3683 | 97 |
\ Key K ~: used evs --> K ~: keysFor (parts (spies evs))"; |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
98 |
by (parts_induct_tac 1); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
99 |
(*Fake*) |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
100 |
by (best_tac |
| 4091 | 101 |
(claset() addSDs [impOfSubs (parts_insert_subset_Un RS keysFor_mono)] |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
102 |
addIs [impOfSubs analz_subset_parts] |
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
103 |
addDs [impOfSubs (analz_subset_parts RS keysFor_mono)] |
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
104 |
addss (simpset())) 1); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
105 |
(*NS2, NS4, NS5*) |
| 4470 | 106 |
by (ALLGOALS (Blast_tac)); |
| 2160 | 107 |
qed_spec_mp "new_keys_not_used"; |
| 1934 | 108 |
|
109 |
bind_thm ("new_keys_not_analzd",
|
|
| 2032 | 110 |
[analz_subset_parts RS keysFor_mono, |
111 |
new_keys_not_used] MRS contra_subsetD); |
|
| 1934 | 112 |
|
113 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
114 |
||
115 |
||
116 |
(** Lemmas concerning the form of items passed in messages **) |
|
117 |
||
| 2015 | 118 |
(*Describes the form of K, X and K' when the Server sends this message.*) |
| 1934 | 119 |
goal thy |
| 3683 | 120 |
"!!evs. [| Says Server A (Crypt K' {|N, Agent B, Key K, X|}) : set evs; \
|
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
121 |
\ evs : ns_shared |] \ |
| 4267 | 122 |
\ ==> K ~: range shrK & \ |
123 |
\ X = (Crypt (shrK B) {|Key K, Agent A|}) & \
|
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
124 |
\ K' = shrK A"; |
| 2032 | 125 |
by (etac rev_mp 1); |
126 |
by (etac ns_shared.induct 1); |
|
|
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4470
diff
changeset
|
127 |
by Auto_tac; |
| 1934 | 128 |
qed "Says_Server_message_form"; |
129 |
||
130 |
||
| 2070 | 131 |
(*If the encrypted message appears then it originated with the Server*) |
| 1934 | 132 |
goal thy |
| 3683 | 133 |
"!!evs. [| Crypt (shrK A) {|NA, Agent B, Key K, X|} : parts (spies evs); \
|
| 4267 | 134 |
\ A ~: bad; evs : ns_shared |] \ |
135 |
\ ==> Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \
|
|
| 3651 | 136 |
\ : set evs"; |
| 2070 | 137 |
by (etac rev_mp 1); |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
138 |
by (parts_induct_tac 1); |
| 4470 | 139 |
by (Blast_tac 1); |
| 2323 | 140 |
qed "A_trusts_NS2"; |
| 1934 | 141 |
|
| 1965 | 142 |
|
| 4331 | 143 |
goal thy |
144 |
"!!evs. [| Crypt (shrK A) {|NA, Agent B, Key K, X|} : parts (spies evs); \
|
|
145 |
\ A ~: bad; evs : ns_shared |] \ |
|
146 |
\ ==> K ~: range shrK & X = (Crypt (shrK B) {|Key K, Agent A|})";
|
|
147 |
by (blast_tac (claset() addSDs [A_trusts_NS2, Says_Server_message_form]) 1); |
|
148 |
qed "cert_A_form"; |
|
149 |
||
150 |
||
| 1965 | 151 |
(*EITHER describes the form of X when the following message is sent, |
152 |
OR reduces it to the Fake case. |
|
153 |
Use Says_Server_message_form if applicable.*) |
|
| 1934 | 154 |
goal thy |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
155 |
"!!evs. [| Says S A (Crypt (shrK A) {|Nonce NA, Agent B, Key K, X|}) \
|
| 3651 | 156 |
\ : set evs; \ |
157 |
\ evs : ns_shared |] \ |
|
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
158 |
\ ==> (K ~: range shrK & X = (Crypt (shrK B) {|Key K, Agent A|})) \
|
| 3683 | 159 |
\ | X : analz (spies evs)"; |
160 |
by (case_tac "A : bad" 1); |
|
| 4091 | 161 |
by (fast_tac (claset() addSDs [Says_imp_spies RS analz.Inj] |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
162 |
addss (simpset())) 1); |
| 4470 | 163 |
by (blast_tac (claset() addSDs [cert_A_form]) 1); |
| 1934 | 164 |
qed "Says_S_message_form"; |
165 |
||
166 |
||
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
167 |
(*For proofs involving analz.*) |
| 3683 | 168 |
val analz_spies_tac = |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
169 |
forward_tac [Says_Server_message_form] 8 THEN |
|
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
170 |
forward_tac [Says_S_message_form] 5 THEN |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
171 |
REPEAT_FIRST (eresolve_tac [asm_rl, conjE, disjE] ORELSE' hyp_subst_tac); |
| 2131 | 172 |
|
| 1934 | 173 |
|
174 |
(**** |
|
175 |
The following is to prove theorems of the form |
|
176 |
||
| 3683 | 177 |
Key K : analz (insert (Key KAB) (spies evs)) ==> |
178 |
Key K : analz (spies evs) |
|
| 1934 | 179 |
|
180 |
A more general formula must be proved inductively. |
|
181 |
****) |
|
182 |
||
183 |
||
184 |
(*NOT useful in this form, but it says that session keys are not used |
|
185 |
to encrypt messages containing other keys, in the actual protocol. |
|
186 |
We require that agents should behave like this subsequently also.*) |
|
187 |
goal thy |
|
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
188 |
"!!evs. [| evs : ns_shared; Kab ~: range shrK |] ==> \ |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
189 |
\ (Crypt KAB X) : parts (spies evs) & \ |
| 3683 | 190 |
\ Key K : parts {X} --> Key K : parts (spies evs)";
|
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
191 |
by (parts_induct_tac 1); |
| 4470 | 192 |
(*Fake*) |
| 4091 | 193 |
by (blast_tac (claset() addSEs partsEs |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
194 |
addDs [impOfSubs parts_insert_subset_Un]) 1); |
| 1965 | 195 |
(*Base, NS4 and NS5*) |
|
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4470
diff
changeset
|
196 |
by Auto_tac; |
| 1934 | 197 |
result(); |
198 |
||
199 |
||
200 |
(** Session keys are not used to encrypt other session keys **) |
|
201 |
||
| 2015 | 202 |
(*The equality makes the induction hypothesis easier to apply*) |
| 1934 | 203 |
goal thy |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
204 |
"!!evs. evs : ns_shared ==> \ |
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
205 |
\ ALL K KK. KK <= Compl (range shrK) --> \ |
| 3683 | 206 |
\ (Key K : analz (Key``KK Un (spies evs))) = \ |
207 |
\ (K : KK | Key K : analz (spies evs))"; |
|
| 2032 | 208 |
by (etac ns_shared.induct 1); |
| 3683 | 209 |
by analz_spies_tac; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
210 |
by (REPEAT_FIRST (resolve_tac [allI, impI])); |
| 3961 | 211 |
by (REPEAT_FIRST (rtac analz_image_freshK_lemma)); |
212 |
(*Takes 9 secs*) |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
213 |
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss)); |
|
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3441
diff
changeset
|
214 |
(*Fake*) |
|
4422
21238c9d363e
Simplified proofs using rewrites for f``A where f is injective
paulson
parents:
4331
diff
changeset
|
215 |
by (spy_analz_tac 1); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
216 |
qed_spec_mp "analz_image_freshK"; |
| 1934 | 217 |
|
218 |
||
219 |
goal thy |
|
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
220 |
"!!evs. [| evs : ns_shared; KAB ~: range shrK |] ==> \ |
| 3683 | 221 |
\ Key K : analz (insert (Key KAB) (spies evs)) = \ |
222 |
\ (K = KAB | Key K : analz (spies evs))"; |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
223 |
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1); |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
224 |
qed "analz_insert_freshK"; |
| 1934 | 225 |
|
226 |
||
| 2558 | 227 |
(** The session key K uniquely identifies the message **) |
| 1965 | 228 |
|
| 1934 | 229 |
goal thy |
| 4267 | 230 |
"!!evs. evs : ns_shared ==> \ |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
231 |
\ EX A' NA' B' X'. ALL A NA B X. \ |
| 3683 | 232 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) : set evs \
|
233 |
\ --> A=A' & NA=NA' & B=B' & X=X'"; |
|
| 2032 | 234 |
by (etac ns_shared.induct 1); |
| 4091 | 235 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib]))); |
| 3730 | 236 |
by Safe_tac; |
| 2070 | 237 |
(*NS3*) |
238 |
by (ex_strip_tac 2); |
|
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
239 |
by (Blast_tac 2); |
| 2070 | 240 |
(*NS2: it can't be a new key*) |
241 |
by (expand_case_tac "K = ?y" 1); |
|
242 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); |
|
| 4470 | 243 |
by (Blast_tac 1); |
| 1934 | 244 |
val lemma = result(); |
245 |
||
246 |
(*In messages of this form, the session key uniquely identifies the rest*) |
|
247 |
goal thy |
|
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
248 |
"!!evs. [| Says Server A \ |
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
249 |
\ (Crypt (shrK A) {|NA, Agent B, Key K, X|}) : set evs; \
|
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
250 |
\ Says Server A' \ |
| 3683 | 251 |
\ (Crypt (shrK A') {|NA', Agent B', Key K, X'|}) : set evs; \
|
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
252 |
\ evs : ns_shared |] ==> A=A' & NA=NA' & B=B' & X = X'"; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
253 |
by (prove_unique_tac lemma 1); |
| 1934 | 254 |
qed "unique_session_keys"; |
255 |
||
256 |
||
| 2032 | 257 |
(** Crucial secrecy property: Spy does not see the keys sent in msg NS2 **) |
| 2015 | 258 |
|
| 1934 | 259 |
goal thy |
| 3961 | 260 |
"!!evs. [| A ~: bad; B ~: bad; evs : ns_shared |] \ |
| 2015 | 261 |
\ ==> Says Server A \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
262 |
\ (Crypt (shrK A) {|NA, Agent B, Key K, \
|
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
263 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \
|
|
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset
|
264 |
\ : set evs --> \ |
|
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset
|
265 |
\ (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set evs) --> \
|
| 3683 | 266 |
\ Key K ~: analz (spies evs)"; |
| 2032 | 267 |
by (etac ns_shared.induct 1); |
| 3683 | 268 |
by analz_spies_tac; |
| 1934 | 269 |
by (ALLGOALS |
| 2015 | 270 |
(asm_simp_tac |
| 4091 | 271 |
(simpset() addsimps ([analz_insert_eq, analz_insert_freshK] @ |
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
272 |
pushes @ expand_ifs)))); |
|
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3441
diff
changeset
|
273 |
(*Oops*) |
| 4091 | 274 |
by (blast_tac (claset() addDs [unique_session_keys]) 5); |
| 3679 | 275 |
(*NS3, replay sub-case*) |
|
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3441
diff
changeset
|
276 |
by (Blast_tac 4); |
| 1934 | 277 |
(*NS2*) |
| 4470 | 278 |
by (Blast_tac 2); |
|
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3441
diff
changeset
|
279 |
(*Fake*) |
|
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3441
diff
changeset
|
280 |
by (spy_analz_tac 1); |
| 3679 | 281 |
(*NS3, Server sub-case*) (**LEVEL 6 **) |
| 4091 | 282 |
by (clarify_tac (claset() delrules [impCE]) 1); |
| 3683 | 283 |
by (forward_tac [Says_imp_spies RS parts.Inj RS A_trusts_NS2] 1); |
| 2170 | 284 |
by (assume_tac 2); |
| 4091 | 285 |
by (blast_tac (claset() addDs [Says_imp_spies RS analz.Inj RS |
| 4470 | 286 |
Crypt_Spy_analz_bad]) 1); |
| 4091 | 287 |
by (blast_tac (claset() addDs [unique_session_keys]) 1); |
| 2070 | 288 |
val lemma = result() RS mp RS mp RSN(2,rev_notE); |
| 2015 | 289 |
|
290 |
||
291 |
(*Final version: Server's message in the most abstract form*) |
|
292 |
goal thy |
|
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
293 |
"!!evs. [| Says Server A \ |
| 4331 | 294 |
\ (Crypt K' {|NA, Agent B, Key K, X|}) : set evs; \
|
295 |
\ ALL NB. Says A Spy {|NA, NB, Key K|} ~: set evs; \
|
|
| 3683 | 296 |
\ A ~: bad; B ~: bad; evs : ns_shared \ |
297 |
\ |] ==> Key K ~: analz (spies evs)"; |
|
| 2015 | 298 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); |
| 4091 | 299 |
by (blast_tac (claset() addSDs [lemma]) 1); |
| 2032 | 300 |
qed "Spy_not_see_encrypted_key"; |
301 |
||
302 |
||
| 2070 | 303 |
(**** Guarantees available at various stages of protocol ***) |
304 |
||
| 3651 | 305 |
A_trusts_NS2 RS Spy_not_see_encrypted_key; |
| 2070 | 306 |
|
307 |
||
308 |
(*If the encrypted message appears then it originated with the Server*) |
|
309 |
goal thy |
|
|
4237
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
310 |
"!!evs. [| Crypt (shrK B) {|Key K, Agent A|} : parts (spies evs); \
|
|
fb01353e363b
The dtac was discarding information, though apparently no proofs were hurt
paulson
parents:
4091
diff
changeset
|
311 |
\ B ~: bad; evs : ns_shared |] \ |
| 2070 | 312 |
\ ==> EX NA. Says Server A \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
313 |
\ (Crypt (shrK A) {|NA, Agent B, Key K, \
|
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
314 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \
|
| 3465 | 315 |
\ : set evs"; |
| 2070 | 316 |
by (etac rev_mp 1); |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
317 |
by (parts_induct_tac 1); |
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
318 |
by (ALLGOALS Blast_tac); |
| 2323 | 319 |
qed "B_trusts_NS3"; |
| 2070 | 320 |
|
321 |
||
322 |
goal thy |
|
| 4331 | 323 |
"!!evs. [| Crypt K (Nonce NB) : parts (spies evs); \ |
324 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \
|
|
325 |
\ : set evs; \ |
|
326 |
\ Key K ~: analz (spies evs); \ |
|
327 |
\ evs : ns_shared |] \ |
|
328 |
\ ==> Says B A (Crypt K (Nonce NB)) : set evs"; |
|
329 |
by (etac rev_mp 1); |
|
330 |
by (etac rev_mp 1); |
|
331 |
by (etac rev_mp 1); |
|
332 |
by (parts_induct_tac 1); |
|
| 4267 | 333 |
(*NS3*) |
334 |
by (Blast_tac 3); |
|
| 4470 | 335 |
by (Blast_tac 1); |
| 4267 | 336 |
(*NS2: contradiction from the assumptions |
| 4331 | 337 |
Key K ~: used evs2 and Crypt K (Nonce NB) : parts (spies evs2) *) |
338 |
by (blast_tac (claset() addSEs [new_keys_not_used RSN (2,rev_notE)] |
|
339 |
addSDs [Crypt_imp_keysFor]) 1); |
|
340 |
(**LEVEL 7**) |
|
341 |
(*NS4*) |
|
342 |
by (Clarify_tac 1); |
|
343 |
by (not_bad_tac "Ba" 1); |
|
| 4470 | 344 |
by (blast_tac (claset() addDs [B_trusts_NS3, unique_session_keys]) 1); |
| 4331 | 345 |
qed "A_trusts_NS4_lemma"; |
| 2103 | 346 |
|
| 4331 | 347 |
|
348 |
(*This version no longer assumes that K is secure*) |
|
| 2103 | 349 |
goal thy |
| 4267 | 350 |
"!!evs. [| Crypt K (Nonce NB) : parts (spies evs); \ |
| 4331 | 351 |
\ Crypt (shrK A) {|NA, Agent B, Key K, X|} : parts (spies evs); \
|
|
3466
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
paulson
parents:
3465
diff
changeset
|
352 |
\ ALL NB. Says A Spy {|NA, NB, Key K|} ~: set evs; \
|
| 4267 | 353 |
\ A ~: bad; B ~: bad; evs : ns_shared |] \ |
| 3465 | 354 |
\ ==> Says B A (Crypt K (Nonce NB)) : set evs"; |
| 4331 | 355 |
by (blast_tac (claset() addSIs [A_trusts_NS2, A_trusts_NS4_lemma] |
| 4267 | 356 |
addSEs [Spy_not_see_encrypted_key RSN (2,rev_notE)]) 1); |
| 2323 | 357 |
qed "A_trusts_NS4"; |
| 4331 | 358 |
|
359 |
||
360 |
(*If the session key has been used in NS4 then somebody has forwarded |
|
361 |
component X in some instance of NS4. Perhaps an interesting property, |
|
362 |
but not needed (after all) for the proofs below.*) |
|
363 |
goal thy |
|
364 |
"!!evs. [| Crypt K (Nonce NB) : parts (spies evs); \ |
|
365 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \
|
|
366 |
\ : set evs; \ |
|
367 |
\ Key K ~: analz (spies evs); \ |
|
368 |
\ evs : ns_shared |] \ |
|
369 |
\ ==> EX A'. Says A' B X : set evs"; |
|
370 |
by (etac rev_mp 1); |
|
371 |
by (etac rev_mp 1); |
|
372 |
by (etac rev_mp 1); |
|
373 |
by (parts_induct_tac 1); |
|
374 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [ex_disj_distrib]))); |
|
375 |
by (ALLGOALS Clarify_tac); |
|
| 4470 | 376 |
by (Blast_tac 1); |
| 4331 | 377 |
(**LEVEL 7**) |
378 |
(*NS2*) |
|
379 |
by (blast_tac (claset() addSEs [new_keys_not_used RSN (2,rev_notE)] |
|
380 |
addSDs [Crypt_imp_keysFor]) 1); |
|
381 |
(*NS4*) |
|
382 |
by (not_bad_tac "Ba" 1); |
|
383 |
by (Asm_full_simp_tac 1); |
|
384 |
by (forward_tac [Says_imp_spies RS parts.Inj RS B_trusts_NS3] 1); |
|
385 |
by (ALLGOALS Clarify_tac); |
|
386 |
by (blast_tac (claset() addDs [unique_session_keys]) 1); |
|
387 |
qed "NS4_implies_NS3"; |
|
388 |
||
389 |
||
390 |
goal thy |
|
391 |
"!!evs. [| B ~: bad; evs : ns_shared |] \ |
|
392 |
\ ==> Key K ~: analz (spies evs) --> \ |
|
393 |
\ Says Server A \ |
|
394 |
\ (Crypt (shrK A) {|NA, Agent B, Key K, \
|
|
395 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \
|
|
396 |
\ : set evs --> \ |
|
397 |
\ Says B A (Crypt K (Nonce NB)) : set evs --> \ |
|
398 |
\ Crypt K {|Nonce NB, Nonce NB|} : parts (spies evs) --> \
|
|
399 |
\ Says A B (Crypt K {|Nonce NB, Nonce NB|}) : set evs";
|
|
400 |
by (parts_induct_tac 1); |
|
401 |
(*NS4*) |
|
| 4470 | 402 |
by (Blast_tac 4); |
| 4331 | 403 |
(*NS3*) |
| 4470 | 404 |
by (blast_tac (claset() addSDs [cert_A_form]) 3); |
| 4331 | 405 |
(*NS2*) |
406 |
by (blast_tac (claset() addSEs [new_keys_not_used RSN (2,rev_notE)] |
|
407 |
addSDs [Crypt_imp_keysFor]) 2); |
|
| 4470 | 408 |
by (Blast_tac 1); |
| 4331 | 409 |
(**LEVEL 5**) |
410 |
(*NS5*) |
|
411 |
by (Clarify_tac 1); |
|
412 |
by (not_bad_tac "Aa" 1); |
|
| 4470 | 413 |
by (blast_tac (claset() addDs [A_trusts_NS2, unique_session_keys]) 1); |
| 4331 | 414 |
val lemma = result(); |
415 |
||
416 |
||
417 |
(*Very strong Oops condition reveals protocol's weakness*) |
|
418 |
goal thy |
|
419 |
"!!evs. [| Crypt K {|Nonce NB, Nonce NB|} : parts (spies evs); \
|
|
420 |
\ Says B A (Crypt K (Nonce NB)) : set evs; \ |
|
421 |
\ Crypt (shrK B) {|Key K, Agent A|} : parts (spies evs); \
|
|
422 |
\ ALL NA NB. Says A Spy {|NA, NB, Key K|} ~: set evs; \
|
|
423 |
\ A ~: bad; B ~: bad; evs : ns_shared |] \ |
|
424 |
\ ==> Says A B (Crypt K {|Nonce NB, Nonce NB|}) : set evs";
|
|
425 |
by (dtac B_trusts_NS3 1); |
|
426 |
by (ALLGOALS Clarify_tac); |
|
427 |
by (blast_tac (claset() addSIs [normalize_thm [RSspec, RSmp] lemma] |
|
428 |
addSEs [Spy_not_see_encrypted_key RSN (2,rev_notE)]) 1); |
|
429 |
qed "B_trusts_NS5"; |