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