author | paulson |
Mon, 20 Jan 1997 10:20:58 +0100 | |
changeset 2529 | e40ca839758d |
parent 2516 | 4d68fbe6378b |
child 2558 | 6e8d130463e3 |
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 |
||
1943 | 15 |
proof_timing:=true; |
1997 | 16 |
HOL_quantifiers := false; |
17 |
||
18 |
||
2323 | 19 |
(*A "possibility property": there are traces that reach the end*) |
1997 | 20 |
goal thy |
21 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
|
2032 | 22 |
\ ==> EX N K. EX evs: ns_shared lost. \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
23 |
\ Says A B (Crypt K {|Nonce N, Nonce N|}) : set_of_list evs"; |
1997 | 24 |
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
|
25 |
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
|
26 |
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
|
27 |
by possibility_tac; |
2015 | 28 |
result(); |
29 |
||
1943 | 30 |
|
1934 | 31 |
(**** Inductive proofs about ns_shared ****) |
32 |
||
2103 | 33 |
(*Monotonicity*) |
2032 | 34 |
goal thy "!!evs. lost' <= lost ==> ns_shared lost' <= ns_shared lost"; |
35 |
by (rtac subsetI 1); |
|
36 |
by (etac ns_shared.induct 1); |
|
37 |
by (REPEAT_FIRST |
|
38 |
(best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono) |
|
39 |
:: ns_shared.intrs)))); |
|
40 |
qed "ns_shared_mono"; |
|
41 |
||
42 |
||
1934 | 43 |
(*Nobody sends themselves messages*) |
2032 | 44 |
goal thy "!!evs. evs : ns_shared lost ==> ALL A X. Says A A X ~: set_of_list evs"; |
45 |
by (etac ns_shared.induct 1); |
|
1934 | 46 |
by (Auto_tac()); |
47 |
qed_spec_mp "not_Says_to_self"; |
|
48 |
Addsimps [not_Says_to_self]; |
|
49 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
50 |
||
1943 | 51 |
(*For reasoning about the encrypted portion of message NS3*) |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
52 |
goal thy "!!evs. Says S A (Crypt KA {|N, B, K, X|}) : set_of_list evs \ |
2131 | 53 |
\ ==> X : parts (sees lost Spy evs)"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
54 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1); |
2032 | 55 |
qed "NS3_msg_in_parts_sees_Spy"; |
56 |
||
2070 | 57 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
58 |
"!!evs. Says Server A (Crypt (shrK A) {|NA, B, K, X|}) : set_of_list evs \ |
2131 | 59 |
\ ==> K : parts (sees lost Spy evs)"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
60 |
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1); |
2131 | 61 |
qed "Oops_parts_sees_Spy"; |
2070 | 62 |
|
2032 | 63 |
val parts_Fake_tac = |
2070 | 64 |
dres_inst_tac [("lost","lost")] NS3_msg_in_parts_sees_Spy 5 THEN |
2131 | 65 |
forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 8; |
2070 | 66 |
|
67 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *) |
|
68 |
fun parts_induct_tac i = SELECT_GOAL |
|
69 |
(DETERM (etac ns_shared.induct 1 THEN parts_Fake_tac THEN |
|
2170 | 70 |
(*Fake message*) |
71 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
72 |
impOfSubs Fake_parts_insert] |
|
2070 | 73 |
addss (!simpset)) 2)) THEN |
74 |
(*Base case*) |
|
75 |
fast_tac (!claset addss (!simpset)) 1 THEN |
|
76 |
ALLGOALS Asm_simp_tac) i; |
|
77 |
||
1934 | 78 |
|
2032 | 79 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY |
2015 | 80 |
sends messages containing X! **) |
1934 | 81 |
|
2131 | 82 |
(*Spy never sees another agent's shared key! (unless it's lost at start)*) |
1934 | 83 |
goal thy |
2131 | 84 |
"!!evs. evs : ns_shared lost \ |
85 |
\ ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)"; |
|
2070 | 86 |
by (parts_induct_tac 1); |
1934 | 87 |
by (Auto_tac()); |
2131 | 88 |
qed "Spy_see_shrK"; |
89 |
Addsimps [Spy_see_shrK]; |
|
1934 | 90 |
|
2131 | 91 |
goal thy |
92 |
"!!evs. evs : ns_shared lost \ |
|
93 |
\ ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
94 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); |
|
95 |
qed "Spy_analz_shrK"; |
|
96 |
Addsimps [Spy_analz_shrK]; |
|
1934 | 97 |
|
2131 | 98 |
goal thy "!!A. [| Key (shrK A) : parts (sees lost Spy evs); \ |
99 |
\ evs : ns_shared lost |] ==> A:lost"; |
|
100 |
by (fast_tac (!claset addDs [Spy_see_shrK]) 1); |
|
101 |
qed "Spy_see_shrK_D"; |
|
1934 | 102 |
|
2131 | 103 |
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D); |
104 |
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D]; |
|
1934 | 105 |
|
2070 | 106 |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
107 |
(*Nobody can have used non-existent keys!*) |
2160 | 108 |
goal thy "!!evs. evs : ns_shared lost ==> \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
109 |
\ Key K ~: used evs --> K ~: keysFor (parts (sees lost Spy evs))"; |
2160 | 110 |
by (parts_induct_tac 1); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
111 |
(*Fake*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
112 |
by (best_tac |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
113 |
(!claset addIs [impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
114 |
addDs [impOfSubs (analz_subset_parts RS keysFor_mono), |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
115 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono)] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
116 |
addss (!simpset)) 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
117 |
(*NS2, NS4, NS5*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
118 |
by (REPEAT (fast_tac (!claset addSEs sees_Spy_partsEs addss (!simpset)) 1)); |
2160 | 119 |
qed_spec_mp "new_keys_not_used"; |
1934 | 120 |
|
121 |
bind_thm ("new_keys_not_analzd", |
|
2032 | 122 |
[analz_subset_parts RS keysFor_mono, |
123 |
new_keys_not_used] MRS contra_subsetD); |
|
1934 | 124 |
|
125 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
126 |
||
127 |
||
128 |
(** Lemmas concerning the form of items passed in messages **) |
|
129 |
||
2015 | 130 |
(*Describes the form of K, X and K' when the Server sends this message.*) |
1934 | 131 |
goal thy |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
132 |
"!!evs. [| Says Server A (Crypt K' {|N, Agent B, Key K, X|}) \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
133 |
\ : set_of_list evs; \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
134 |
\ evs : ns_shared lost |] \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
135 |
\ ==> K ~: range shrK & \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
136 |
\ X = (Crypt (shrK B) {|Key K, Agent A|}) & \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
137 |
\ K' = shrK A"; |
2032 | 138 |
by (etac rev_mp 1); |
139 |
by (etac ns_shared.induct 1); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
140 |
by (Auto_tac()); |
1934 | 141 |
qed "Says_Server_message_form"; |
142 |
||
143 |
||
2070 | 144 |
(*If the encrypted message appears then it originated with the Server*) |
1934 | 145 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
146 |
"!!evs. [| Crypt (shrK A) {|NA, Agent B, Key K, X|} \ |
2070 | 147 |
\ : parts (sees lost Spy evs); \ |
148 |
\ A ~: lost; evs : ns_shared lost |] \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
149 |
\ ==> X = (Crypt (shrK B) {|Key K, Agent A|}) & \ |
2070 | 150 |
\ Says Server A \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
151 |
\ (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
|
152 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \ |
2070 | 153 |
\ : set_of_list evs"; |
154 |
by (etac rev_mp 1); |
|
2131 | 155 |
by (parts_induct_tac 1); |
2015 | 156 |
by (Auto_tac()); |
2323 | 157 |
qed "A_trusts_NS2"; |
1934 | 158 |
|
1965 | 159 |
|
160 |
(*EITHER describes the form of X when the following message is sent, |
|
161 |
OR reduces it to the Fake case. |
|
162 |
Use Says_Server_message_form if applicable.*) |
|
1934 | 163 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
164 |
"!!evs. [| Says S A (Crypt (shrK A) {|Nonce NA, Agent B, Key K, X|}) \ |
2070 | 165 |
\ : set_of_list evs; evs : ns_shared lost |] \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
166 |
\ ==> (K ~: range shrK & X = (Crypt (shrK B) {|Key K, Agent A|})) \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
167 |
\ | X : analz (sees lost Spy evs)"; |
2103 | 168 |
by (case_tac "A : lost" 1); |
2032 | 169 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
2103 | 170 |
addss (!simpset)) 1); |
2070 | 171 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj] 1); |
2015 | 172 |
by (fast_tac (!claset addEs partsEs |
2323 | 173 |
addSDs [A_trusts_NS2, Says_Server_message_form] |
2070 | 174 |
addss (!simpset)) 1); |
1934 | 175 |
qed "Says_S_message_form"; |
176 |
||
177 |
||
2131 | 178 |
(*For proofs involving analz. We again instantiate the variable to "lost".*) |
179 |
val analz_Fake_tac = |
|
180 |
forw_inst_tac [("lost","lost")] Says_Server_message_form 8 THEN |
|
181 |
forw_inst_tac [("lost","lost")] 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
|
182 |
REPEAT_FIRST (eresolve_tac [asm_rl, conjE, disjE] ORELSE' hyp_subst_tac); |
2131 | 183 |
|
1934 | 184 |
|
185 |
(**** |
|
186 |
The following is to prove theorems of the form |
|
187 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
188 |
Key K : analz (insert (Key KAB) (sees lost Spy evs)) ==> |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
189 |
Key K : analz (sees lost Spy evs) |
1934 | 190 |
|
191 |
A more general formula must be proved inductively. |
|
192 |
||
193 |
****) |
|
194 |
||
195 |
||
196 |
(*NOT useful in this form, but it says that session keys are not used |
|
197 |
to encrypt messages containing other keys, in the actual protocol. |
|
198 |
We require that agents should behave like this subsequently also.*) |
|
199 |
goal thy |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
200 |
"!!evs. [| evs : ns_shared lost; Kab ~: range shrK |] ==> \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
201 |
\ (Crypt KAB X) : parts (sees lost Spy evs) & \ |
2032 | 202 |
\ Key K : parts {X} --> Key K : parts (sees lost Spy evs)"; |
203 |
by (etac ns_shared.induct 1); |
|
204 |
by parts_Fake_tac; |
|
2070 | 205 |
by (ALLGOALS Asm_simp_tac); |
1934 | 206 |
(*Deals with Faked messages*) |
207 |
by (best_tac (!claset addSEs partsEs |
|
2032 | 208 |
addDs [impOfSubs parts_insert_subset_Un] |
1965 | 209 |
addss (!simpset)) 2); |
210 |
(*Base, NS4 and NS5*) |
|
1934 | 211 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
212 |
result(); |
|
213 |
||
214 |
||
215 |
(** Session keys are not used to encrypt other session keys **) |
|
216 |
||
2015 | 217 |
(*The equality makes the induction hypothesis easier to apply*) |
1934 | 218 |
goal thy |
2032 | 219 |
"!!evs. evs : ns_shared lost ==> \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
220 |
\ ALL K KK. KK <= Compl (range shrK) --> \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
221 |
\ (Key K : analz (Key``KK Un (sees lost Spy evs))) = \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
222 |
\ (K : KK | Key K : analz (sees lost Spy evs))"; |
2032 | 223 |
by (etac ns_shared.induct 1); |
2131 | 224 |
by analz_Fake_tac; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
225 |
by (REPEAT_FIRST (resolve_tac [allI, impI])); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
226 |
by (REPEAT_FIRST (rtac analz_image_freshK_lemma )); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
227 |
(*Takes 24 secs*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
228 |
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss)); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
229 |
(*NS4, Fake*) |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
230 |
by (EVERY (map spy_analz_tac [3,2])); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
231 |
(*Base*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
232 |
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
233 |
qed_spec_mp "analz_image_freshK"; |
1934 | 234 |
|
235 |
||
236 |
goal thy |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
237 |
"!!evs. [| evs : ns_shared lost; KAB ~: range shrK |] ==> \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
238 |
\ Key K : analz (insert (Key KAB) (sees lost Spy evs)) = \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
239 |
\ (K = KAB | Key K : analz (sees lost Spy evs))"; |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
240 |
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
|
241 |
qed "analz_insert_freshK"; |
1934 | 242 |
|
243 |
||
2015 | 244 |
(** The session key K uniquely identifies the message, if encrypted |
245 |
with a secure key **) |
|
1965 | 246 |
|
1934 | 247 |
goal thy |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
248 |
"!!evs. evs : ns_shared lost ==> \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
249 |
\ EX A' NA' B' X'. ALL A NA B X. \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
250 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \ |
2070 | 251 |
\ : set_of_list evs --> A=A' & NA=NA' & B=B' & X=X'"; |
2032 | 252 |
by (etac ns_shared.induct 1); |
2070 | 253 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
2131 | 254 |
by (Step_tac 1); |
2070 | 255 |
(*NS3*) |
256 |
by (ex_strip_tac 2); |
|
257 |
by (Fast_tac 2); |
|
258 |
(*NS2: it can't be a new key*) |
|
259 |
by (expand_case_tac "K = ?y" 1); |
|
260 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
261 |
by (fast_tac (!claset delrules [conjI] (*prevent split-up into 4 subgoals*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
262 |
addSEs sees_Spy_partsEs |
2070 | 263 |
addss (!simpset addsimps [parts_insertI])) 1); |
1934 | 264 |
val lemma = result(); |
265 |
||
266 |
(*In messages of this form, the session key uniquely identifies the rest*) |
|
267 |
goal thy |
|
2070 | 268 |
"!!evs. [| Says Server A \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
269 |
\ (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \ |
2070 | 270 |
\ : set_of_list evs; \ |
271 |
\ Says Server A' \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
272 |
\ (Crypt (shrK A') {|NA', Agent B', Key K, X'|}) \ |
2070 | 273 |
\ : set_of_list evs; \ |
274 |
\ evs : ns_shared lost |] ==> A=A' & NA=NA' & B=B' & X = X'"; |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2374
diff
changeset
|
275 |
by (prove_unique_tac lemma 1); |
1934 | 276 |
qed "unique_session_keys"; |
277 |
||
278 |
||
2032 | 279 |
(** Crucial secrecy property: Spy does not see the keys sent in msg NS2 **) |
2015 | 280 |
|
1934 | 281 |
goal thy |
2323 | 282 |
"!!evs. [| A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
2015 | 283 |
\ ==> Says Server A \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
284 |
\ (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
|
285 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \ |
2070 | 286 |
\ : set_of_list evs --> \ |
287 |
\ (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs) --> \ |
|
2050
1b3343fa1278
Moved sees_lost_agent_subset_sees_Spy to common file, and simplified main thm
paulson
parents:
2045
diff
changeset
|
288 |
\ Key K ~: analz (sees lost Spy evs)"; |
2032 | 289 |
by (etac ns_shared.induct 1); |
2131 | 290 |
by analz_Fake_tac; |
1934 | 291 |
by (ALLGOALS |
2015 | 292 |
(asm_simp_tac |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
293 |
(!simpset addsimps ([not_parts_not_analz, analz_insert_freshK] @ pushes) |
1934 | 294 |
setloop split_tac [expand_if]))); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
295 |
(*NS4, Fake*) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
296 |
by (EVERY (map spy_analz_tac [4,1])); |
1934 | 297 |
(*NS2*) |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
298 |
by (fast_tac (!claset addSEs sees_Spy_partsEs |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
299 |
addIs [parts_insertI, impOfSubs analz_subset_parts] |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
300 |
addss (!simpset)) 1); |
2529 | 301 |
(*Oops*) |
302 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 2); |
|
303 |
(*NS3*) (**LEVEL 6 **) |
|
2070 | 304 |
by (step_tac (!claset delrules [impCE]) 1); |
2323 | 305 |
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trusts_NS2] 1); |
2170 | 306 |
by (assume_tac 2); |
2070 | 307 |
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 1); |
308 |
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1); |
|
309 |
val lemma = result() RS mp RS mp RSN(2,rev_notE); |
|
2015 | 310 |
|
311 |
||
312 |
(*Final version: Server's message in the most abstract form*) |
|
313 |
goal thy |
|
2070 | 314 |
"!!evs. [| Says Server A \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
315 |
\ (Crypt K' {|NA, Agent B, Key K, X|}) : set_of_list evs; \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
316 |
\ (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs); \ |
2070 | 317 |
\ A ~: lost; B ~: lost; evs : ns_shared lost \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
318 |
\ |] ==> Key K ~: analz (sees lost Spy evs)"; |
2015 | 319 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); |
320 |
by (fast_tac (!claset addSEs [lemma]) 1); |
|
2032 | 321 |
qed "Spy_not_see_encrypted_key"; |
322 |
||
323 |
||
324 |
goal thy |
|
2070 | 325 |
"!!evs. [| C ~: {A,B,Server}; \ |
326 |
\ Says Server A \ |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
327 |
\ (Crypt K' {|NA, Agent B, Key K, X|}) : set_of_list evs; \ |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
328 |
\ (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs); \ |
2070 | 329 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
330 |
\ ==> Key K ~: analz (sees lost C evs)"; |
2032 | 331 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1); |
332 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1); |
|
333 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key)); |
|
334 |
by (REPEAT_FIRST (fast_tac (!claset addIs [ns_shared_mono RS subsetD]))); |
|
335 |
qed "Agent_not_see_encrypted_key"; |
|
2070 | 336 |
|
337 |
||
338 |
||
339 |
(**** Guarantees available at various stages of protocol ***) |
|
340 |
||
2323 | 341 |
A_trusts_NS2 RS conjunct2 RS Spy_not_see_encrypted_key; |
2070 | 342 |
|
343 |
||
344 |
(*If the encrypted message appears then it originated with the Server*) |
|
345 |
goal thy |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
346 |
"!!evs. [| Crypt (shrK B) {|Key K, Agent A|} : parts (sees lost Spy evs); \ |
2070 | 347 |
\ B ~: lost; evs : ns_shared lost |] \ |
348 |
\ ==> EX NA. Says Server A \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
349 |
\ (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
|
350 |
\ Crypt (shrK B) {|Key K, Agent A|}|}) \ |
2070 | 351 |
\ : set_of_list evs"; |
352 |
by (etac rev_mp 1); |
|
353 |
by (etac ns_shared.induct 1); |
|
354 |
by parts_Fake_tac; |
|
355 |
(*Fake case*) |
|
356 |
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert] |
|
357 |
addDs [impOfSubs analz_subset_parts] |
|
358 |
addss (!simpset)) 2); |
|
359 |
by (Auto_tac()); |
|
2323 | 360 |
qed "B_trusts_NS3"; |
2070 | 361 |
|
362 |
||
363 |
goal thy |
|
2103 | 364 |
"!!evs. [| B ~: lost; evs : ns_shared lost |] \ |
365 |
\ ==> Key K ~: analz (sees lost Spy evs) --> \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
366 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \ |
2103 | 367 |
\ : set_of_list evs --> \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
368 |
\ Crypt K (Nonce NB) : parts (sees lost Spy evs) --> \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
369 |
\ Says B A (Crypt K (Nonce NB)) : set_of_list evs"; |
2070 | 370 |
by (etac ns_shared.induct 1); |
371 |
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5); |
|
372 |
by parts_Fake_tac; |
|
2103 | 373 |
by (TRYALL (rtac impI)); |
374 |
by (REPEAT_FIRST |
|
375 |
(dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD))); |
|
376 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
|
377 |
(**LEVEL 6**) |
|
378 |
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert] |
|
379 |
addDs [impOfSubs analz_subset_parts]) 1); |
|
380 |
by (Fast_tac 2); |
|
381 |
by (REPEAT_FIRST (rtac impI ORELSE' etac conjE ORELSE' hyp_subst_tac)); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
382 |
(*Subgoal 1: contradiction from the assumptions |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
383 |
Key K ~: used evsa and Crypt K (Nonce NB) : parts (sees lost Spy evsa) *) |
2170 | 384 |
by (dtac Crypt_imp_invKey_keysFor 1); |
2103 | 385 |
(**LEVEL 10**) |
2070 | 386 |
by (Asm_full_simp_tac 1); |
2170 | 387 |
by (rtac disjI1 1); |
2070 | 388 |
by (thin_tac "?PP-->?QQ" 1); |
389 |
by (case_tac "Ba : lost" 1); |
|
390 |
by (dtac Says_Crypt_lost 1 THEN assume_tac 1 THEN Fast_tac 1); |
|
2323 | 391 |
by (dtac (Says_imp_sees_Spy RS parts.Inj RS B_trusts_NS3) 1 THEN |
2070 | 392 |
REPEAT (assume_tac 1)); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
393 |
by (best_tac (!claset addDs [unique_session_keys]) 1); |
2103 | 394 |
val lemma = result(); |
395 |
||
396 |
goal thy |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
397 |
"!!evs. [| Crypt K (Nonce NB) : parts (sees lost Spy evs); \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
398 |
\ Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|}) \ |
2131 | 399 |
\ : set_of_list evs; \ |
2103 | 400 |
\ ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs; \ |
2131 | 401 |
\ A ~: lost; B ~: lost; evs : ns_shared lost |] \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
402 |
\ ==> Says B A (Crypt K (Nonce NB)) : set_of_list evs"; |
2103 | 403 |
by (fast_tac (!claset addSIs [lemma RS mp RS mp RS mp] |
2170 | 404 |
addSEs [Spy_not_see_encrypted_key RSN (2, rev_notE)]) 1); |
2323 | 405 |
qed "A_trusts_NS4"; |