author | paulson |
Thu, 19 Dec 1996 11:58:39 +0100 | |
changeset 2451 | ce85a2aafc7a |
parent 2417 | 95f275c8476e |
child 2516 | 4d68fbe6378b |
permissions | -rw-r--r-- |
1941 | 1 |
(* Title: HOL/Auth/OtwayRees |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "otway" for the Otway-Rees protocol. |
|
7 |
||
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
8 |
Version that encrypts Nonce NB |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
9 |
|
1941 | 10 |
From page 244 of |
11 |
Burrows, Abadi and Needham. A Logic of Authentication. |
|
12 |
Proc. Royal Soc. 426 (1989) |
|
13 |
*) |
|
14 |
||
15 |
open OtwayRees; |
|
16 |
||
17 |
proof_timing:=true; |
|
18 |
HOL_quantifiers := false; |
|
19 |
||
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
20 |
|
2328 | 21 |
(*A "possibility property": there are traces that reach the end*) |
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
22 |
goal thy |
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
23 |
"!!A B. [| A ~= B; A ~= Server; B ~= Server |] \ |
2032 | 24 |
\ ==> EX K. EX NA. EX evs: otway lost. \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
25 |
\ Says B A {|Nonce NA, Crypt (shrK A) {|Nonce NA, Key K|}|} \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
26 |
\ : set_of_list evs"; |
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
27 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
2032 | 28 |
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2); |
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
29 |
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver))); |
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
30 |
by (REPEAT_FIRST (resolve_tac [refl, conjI])); |
2104
f5c9a91e4b50
Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents:
2071
diff
changeset
|
31 |
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver)))); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
32 |
result(); |
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
33 |
|
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
34 |
|
1941 | 35 |
(**** Inductive proofs about otway ****) |
36 |
||
2104
f5c9a91e4b50
Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents:
2071
diff
changeset
|
37 |
(*Monotonicity*) |
2032 | 38 |
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost"; |
39 |
by (rtac subsetI 1); |
|
40 |
by (etac otway.induct 1); |
|
41 |
by (REPEAT_FIRST |
|
42 |
(best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono) |
|
43 |
:: otway.intrs)))); |
|
44 |
qed "otway_mono"; |
|
45 |
||
1941 | 46 |
(*Nobody sends themselves messages*) |
2032 | 47 |
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs"; |
48 |
by (etac otway.induct 1); |
|
1941 | 49 |
by (Auto_tac()); |
50 |
qed_spec_mp "not_Says_to_self"; |
|
51 |
Addsimps [not_Says_to_self]; |
|
52 |
AddSEs [not_Says_to_self RSN (2, rev_notE)]; |
|
53 |
||
54 |
||
55 |
(** For reasoning about the encrypted portion of messages **) |
|
56 |
||
2135 | 57 |
goal thy "!!evs. Says A' B {|N, Agent A, Agent B, X|} : set_of_list evs \ |
58 |
\ ==> X : analz (sees lost Spy evs)"; |
|
2032 | 59 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1); |
60 |
qed "OR2_analz_sees_Spy"; |
|
1941 | 61 |
|
2135 | 62 |
goal thy "!!evs. Says S B {|N, X, X'|} : set_of_list evs \ |
63 |
\ ==> X : analz (sees lost Spy evs)"; |
|
2032 | 64 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1); |
65 |
qed "OR4_analz_sees_Spy"; |
|
1941 | 66 |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
67 |
goal thy "!!evs. Says Server B {|NA, X, Crypt K' {|NB,K|}|} : set_of_list evs \ |
2135 | 68 |
\ ==> K : parts (sees lost Spy evs)"; |
1941 | 69 |
by (fast_tac (!claset addSEs partsEs |
2032 | 70 |
addSDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
2135 | 71 |
qed "Oops_parts_sees_Spy"; |
1941 | 72 |
|
73 |
(*OR2_analz... and OR4_analz... let us treat those cases using the same |
|
1964 | 74 |
argument as for the Fake case. This is possible for most, but not all, |
75 |
proofs: Fake does not invent new nonces (as in OR2), and of course Fake |
|
2032 | 76 |
messages originate from the Spy. *) |
1964 | 77 |
|
2032 | 78 |
bind_thm ("OR2_parts_sees_Spy", |
79 |
OR2_analz_sees_Spy RS (impOfSubs analz_subset_parts)); |
|
80 |
bind_thm ("OR4_parts_sees_Spy", |
|
81 |
OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts)); |
|
82 |
||
83 |
(*We instantiate the variable to "lost". Leaving it as a Var makes proofs |
|
84 |
harder to complete, since simplification does less for us.*) |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
85 |
val parts_Fake_tac = |
2032 | 86 |
let val tac = forw_inst_tac [("lost","lost")] |
87 |
in tac OR2_parts_sees_Spy 4 THEN |
|
88 |
tac OR4_parts_sees_Spy 6 THEN |
|
2135 | 89 |
tac Oops_parts_sees_Spy 7 |
2032 | 90 |
end; |
1941 | 91 |
|
2064 | 92 |
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *) |
93 |
fun parts_induct_tac i = SELECT_GOAL |
|
94 |
(DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN |
|
2171 | 95 |
(*Fake message*) |
96 |
TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
97 |
impOfSubs Fake_parts_insert] |
|
2064 | 98 |
addss (!simpset)) 2)) THEN |
99 |
(*Base case*) |
|
100 |
fast_tac (!claset addss (!simpset)) 1 THEN |
|
101 |
ALLGOALS Asm_simp_tac) i; |
|
1941 | 102 |
|
2032 | 103 |
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
104 |
sends messages containing X! **) |
1941 | 105 |
|
2064 | 106 |
(*Spy never sees another agent's shared key! (unless it's lost at start)*) |
1941 | 107 |
goal thy |
2135 | 108 |
"!!evs. evs : otway lost \ |
109 |
\ ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)"; |
|
2064 | 110 |
by (parts_induct_tac 1); |
1941 | 111 |
by (Auto_tac()); |
2135 | 112 |
qed "Spy_see_shrK"; |
113 |
Addsimps [Spy_see_shrK]; |
|
1941 | 114 |
|
2135 | 115 |
goal thy |
116 |
"!!evs. evs : otway lost \ |
|
117 |
\ ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)"; |
|
118 |
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); |
|
119 |
qed "Spy_analz_shrK"; |
|
120 |
Addsimps [Spy_analz_shrK]; |
|
1941 | 121 |
|
2135 | 122 |
goal thy "!!A. [| Key (shrK A) : parts (sees lost Spy evs); \ |
123 |
\ evs : otway lost |] ==> A:lost"; |
|
124 |
by (fast_tac (!claset addDs [Spy_see_shrK]) 1); |
|
125 |
qed "Spy_see_shrK_D"; |
|
1941 | 126 |
|
2135 | 127 |
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D); |
128 |
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D]; |
|
1941 | 129 |
|
130 |
||
131 |
(*** Future keys can't be seen or used! ***) |
|
132 |
||
2160 | 133 |
(*Nobody can have SEEN keys that will be generated in the future. *) |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
134 |
goal thy "!!i. evs : otway lost ==> \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
135 |
\ length evs <= i --> Key (newK i) ~: parts (sees lost Spy evs)"; |
2064 | 136 |
by (parts_induct_tac 1); |
2264
f298678bd54a
Weaking of injectivity assumptions for newK and newN:
paulson
parents:
2214
diff
changeset
|
137 |
by (REPEAT_FIRST (best_tac (!claset addEs [leD RS notE] |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
138 |
addDs [impOfSubs analz_subset_parts, |
2032 | 139 |
impOfSubs parts_insert_subset_Un, |
140 |
Suc_leD] |
|
141 |
addss (!simpset)))); |
|
2160 | 142 |
qed_spec_mp "new_keys_not_seen"; |
1941 | 143 |
Addsimps [new_keys_not_seen]; |
144 |
||
2160 | 145 |
(*Variant: old messages must contain old keys!*) |
1941 | 146 |
goal thy |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
147 |
"!!evs. [| Says A B X : set_of_list evs; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
148 |
\ Key (newK i) : parts {X}; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
149 |
\ evs : otway lost \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
150 |
\ |] ==> i < length evs"; |
2032 | 151 |
by (rtac ccontr 1); |
152 |
by (dtac leI 1); |
|
153 |
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy] |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
154 |
addIs [impOfSubs parts_mono]) 1); |
1941 | 155 |
qed "Says_imp_old_keys"; |
156 |
||
157 |
||
2160 | 158 |
(*** Future nonces can't be seen or used! ***) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
159 |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
160 |
goal thy "!!evs. evs : otway lost ==> \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
161 |
\ length evs <= i --> \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
162 |
\ Nonce (newN i) ~: parts (sees lost Spy evs)"; |
2160 | 163 |
by (parts_induct_tac 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
164 |
by (REPEAT_FIRST (fast_tac (!claset |
2032 | 165 |
addSEs partsEs |
2375 | 166 |
addSDs [Says_imp_sees_Spy RS parts.Inj] |
167 |
addEs [leD RS notE] |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
168 |
addDs [impOfSubs analz_subset_parts, |
2032 | 169 |
impOfSubs parts_insert_subset_Un, |
170 |
Suc_leD] |
|
171 |
addss (!simpset)))); |
|
2160 | 172 |
qed_spec_mp "new_nonces_not_seen"; |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
173 |
Addsimps [new_nonces_not_seen]; |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
174 |
|
2160 | 175 |
(*Variant: old messages must contain old nonces!*) |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
176 |
goal thy "!!evs. [| Says A B X : set_of_list evs; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
177 |
\ Nonce (newN i) : parts {X}; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
178 |
\ evs : otway lost \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
179 |
\ |] ==> i < length evs"; |
2032 | 180 |
by (rtac ccontr 1); |
181 |
by (dtac leI 1); |
|
182 |
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy] |
|
183 |
addIs [impOfSubs parts_mono]) 1); |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
184 |
qed "Says_imp_old_nonces"; |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
185 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
186 |
|
1941 | 187 |
(*Nobody can have USED keys that will be generated in the future. |
188 |
...very like new_keys_not_seen*) |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
189 |
goal thy "!!i. evs : otway lost ==> \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
190 |
\ length evs <= i --> newK i ~: keysFor(parts(sees lost Spy evs))"; |
2064 | 191 |
by (parts_induct_tac 1); |
1941 | 192 |
(*OR1 and OR3*) |
193 |
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2])); |
|
194 |
(*Fake, OR2, OR4: these messages send unknown (X) components*) |
|
2104
f5c9a91e4b50
Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents:
2071
diff
changeset
|
195 |
by (REPEAT |
f5c9a91e4b50
Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents:
2071
diff
changeset
|
196 |
(best_tac |
1996
33c42cae3dd0
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
paulson
parents:
1967
diff
changeset
|
197 |
(!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono), |
2032 | 198 |
impOfSubs (parts_insert_subset_Un RS keysFor_mono), |
199 |
Suc_leD] |
|
200 |
addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)] |
|
2104
f5c9a91e4b50
Replaced excluded_middle_tac by case_tac; tidied proofs
paulson
parents:
2071
diff
changeset
|
201 |
addss (!simpset)) 1)); |
2160 | 202 |
qed_spec_mp "new_keys_not_used"; |
1941 | 203 |
|
204 |
bind_thm ("new_keys_not_analzd", |
|
2032 | 205 |
[analz_subset_parts RS keysFor_mono, |
206 |
new_keys_not_used] MRS contra_subsetD); |
|
1941 | 207 |
|
208 |
Addsimps [new_keys_not_used, new_keys_not_analzd]; |
|
209 |
||
210 |
||
2064 | 211 |
|
212 |
(*** Proofs involving analz ***) |
|
213 |
||
2135 | 214 |
(*Describes the form of K and NA when the Server sends this message. Also |
215 |
for Oops case.*) |
|
2064 | 216 |
goal thy |
2135 | 217 |
"!!evs. [| Says Server B \ |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
218 |
\ {|NA, X, Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
219 |
\ evs : otway lost |] \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
220 |
\ ==> (EX n. K = Key(newK n)) & \ |
2135 | 221 |
\ (EX i. NA = Nonce i) & (EX j. NB = Nonce j)"; |
222 |
by (etac rev_mp 1); |
|
223 |
by (etac otway.induct 1); |
|
224 |
by (ALLGOALS (fast_tac (!claset addss (!simpset)))); |
|
225 |
qed "Says_Server_message_form"; |
|
2064 | 226 |
|
227 |
||
228 |
(*For proofs involving analz. We again instantiate the variable to "lost".*) |
|
229 |
val analz_Fake_tac = |
|
230 |
dres_inst_tac [("lost","lost")] OR2_analz_sees_Spy 4 THEN |
|
231 |
dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN |
|
2135 | 232 |
forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN |
233 |
assume_tac 7 THEN Full_simp_tac 7 THEN |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
234 |
REPEAT ((eresolve_tac [exE, conjE] ORELSE' hyp_subst_tac) 7); |
1941 | 235 |
|
236 |
||
237 |
(**** |
|
238 |
The following is to prove theorems of the form |
|
239 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
240 |
Key K : analz (insert (Key (newK i)) (sees lost Spy evs)) ==> |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
241 |
Key K : analz (sees lost Spy evs) |
1941 | 242 |
|
243 |
A more general formula must be proved inductively. |
|
244 |
****) |
|
245 |
||
246 |
||
247 |
(** Session keys are not used to encrypt other session keys **) |
|
248 |
||
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
249 |
(*The equality makes the induction hypothesis easier to apply*) |
1941 | 250 |
goal thy |
2032 | 251 |
"!!evs. evs : otway lost ==> \ |
252 |
\ ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \ |
|
253 |
\ (K : newK``E | Key K : analz (sees lost Spy evs))"; |
|
254 |
by (etac otway.induct 1); |
|
2064 | 255 |
by analz_Fake_tac; |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
256 |
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma])); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
257 |
by (ALLGOALS (*Takes 11 secs*) |
1941 | 258 |
(asm_simp_tac |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
259 |
(!simpset addsimps [Un_assoc RS sym, |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
260 |
insert_Key_singleton, insert_Key_image, pushKey_newK] |
1941 | 261 |
setloop split_tac [expand_if]))); |
2135 | 262 |
(*OR4, OR2, Fake*) |
263 |
by (EVERY (map spy_analz_tac [5,3,2])); |
|
264 |
(*Oops, OR3, Base*) |
|
2064 | 265 |
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1)); |
1941 | 266 |
qed_spec_mp "analz_image_newK"; |
267 |
||
268 |
||
269 |
goal thy |
|
2032 | 270 |
"!!evs. evs : otway lost ==> \ |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
271 |
\ Key K : analz (insert (Key(newK i)) (sees lost Spy evs)) = \ |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
272 |
\ (K = newK i | Key K : analz (sees lost Spy evs))"; |
1941 | 273 |
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, |
2032 | 274 |
insert_Key_singleton]) 1); |
1941 | 275 |
by (Fast_tac 1); |
276 |
qed "analz_insert_Key_newK"; |
|
277 |
||
278 |
||
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2014
diff
changeset
|
279 |
(*** The Key K uniquely identifies the Server's message. **) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
280 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
281 |
goal thy |
2135 | 282 |
"!!evs. evs : otway lost ==> \ |
283 |
\ EX B' NA' NB' X'. ALL B NA NB X. \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
284 |
\ Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|} : set_of_list evs --> \ |
2135 | 285 |
\ B=B' & NA=NA' & NB=NB' & X=X'"; |
2032 | 286 |
by (etac otway.induct 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
287 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
288 |
by (Step_tac 1); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
289 |
(*Remaining cases: OR3 and OR4*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
290 |
by (ex_strip_tac 2); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
291 |
by (Fast_tac 2); |
2064 | 292 |
by (expand_case_tac "K = ?y" 1); |
293 |
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2)); |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
294 |
(*...we assume X is a very new message, and handle this case by contradiction*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
295 |
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl] |
2032 | 296 |
delrules [conjI] (*prevent split-up into 4 subgoals*) |
297 |
addss (!simpset addsimps [parts_insertI])) 1); |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
298 |
val lemma = result(); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
299 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
300 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
301 |
"!!evs. [| Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|} \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
302 |
\ : set_of_list evs; \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
303 |
\ Says Server B' {|NA',X',Crypt (shrK B') {|NB',K|}|} \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
304 |
\ : set_of_list evs; \ |
2135 | 305 |
\ evs : otway lost |] ==> X=X' & B=B' & NA=NA' & NB=NB'"; |
2417 | 306 |
by (prove_unique_tac lemma 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
307 |
qed "unique_session_keys"; |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
308 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
309 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
310 |
|
2048 | 311 |
(**** Authenticity properties relating to NA ****) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
312 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
313 |
(*Only OR1 can have caused such a part of a message to appear.*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
314 |
goal thy |
2064 | 315 |
"!!evs. [| A ~: lost; evs : otway lost |] \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
316 |
\ ==> Crypt (shrK A) {|NA, Agent A, Agent B|} \ |
2064 | 317 |
\ : parts (sees lost Spy evs) --> \ |
318 |
\ Says A B {|NA, Agent A, Agent B, \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
319 |
\ Crypt (shrK A) {|NA, Agent A, Agent B|}|} \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
320 |
\ : set_of_list evs"; |
2064 | 321 |
by (parts_induct_tac 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
322 |
qed_spec_mp "Crypt_imp_OR1"; |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
323 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
324 |
|
2064 | 325 |
(** The Nonce NA uniquely identifies A's message. **) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
326 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
327 |
goal thy |
2032 | 328 |
"!!evs. [| evs : otway lost; A ~: lost |] \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
329 |
\ ==> EX B'. ALL B. \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
330 |
\ Crypt (shrK A) {|NA, Agent A, Agent B|} : parts (sees lost Spy evs) \ |
2048 | 331 |
\ --> B = B'"; |
2064 | 332 |
by (parts_induct_tac 1); |
333 |
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); |
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2014
diff
changeset
|
334 |
(*OR1: creation of new Nonce. Move assertion into global context*) |
2064 | 335 |
by (expand_case_tac "NA = ?y" 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
336 |
by (best_tac (!claset addSEs partsEs |
2032 | 337 |
addEs [new_nonces_not_seen RSN(2,rev_notE)]) 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
338 |
val lemma = result(); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
339 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
340 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
341 |
"!!evs.[| Crypt (shrK A) {|NA, Agent A, Agent B|}: parts(sees lost Spy evs); \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
342 |
\ Crypt (shrK A) {|NA, Agent A, Agent C|}: parts(sees lost Spy evs); \ |
2048 | 343 |
\ evs : otway lost; A ~: lost |] \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
344 |
\ ==> B = C"; |
2417 | 345 |
by (prove_unique_tac lemma 1); |
2048 | 346 |
qed "unique_NA"; |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
347 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
348 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
349 |
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
350 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
351 |
(*It is impossible to re-use a nonce in both OR1 and OR2. This holds because |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
352 |
OR2 encrypts Nonce NB. It prevents the attack that can occur in the |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
353 |
over-simplified version of this protocol: see OtwayRees_Bad.*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
354 |
goal thy |
2328 | 355 |
"!!evs. [| A ~: lost; evs : otway lost |] \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
356 |
\ ==> Crypt (shrK A) {|NA, Agent A, Agent B|} \ |
2328 | 357 |
\ : parts (sees lost Spy evs) --> \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
358 |
\ Crypt (shrK A) {|NA', NA, Agent A', Agent A|} \ |
2032 | 359 |
\ ~: parts (sees lost Spy evs)"; |
2071
0debdc018d26
Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents:
2064
diff
changeset
|
360 |
by (parts_induct_tac 1); |
0debdc018d26
Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents:
2064
diff
changeset
|
361 |
by (REPEAT (fast_tac (!claset addSEs (partsEs@[nonce_not_seen_now]) |
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2014
diff
changeset
|
362 |
addSDs [impOfSubs parts_insert_subset_Un] |
2071
0debdc018d26
Put in a simpler and *much* faster proof of no_nonce_OR1_OR2
paulson
parents:
2064
diff
changeset
|
363 |
addss (!simpset)) 1)); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
364 |
qed_spec_mp"no_nonce_OR1_OR2"; |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
365 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
366 |
|
2053 | 367 |
(*Crucial property: If the encrypted message appears, and A has used NA |
368 |
to start a run, then it originated with the Server!*) |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
369 |
goal thy |
2048 | 370 |
"!!evs. [| A ~: lost; A ~= Spy; evs : otway lost |] \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
371 |
\ ==> Crypt (shrK A) {|NA, Key K|} : parts (sees lost Spy evs) \ |
2048 | 372 |
\ --> Says A B {|NA, Agent A, Agent B, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
373 |
\ Crypt (shrK A) {|NA, Agent A, Agent B|}|} \ |
2048 | 374 |
\ : set_of_list evs --> \ |
375 |
\ (EX NB. Says Server B \ |
|
376 |
\ {|NA, \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
377 |
\ Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
378 |
\ Crypt (shrK B) {|NB, Key K|}|} \ |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
379 |
\ : set_of_list evs)"; |
2064 | 380 |
by (parts_induct_tac 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
381 |
(*OR1: it cannot be a new Nonce, contradiction.*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
382 |
by (fast_tac (!claset addSIs [parts_insertI] |
2032 | 383 |
addSEs partsEs |
384 |
addEs [Says_imp_old_nonces RS less_irrefl] |
|
385 |
addss (!simpset)) 1); |
|
2064 | 386 |
(*OR3 and OR4*) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
387 |
(*OR4*) |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
388 |
by (REPEAT (Safe_step_tac 2)); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
389 |
by (REPEAT (best_tac (!claset addSDs [parts_cut]) 3)); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
390 |
by (fast_tac (!claset addSIs [Crypt_imp_OR1] |
2032 | 391 |
addEs partsEs |
392 |
addDs [Says_imp_sees_Spy RS parts.Inj]) 2); |
|
2064 | 393 |
(*OR3*) (** LEVEL 5 **) |
394 |
by (asm_simp_tac (!simpset addsimps [ex_disj_distrib]) 1); |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
395 |
by (step_tac (!claset delrules [disjCI, impCE]) 1); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
396 |
by (fast_tac (!claset addSEs [MPair_parts] |
2032 | 397 |
addSDs [Says_imp_sees_Spy RS parts.Inj] |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
398 |
addEs [no_nonce_OR1_OR2 RSN (2, rev_notE)] |
2048 | 399 |
delrules [conjI] (*stop split-up into 4 subgoals*)) 2); |
400 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
401 |
addSEs [MPair_parts] |
|
402 |
addEs [unique_NA]) 1); |
|
403 |
qed_spec_mp "NA_Crypt_imp_Server_msg"; |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
404 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
405 |
|
2053 | 406 |
(*Corollary: if A receives B's OR4 message and the nonce NA agrees |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
407 |
then the key really did come from the Server! CANNOT prove this of the |
2048 | 408 |
bad form of this protocol, even though we can prove |
2032 | 409 |
Spy_not_see_encrypted_key*) |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
410 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
411 |
"!!evs. [| Says B' A {|NA, Crypt (shrK A) {|NA, Key K|}|} \ |
2053 | 412 |
\ : set_of_list evs; \ |
413 |
\ Says A B {|NA, Agent A, Agent B, \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
414 |
\ Crypt (shrK A) {|NA, Agent A, Agent B|}|} \ |
2053 | 415 |
\ : set_of_list evs; \ |
416 |
\ A ~: lost; A ~= Spy; evs : otway lost |] \ |
|
417 |
\ ==> EX NB. Says Server B \ |
|
2048 | 418 |
\ {|NA, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
419 |
\ Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
420 |
\ Crypt (shrK B) {|NB, Key K|}|} \ |
2053 | 421 |
\ : set_of_list evs"; |
2048 | 422 |
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg] |
2032 | 423 |
addEs partsEs |
424 |
addDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
|
2328 | 425 |
qed "A_trusts_OR4"; |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
426 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
427 |
|
2048 | 428 |
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3 |
429 |
Does not in itself guarantee security: an attack could violate |
|
430 |
the premises, e.g. by having A=Spy **) |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
431 |
|
1941 | 432 |
goal thy |
2166 | 433 |
"!!evs. [| A ~: lost; B ~: lost; evs : otway lost |] \ |
2048 | 434 |
\ ==> Says Server B \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
435 |
\ {|NA, Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
436 |
\ Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs --> \ |
2135 | 437 |
\ Says B Spy {|NA, NB, Key K|} ~: set_of_list evs --> \ |
2048 | 438 |
\ Key K ~: analz (sees lost Spy evs)"; |
2032 | 439 |
by (etac otway.induct 1); |
2064 | 440 |
by analz_Fake_tac; |
1964 | 441 |
by (ALLGOALS |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
442 |
(asm_simp_tac (!simpset addsimps [not_parts_not_analz, |
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2417
diff
changeset
|
443 |
analz_insert_Key_newK] |
2375 | 444 |
setloop split_tac [expand_if]))); |
1941 | 445 |
(*OR3*) |
2166 | 446 |
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl] |
2048 | 447 |
addss (!simpset addsimps [parts_insert2])) 3); |
2135 | 448 |
(*OR4, OR2, Fake*) |
2375 | 449 |
by (REPEAT_FIRST spy_analz_tac); |
2135 | 450 |
(*Oops*) (** LEVEL 5 **) |
451 |
by (fast_tac (!claset delrules [disjE] |
|
2171 | 452 |
addDs [unique_session_keys] addss (!simpset)) 1); |
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
453 |
val lemma = result() RS mp RS mp RSN(2,rev_notE); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
454 |
|
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
455 |
goal thy |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
456 |
"!!evs. [| Says Server B \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
457 |
\ {|NA, Crypt (shrK A) {|NA, K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
458 |
\ Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \ |
2135 | 459 |
\ Says B Spy {|NA, NB, K|} ~: set_of_list evs; \ |
2032 | 460 |
\ A ~: lost; B ~: lost; evs : otway lost |] \ |
461 |
\ ==> K ~: analz (sees lost Spy evs)"; |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
462 |
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1); |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1999
diff
changeset
|
463 |
by (fast_tac (!claset addSEs [lemma]) 1); |
2032 | 464 |
qed "Spy_not_see_encrypted_key"; |
465 |
||
1945 | 466 |
|
2032 | 467 |
goal thy |
2048 | 468 |
"!!evs. [| C ~: {A,B,Server}; \ |
469 |
\ Says Server B \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
470 |
\ {|NA, Crypt (shrK A) {|NA, K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
471 |
\ Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \ |
2135 | 472 |
\ Says B Spy {|NA, NB, K|} ~: set_of_list evs; \ |
2032 | 473 |
\ A ~: lost; B ~: lost; evs : otway lost |] \ |
474 |
\ ==> K ~: analz (sees lost C evs)"; |
|
475 |
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1); |
|
476 |
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1); |
|
477 |
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key)); |
|
478 |
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD]))); |
|
479 |
qed "Agent_not_see_encrypted_key"; |
|
1945 | 480 |
|
481 |
||
2048 | 482 |
(**** Authenticity properties relating to NB ****) |
483 |
||
484 |
(*Only OR2 can have caused such a part of a message to appear. We do not |
|
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
485 |
know anything about X: it does NOT have to have the right form.*) |
2048 | 486 |
goal thy |
487 |
"!!evs. [| B ~: lost; evs : otway lost |] \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
488 |
\ ==> Crypt (shrK B) {|NA, NB, Agent A, Agent B|} \ |
2048 | 489 |
\ : parts (sees lost Spy evs) --> \ |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
490 |
\ (EX X. Says B Server \ |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
491 |
\ {|NA, Agent A, Agent B, X, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
492 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|}|} \ |
2048 | 493 |
\ : set_of_list evs)"; |
2064 | 494 |
by (parts_induct_tac 1); |
495 |
by (auto_tac (!claset, !simpset addcongs [conj_cong])); |
|
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
496 |
bind_thm ("Crypt_imp_OR2", result() RSN (2,rev_mp) RS exE); |
2048 | 497 |
|
498 |
||
499 |
(** The Nonce NB uniquely identifies B's message. **) |
|
500 |
||
501 |
goal thy |
|
502 |
"!!evs. [| evs : otway lost; B ~: lost |] \ |
|
2064 | 503 |
\ ==> EX NA' A'. ALL NA A. \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
504 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|} : parts(sees lost Spy evs) \ |
2048 | 505 |
\ --> NA = NA' & A = A'"; |
2064 | 506 |
by (parts_induct_tac 1); |
507 |
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); |
|
2048 | 508 |
(*OR2: creation of new Nonce. Move assertion into global context*) |
2064 | 509 |
by (expand_case_tac "NB = ?y" 1); |
2048 | 510 |
by (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 1); |
511 |
val lemma = result(); |
|
512 |
||
513 |
goal thy |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
514 |
"!!evs.[| Crypt (shrK B) {|NA, NB, Agent A, Agent B|} \ |
2048 | 515 |
\ : parts(sees lost Spy evs); \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
516 |
\ Crypt (shrK B) {|NC, NB, Agent C, Agent B|} \ |
2048 | 517 |
\ : parts(sees lost Spy evs); \ |
518 |
\ evs : otway lost; B ~: lost |] \ |
|
519 |
\ ==> NC = NA & C = A"; |
|
2417 | 520 |
by (prove_unique_tac lemma 1); |
2048 | 521 |
qed "unique_NB"; |
522 |
||
523 |
||
524 |
(*If the encrypted message appears, and B has used Nonce NB, |
|
525 |
then it originated with the Server!*) |
|
526 |
goal thy |
|
527 |
"!!evs. [| B ~: lost; B ~= Spy; evs : otway lost |] \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
528 |
\ ==> Crypt (shrK B) {|NB, Key K|} : parts (sees lost Spy evs) \ |
2048 | 529 |
\ --> (ALL X'. Says B Server \ |
530 |
\ {|NA, Agent A, Agent B, X', \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
531 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|}|} \ |
2048 | 532 |
\ : set_of_list evs \ |
533 |
\ --> Says Server B \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
534 |
\ {|NA, Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
535 |
\ Crypt (shrK B) {|NB, Key K|}|} \ |
2048 | 536 |
\ : set_of_list evs)"; |
2064 | 537 |
by (parts_induct_tac 1); |
2048 | 538 |
(*OR1: it cannot be a new Nonce, contradiction.*) |
539 |
by (fast_tac (!claset addSIs [parts_insertI] |
|
540 |
addSEs partsEs |
|
541 |
addEs [Says_imp_old_nonces RS less_irrefl] |
|
542 |
addss (!simpset)) 1); |
|
543 |
(*OR4*) |
|
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
544 |
by (fast_tac (!claset addSEs [MPair_parts, Crypt_imp_OR2]) 2); |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
545 |
(*OR3*) |
2048 | 546 |
by (step_tac (!claset delrules [disjCI, impCE]) 1); |
547 |
by (fast_tac (!claset delrules [conjI] (*stop split-up*)) 3); |
|
548 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
549 |
addSEs [MPair_parts] |
|
550 |
addDs [unique_NB]) 2); |
|
551 |
by (fast_tac (!claset addSEs [MPair_parts] |
|
552 |
addSDs [Says_imp_sees_Spy RS parts.Inj] |
|
553 |
addSEs [no_nonce_OR1_OR2 RSN (2, rev_notE)] |
|
554 |
delrules [conjI, impCE] (*stop split-up*)) 1); |
|
555 |
qed_spec_mp "NB_Crypt_imp_Server_msg"; |
|
556 |
||
557 |
||
558 |
(*Guarantee for B: if it gets a message with matching NB then the Server |
|
559 |
has sent the correct message.*) |
|
560 |
goal thy |
|
561 |
"!!evs. [| B ~: lost; B ~= Spy; evs : otway lost; \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
562 |
\ Says S B {|NA, X, Crypt (shrK B) {|NB, Key K|}|} \ |
2048 | 563 |
\ : set_of_list evs; \ |
564 |
\ Says B Server {|NA, Agent A, Agent B, X', \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
565 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} \ |
2048 | 566 |
\ : set_of_list evs |] \ |
567 |
\ ==> Says Server B \ |
|
568 |
\ {|NA, \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
569 |
\ Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
570 |
\ Crypt (shrK B) {|NB, Key K|}|} \ |
2048 | 571 |
\ : set_of_list evs"; |
572 |
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg] |
|
573 |
addEs partsEs |
|
574 |
addDs [Says_imp_sees_Spy RS parts.Inj]) 1); |
|
2328 | 575 |
qed "B_trusts_OR3"; |
2048 | 576 |
|
577 |
||
2328 | 578 |
B_trusts_OR3 RS Spy_not_see_encrypted_key; |
2048 | 579 |
|
580 |
||
1945 | 581 |
goal thy |
2214 | 582 |
"!!evs. [| B ~: lost; evs : otway lost |] \ |
583 |
\ ==> Says Server B \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
584 |
\ {|NA, Crypt (shrK A) {|NA, Key K|}, \ |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
585 |
\ Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs --> \ |
2214 | 586 |
\ (EX X. Says B Server {|NA, Agent A, Agent B, X, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
587 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} \ |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
588 |
\ : set_of_list evs)"; |
2032 | 589 |
by (etac otway.induct 1); |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
590 |
by (Auto_tac()); |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
591 |
by (dtac (Says_imp_sees_Spy RS parts.Inj) 1); |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
592 |
by (fast_tac (!claset addSEs [MPair_parts, Crypt_imp_OR2]) 1); |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
593 |
bind_thm ("OR3_imp_OR2", result() RSN (2,rev_mp) RS exE); |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
594 |
|
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
595 |
|
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
596 |
(*After getting and checking OR4, agent A can trust that B has been active. |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
597 |
We could probably prove that X has the expected form, but that is not |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
598 |
strictly necessary for authentication.*) |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
599 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
600 |
"!!evs. [| Says B' A {|NA, Crypt (shrK A) {|NA, Key K|}|} \ |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
601 |
\ : set_of_list evs; \ |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
602 |
\ Says A B {|NA, Agent A, Agent B, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
603 |
\ Crypt (shrK A) {|NA, Agent A, Agent B|}|} \ |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
604 |
\ : set_of_list evs; \ |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
605 |
\ A ~: lost; A ~= Spy; B ~: lost; evs : otway lost |] \ |
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
606 |
\ ==> EX NB X. Says B Server {|NA, Agent A, Agent B, X, \ |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
607 |
\ Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |}\ |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
608 |
\ : set_of_list evs"; |
2328 | 609 |
by (fast_tac (!claset addSDs [A_trusts_OR4] |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
610 |
addSEs [OR3_imp_OR2]) 1); |
2194
63a68a3a8a76
Removal of an obsolete result, and authentication of
paulson
parents:
2171
diff
changeset
|
611 |
qed "A_auths_B"; |