author | paulson |
Tue, 27 Feb 2001 16:13:23 +0100 | |
changeset 11185 | 1b737b4c2108 |
parent 11150 | 67387142225e |
permissions | -rw-r--r-- |
2449 | 1 |
(* Title: HOL/Auth/Recur |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Inductive relation "recur" for the Recursive Authentication protocol. |
|
7 |
*) |
|
8 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
9 |
Pretty.setdepth 30; |
2449 | 10 |
|
11150 | 11 |
AddDs [Says_imp_knows_Spy RS parts.Inj, parts.Body]; |
12 |
AddDs [impOfSubs analz_subset_parts, impOfSubs Fake_parts_insert]; |
|
5359 | 13 |
|
14 |
||
2449 | 15 |
(** Possibility properties: traces that reach the end |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
16 |
ONE theorem would be more elegant and faster! |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
17 |
By induction on a list of agents (no repetitions) |
2449 | 18 |
**) |
19 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
20 |
|
2449 | 21 |
(*Simplest case: Alice goes directly to the server*) |
11104 | 22 |
Goal "\\<exists>K NA. \\<exists>evs \\<in> recur. \ |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
23 |
\ Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|}, \ |
11104 | 24 |
\ END|} \\<in> set evs"; |
2449 | 25 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
26 |
by (rtac (recur.Nil RS recur.RA1 RS (respond.One RSN (3,recur.RA3))) 2); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
27 |
by possibility_tac; |
2449 | 28 |
result(); |
29 |
||
30 |
||
31 |
(*Case two: Alice, Bob and the server*) |
|
11104 | 32 |
Goal "\\<exists>K. \\<exists>NA. \\<exists>evs \\<in> recur. \ |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
33 |
\ Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \ |
11104 | 34 |
\ END|} \\<in> set evs"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
35 |
by (cut_facts_tac [Nonce_supply2, Key_supply2] 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
36 |
by (REPEAT (eresolve_tac [exE, conjE] 1)); |
2449 | 37 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
38 |
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
39 |
(respond.One RS respond.Cons RSN (3,recur.RA3)) RS |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
40 |
recur.RA4) 2); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
41 |
by basic_possibility_tac; |
5351 | 42 |
by (DEPTH_SOLVE (eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1)); |
2449 | 43 |
result(); |
44 |
||
45 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
46 |
(*Case three: Alice, Bob, Charlie and the server |
2533 | 47 |
TOO SLOW to run every time! |
11104 | 48 |
Goal "\\<exists>K. \\<exists>NA. \\<exists>evs \\<in> recur. \ |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
49 |
\ Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \ |
11104 | 50 |
\ END|} \\<in> set evs"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
51 |
by (cut_facts_tac [Nonce_supply3, Key_supply3] 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
52 |
by (REPEAT (eresolve_tac [exE, conjE] 1)); |
2449 | 53 |
by (REPEAT (resolve_tac [exI,bexI] 1)); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
54 |
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS recur.RA2 RS |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
55 |
(respond.One RS respond.Cons RS respond.Cons RSN |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
56 |
(3,recur.RA3)) RS recur.RA4 RS recur.RA4) 2); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
57 |
by basic_possibility_tac; |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
58 |
by (DEPTH_SOLVE (swap_res_tac [refl, conjI, disjCI] 1 |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
59 |
ORELSE |
5351 | 60 |
eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1)); |
2449 | 61 |
result(); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
62 |
****************) |
2449 | 63 |
|
64 |
(**** Inductive proofs about recur ****) |
|
65 |
||
11104 | 66 |
Goal "(PA,RB,KAB) \\<in> respond evs ==> Key KAB \\<notin> used evs"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
67 |
by (etac respond.induct 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
68 |
by (REPEAT (assume_tac 1)); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
69 |
qed "respond_imp_not_used"; |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
70 |
|
11104 | 71 |
Goal "[| Key K \\<in> parts {RB}; (PB,RB,K') \\<in> respond evs |] ==> Key K \\<notin> used evs"; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
72 |
by (etac rev_mp 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
73 |
by (etac respond.induct 1); |
4091 | 74 |
by (auto_tac(claset() addDs [Key_not_used, respond_imp_not_used], |
75 |
simpset())); |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
76 |
qed_spec_mp "Key_in_parts_respond"; |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
77 |
|
2449 | 78 |
(*Simple inductive reasoning about responses*) |
11104 | 79 |
Goal "(PA,RB,KAB) \\<in> respond evs ==> RB \\<in> responses evs"; |
2449 | 80 |
by (etac respond.induct 1); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
81 |
by (REPEAT (ares_tac (respond_imp_not_used::responses.intrs) 1)); |
2449 | 82 |
qed "respond_imp_responses"; |
83 |
||
84 |
||
85 |
(** For reasoning about the encrypted portion of messages **) |
|
86 |
||
3683 | 87 |
val RA2_analz_spies = Says_imp_spies RS analz.Inj |> standard; |
2449 | 88 |
|
11104 | 89 |
Goal "Says C' B {|Crypt K X, X', RA|} \\<in> set evs ==> RA \\<in> analz (spies evs)"; |
4091 | 90 |
by (blast_tac (claset() addSDs [Says_imp_spies RS analz.Inj]) 1); |
3683 | 91 |
qed "RA4_analz_spies"; |
2449 | 92 |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
93 |
(*RA2_analz... and RA4_analz... let us treat those cases using the same |
2449 | 94 |
argument as for the Fake case. This is possible for most, but not all, |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
95 |
proofs: Fake does not invent new nonces (as in RA2), and of course Fake |
2449 | 96 |
messages originate from the Spy. *) |
97 |
||
3683 | 98 |
bind_thm ("RA2_parts_spies", |
99 |
RA2_analz_spies RS (impOfSubs analz_subset_parts)); |
|
100 |
bind_thm ("RA4_parts_spies", |
|
101 |
RA4_analz_spies RS (impOfSubs analz_subset_parts)); |
|
2449 | 102 |
|
11104 | 103 |
(*For proving the easier theorems about X \\<notin> parts (spies evs).*) |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
104 |
fun parts_induct_tac i = |
5359 | 105 |
EVERY [etac recur.induct i, |
7499 | 106 |
ftac RA4_parts_spies (i+5), |
107 |
ftac respond_imp_responses (i+4), |
|
108 |
ftac RA2_parts_spies (i+3), |
|
5359 | 109 |
prove_simple_subgoals_tac i]; |
2449 | 110 |
|
111 |
||
11104 | 112 |
(** Theorems of the form X \\<notin> parts (spies evs) imply that NOBODY |
2449 | 113 |
sends messages containing X! **) |
114 |
||
115 |
||
3683 | 116 |
(** Spy never sees another agent's shared key! (unless it's bad at start) **) |
2449 | 117 |
|
11104 | 118 |
Goal "evs \\<in> recur ==> (Key (shrK A) \\<in> parts (spies evs)) = (A \\<in> bad)"; |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
119 |
by (parts_induct_tac 1); |
5359 | 120 |
by Auto_tac; |
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
121 |
(*RA3*) |
5359 | 122 |
by (auto_tac (claset() addDs [Key_in_parts_respond], |
123 |
simpset() addsimps [parts_insert_spies])); |
|
2449 | 124 |
qed "Spy_see_shrK"; |
125 |
Addsimps [Spy_see_shrK]; |
|
126 |
||
11104 | 127 |
Goal "evs \\<in> recur ==> (Key (shrK A) \\<in> analz (spies evs)) = (A \\<in> bad)"; |
5359 | 128 |
by Auto_tac; |
2449 | 129 |
qed "Spy_analz_shrK"; |
130 |
Addsimps [Spy_analz_shrK]; |
|
131 |
||
4471 | 132 |
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), |
133 |
Spy_analz_shrK RSN (2, rev_iffD1)]; |
|
2449 | 134 |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
135 |
|
2449 | 136 |
|
137 |
(*** Proofs involving analz ***) |
|
138 |
||
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
139 |
(*For proofs involving analz.*) |
3683 | 140 |
val analz_spies_tac = |
141 |
dtac RA2_analz_spies 4 THEN |
|
11104 | 142 |
ftac respond_imp_responses 5 THEN |
3683 | 143 |
dtac RA4_analz_spies 6; |
2449 | 144 |
|
145 |
||
146 |
(** Session keys are not used to encrypt other session keys **) |
|
147 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
148 |
(*Version for "responses" relation. Handles case RA3 in the theorem below. |
3683 | 149 |
Note that it holds for *any* set H (not just "spies evs") |
2449 | 150 |
satisfying the inductive hypothesis.*) |
11104 | 151 |
Goal "[| RB \\<in> responses evs; \ |
152 |
\ \\<forall>K KK. KK \\<subseteq> - (range shrK) --> \ |
|
153 |
\ (Key K \\<in> analz (Key`KK Un H)) = \ |
|
154 |
\ (K \\<in> KK | Key K \\<in> analz H) |] \ |
|
155 |
\ ==> \\<forall>K KK. KK \\<subseteq> - (range shrK) --> \ |
|
156 |
\ (Key K \\<in> analz (insert RB (Key`KK Un H))) = \ |
|
157 |
\ (K \\<in> KK | Key K \\<in> analz (insert RB H))"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
158 |
by (etac responses.induct 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
159 |
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss)); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
160 |
qed "resp_analz_image_freshK_lemma"; |
2449 | 161 |
|
162 |
(*Version for the protocol. Proof is almost trivial, thanks to the lemma.*) |
|
11104 | 163 |
Goal "evs \\<in> recur ==> \ |
164 |
\ \\<forall>K KK. KK \\<subseteq> - (range shrK) --> \ |
|
165 |
\ (Key K \\<in> analz (Key`KK Un (spies evs))) = \ |
|
166 |
\ (K \\<in> KK | Key K \\<in> analz (spies evs))"; |
|
2449 | 167 |
by (etac recur.induct 1); |
3683 | 168 |
by analz_spies_tac; |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
169 |
by (REPEAT_FIRST (resolve_tac [allI, impI])); |
4552
bb8ff763c93d
Simplified proofs by omitting PA = {|XA, ...|} from RA2
paulson
parents:
4509
diff
changeset
|
170 |
by (REPEAT_FIRST (rtac analz_image_freshK_lemma)); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
171 |
by (ALLGOALS |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
172 |
(asm_simp_tac |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
173 |
(analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma]))); |
3451
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset
|
174 |
(*Fake*) |
d10f100676d8
Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents:
3207
diff
changeset
|
175 |
by (spy_analz_tac 1); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
176 |
val raw_analz_image_freshK = result(); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
177 |
qed_spec_mp "analz_image_freshK"; |
2449 | 178 |
|
179 |
||
3683 | 180 |
(*Instance of the lemma with H replaced by (spies evs): |
11104 | 181 |
[| RB \\<in> responses evs; evs \\<in> recur; |] |
182 |
==> KK \\<subseteq> - (range shrK) --> |
|
183 |
Key K \\<in> analz (insert RB (Key`KK Un spies evs)) = |
|
184 |
(K \\<in> KK | Key K \\<in> analz (insert RB (spies evs))) |
|
2449 | 185 |
*) |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
186 |
bind_thm ("resp_analz_image_freshK", |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
187 |
raw_analz_image_freshK RSN |
3961 | 188 |
(2, resp_analz_image_freshK_lemma) RS spec RS spec RS mp); |
2449 | 189 |
|
11104 | 190 |
Goal "[| evs \\<in> recur; KAB \\<notin> range shrK |] ==> \ |
191 |
\ Key K \\<in> analz (insert (Key KAB) (spies evs)) = \ |
|
192 |
\ (K = KAB | Key K \\<in> analz (spies evs))"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
193 |
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:
2485
diff
changeset
|
194 |
qed "analz_insert_freshK"; |
2449 | 195 |
|
196 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
197 |
(*Everything that's hashed is already in past traffic. *) |
11104 | 198 |
Goal "[| Hash {|Key(shrK A), X|} \\<in> parts (spies evs); \ |
199 |
\ evs \\<in> recur; A \\<notin> bad |] ==> X \\<in> parts (spies evs)"; |
|
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
200 |
by (etac rev_mp 1); |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
201 |
by (parts_induct_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
202 |
(*RA3 requires a further induction*) |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
203 |
by (etac responses.induct 2); |
2449 | 204 |
by (ALLGOALS Asm_simp_tac); |
205 |
(*Fake*) |
|
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5421
diff
changeset
|
206 |
by (blast_tac (claset() addIs [parts_insertI]) 1); |
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
207 |
qed "Hash_imp_body"; |
2449 | 208 |
|
209 |
||
210 |
(** The Nonce NA uniquely identifies A's message. |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
211 |
This theorem applies to steps RA1 and RA2! |
2455
9c4444bfd44e
Simplification and generalization of the guarantees.
paulson
parents:
2451
diff
changeset
|
212 |
|
9c4444bfd44e
Simplification and generalization of the guarantees.
paulson
parents:
2451
diff
changeset
|
213 |
Unicity is not used in other proofs but is desirable in its own right. |
2449 | 214 |
**) |
215 |
||
11104 | 216 |
Goal |
217 |
"[| Hash {|Key(shrK A), Agent A, B, NA, P|} \\<in> parts (spies evs); \ |
|
218 |
\ Hash {|Key(shrK A), Agent A, B',NA, P'|} \\<in> parts (spies evs); \ |
|
219 |
\ evs \\<in> recur; A \\<notin> bad |] \ |
|
220 |
\ ==> B=B' & P=P'"; |
|
221 |
by (etac rev_mp 1); |
|
222 |
by (etac rev_mp 1); |
|
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
223 |
by (parts_induct_tac 1); |
5359 | 224 |
by (Blast_tac 1); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
225 |
by (etac responses.induct 3); |
11104 | 226 |
by (Asm_full_simp_tac 4); |
227 |
(*RA1,2: creation of new Nonce*) |
|
5359 | 228 |
by (REPEAT (blast_tac (claset() addSDs [Hash_imp_body]) 1)); |
2449 | 229 |
qed "unique_NA"; |
230 |
||
231 |
||
232 |
(*** Lemmas concerning the Server's response |
|
233 |
(relations "respond" and "responses") |
|
234 |
***) |
|
235 |
||
11104 | 236 |
Goal "[| RB \\<in> responses evs; evs \\<in> recur |] \ |
237 |
\ ==> (Key (shrK B) \\<in> analz (insert RB (spies evs))) = (B:bad)"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
238 |
by (etac responses.induct 1); |
2449 | 239 |
by (ALLGOALS |
240 |
(asm_simp_tac |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
241 |
(analz_image_freshK_ss addsimps [Spy_analz_shrK, |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
242 |
resp_analz_image_freshK]))); |
2449 | 243 |
qed "shrK_in_analz_respond"; |
244 |
Addsimps [shrK_in_analz_respond]; |
|
245 |
||
246 |
||
11104 | 247 |
Goal "[| RB \\<in> responses evs; \ |
248 |
\ \\<forall>K KK. KK \\<subseteq> - (range shrK) --> \ |
|
249 |
\ (Key K \\<in> analz (Key`KK Un H)) = \ |
|
250 |
\ (K \\<in> KK | Key K \\<in> analz H) |] \ |
|
251 |
\ ==> (Key K \\<in> analz (insert RB H)) --> \ |
|
252 |
\ (Key K \\<in> parts{RB} | Key K \\<in> analz H)"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
253 |
by (etac responses.induct 1); |
2449 | 254 |
by (ALLGOALS |
255 |
(asm_simp_tac |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
256 |
(analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma]))); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
257 |
(*Simplification using two distinct treatments of "image"*) |
4091 | 258 |
by (simp_tac (simpset() addsimps [parts_insert2]) 1); |
259 |
by (blast_tac (claset() delrules [allE]) 1); |
|
2449 | 260 |
qed "resp_analz_insert_lemma"; |
261 |
||
262 |
bind_thm ("resp_analz_insert", |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
263 |
raw_analz_image_freshK RSN |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
264 |
(2, resp_analz_insert_lemma) RSN(2, rev_mp)); |
2449 | 265 |
|
266 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
267 |
(*The last key returned by respond indeed appears in a certificate*) |
11104 | 268 |
Goal "(Hash[Key(shrK A)] {|Agent A, B, NA, P|}, RA, K) \\<in> respond evs \ |
269 |
\ ==> Crypt (shrK A) {|Key K, B, NA|} \\<in> parts {RA}"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
270 |
by (etac respond.elim 1); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
271 |
by (ALLGOALS Asm_full_simp_tac); |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
272 |
qed "respond_certificate"; |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
273 |
|
11104 | 274 |
(*This unicity proof differs from all the others in the HOL/Auth directory. |
275 |
The conclusion isn't quite unicity but duplicity, in that there are two |
|
276 |
possibilities. Also, the presence of two different matching messages in |
|
277 |
the inductive step complicates the case analysis. Unusually for such proofs, |
|
278 |
the quantifiers appear to be necessary.*) |
|
279 |
Goal "(PB,RB,KXY) \\<in> respond evs ==> \ |
|
280 |
\ \\<forall>A B N. Crypt (shrK A) {|Key K, Agent B, N|} \\<in> parts {RB} --> \ |
|
281 |
\ (\\<forall>A' B' N'. Crypt (shrK A') {|Key K, Agent B', N'|} \\<in> parts {RB} --> \ |
|
282 |
\ (A'=A & B'=B) | (A'=B & B'=A))"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
283 |
by (etac respond.induct 1); |
4091 | 284 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [all_conj_distrib]))); |
11104 | 285 |
by (blast_tac (claset() addDs [respond_certificate]) 1); |
286 |
qed_spec_mp "unique_lemma"; |
|
2449 | 287 |
|
11104 | 288 |
Goal "[| Crypt (shrK A) {|Key K, Agent B, N|} \\<in> parts {RB}; \ |
289 |
\ Crypt (shrK A') {|Key K, Agent B', N'|} \\<in> parts {RB}; \ |
|
290 |
\ (PB,RB,KXY) \\<in> respond evs |] \ |
|
5359 | 291 |
\ ==> (A'=A & B'=B) | (A'=B & B'=A)"; |
11104 | 292 |
by (rtac unique_lemma 1); |
293 |
by Auto_tac; |
|
2449 | 294 |
qed "unique_session_keys"; |
295 |
||
296 |
||
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
297 |
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3 |
2449 | 298 |
Does not in itself guarantee security: an attack could violate |
299 |
the premises, e.g. by having A=Spy **) |
|
300 |
||
11104 | 301 |
Goal "[| (PB,RB,KAB) \\<in> respond evs; evs \\<in> recur |] \ |
302 |
\ ==> \\<forall>A A' N. A \\<notin> bad & A' \\<notin> bad --> \ |
|
303 |
\ Crypt (shrK A) {|Key K, Agent A', N|} \\<in> parts{RB} --> \ |
|
304 |
\ Key K \\<notin> analz (insert RB (spies evs))"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
305 |
by (etac respond.induct 1); |
7499 | 306 |
by (ftac respond_imp_responses 2); |
307 |
by (ftac respond_imp_not_used 2); |
|
3961 | 308 |
by (ALLGOALS (*6 seconds*) |
2449 | 309 |
(asm_simp_tac |
3961 | 310 |
(analz_image_freshK_ss |
4831 | 311 |
addsimps split_ifs |
3961 | 312 |
addsimps |
313 |
[shrK_in_analz_respond, resp_analz_image_freshK, parts_insert2]))); |
|
4091 | 314 |
by (ALLGOALS (simp_tac (simpset() addsimps [ex_disj_distrib]))); |
3681 | 315 |
(** LEVEL 5 **) |
5359 | 316 |
by (Blast_tac 1); |
3961 | 317 |
by (REPEAT_FIRST (resolve_tac [allI, conjI, impI])); |
318 |
by (ALLGOALS Clarify_tac); |
|
11104 | 319 |
by (blast_tac (claset() addSDs [resp_analz_insert]) 3); |
7057
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
5535
diff
changeset
|
320 |
by (blast_tac (claset() addSDs [respond_certificate]) 2); |
3961 | 321 |
by (Asm_full_simp_tac 1); |
11104 | 322 |
(*by unicity, either B=Aa or B=A', a contradiction if B \\<in> bad*) |
3961 | 323 |
by (blast_tac |
11150 | 324 |
(claset() addDs [respond_certificate RSN (2, unique_session_keys)]) 1); |
2533 | 325 |
qed_spec_mp "respond_Spy_not_see_session_key"; |
2449 | 326 |
|
327 |
||
11104 | 328 |
Goal "[| Crypt (shrK A) {|Key K, Agent A', N|} \\<in> parts (spies evs); \ |
329 |
\ A \\<notin> bad; A' \\<notin> bad; evs \\<in> recur |] \ |
|
330 |
\ ==> Key K \\<notin> analz (spies evs)"; |
|
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
331 |
by (etac rev_mp 1); |
2449 | 332 |
by (etac recur.induct 1); |
3683 | 333 |
by analz_spies_tac; |
2449 | 334 |
by (ALLGOALS |
335 |
(asm_simp_tac |
|
5535 | 336 |
(simpset() addsimps split_ifs @ [analz_insert_eq, analz_insert_freshK]))); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
337 |
(*RA4*) |
11104 | 338 |
by (Blast_tac 5); |
2533 | 339 |
(*RA2*) |
11104 | 340 |
by (Blast_tac 3); |
2449 | 341 |
(*Fake*) |
2533 | 342 |
by (spy_analz_tac 2); |
343 |
(*Base*) |
|
7057
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
5535
diff
changeset
|
344 |
by (Force_tac 1); |
2533 | 345 |
(*RA3 remains*) |
4556
e7a4683c0026
Tidying, mostly to do with handling a more specific version of Fake_parts_insert
paulson
parents:
4552
diff
changeset
|
346 |
by (simp_tac (simpset() addsimps [parts_insert_spies]) 1); |
4091 | 347 |
by (safe_tac (claset() delrules [impCE])); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
348 |
(*RA3, case 2: K is an old key*) |
4091 | 349 |
by (blast_tac (claset() addSDs [resp_analz_insert] |
4556
e7a4683c0026
Tidying, mostly to do with handling a more specific version of Fake_parts_insert
paulson
parents:
4552
diff
changeset
|
350 |
addDs [Key_in_parts_respond]) 2); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
351 |
(*RA3, case 1: use lemma previously proved by induction*) |
4091 | 352 |
by (blast_tac (claset() addSEs [respond_Spy_not_see_session_key RSN |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
353 |
(2,rev_notE)]) 1); |
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
354 |
qed "Spy_not_see_session_key"; |
2449 | 355 |
|
356 |
(**** Authenticity properties for Agents ****) |
|
357 |
||
2481 | 358 |
(*The response never contains Hashes*) |
11104 | 359 |
Goal "[| Hash {|Key (shrK B), M|} \\<in> parts (insert RB H); \ |
360 |
\ (PB,RB,K) \\<in> respond evs |] \ |
|
361 |
\ ==> Hash {|Key (shrK B), M|} \\<in> parts H"; |
|
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
362 |
by (etac rev_mp 1); |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
363 |
by (etac (respond_imp_responses RS responses.induct) 1); |
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4471
diff
changeset
|
364 |
by Auto_tac; |
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
365 |
qed "Hash_in_parts_respond"; |
2481 | 366 |
|
2533 | 367 |
(*Only RA1 or RA2 can have caused such a part of a message to appear. |
368 |
This result is of no use to B, who cannot verify the Hash. Moreover, |
|
369 |
it can say nothing about how recent A's message is. It might later be |
|
370 |
used to prove B's presence to A at the run's conclusion.*) |
|
5076 | 371 |
Goalw [HPair_def] |
11104 | 372 |
"[| Hash {|Key(shrK A), Agent A, Agent B, NA, P|} \\<in> parts(spies evs); \ |
373 |
\ A \\<notin> bad; evs \\<in> recur |] \ |
|
374 |
\ ==> Says A B (Hash[Key(shrK A)] {|Agent A, Agent B, NA, P|}) \\<in> set evs"; |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
375 |
by (etac rev_mp 1); |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
376 |
by (parts_induct_tac 1); |
5359 | 377 |
by (Blast_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
378 |
(*RA3*) |
4091 | 379 |
by (blast_tac (claset() addSDs [Hash_in_parts_respond]) 1); |
2449 | 380 |
qed_spec_mp "Hash_auth_sender"; |
381 |
||
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2485
diff
changeset
|
382 |
(** These two results subsume (for all agents) the guarantees proved |
2449 | 383 |
separately for A and B in the Otway-Rees protocol. |
384 |
**) |
|
385 |
||
386 |
||
2533 | 387 |
(*Certificates can only originate with the Server.*) |
11104 | 388 |
Goal "[| Crypt (shrK A) Y \\<in> parts (spies evs); \ |
389 |
\ A \\<notin> bad; evs \\<in> recur |] \ |
|
390 |
\ ==> \\<exists>C RC. Says Server C RC \\<in> set evs & \ |
|
391 |
\ Crypt (shrK A) Y \\<in> parts {RC}"; |
|
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
392 |
by (etac rev_mp 1); |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3516
diff
changeset
|
393 |
by (parts_induct_tac 1); |
5359 | 394 |
by (Blast_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
395 |
(*RA4*) |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
396 |
by (Blast_tac 4); |
2455
9c4444bfd44e
Simplification and generalization of the guarantees.
paulson
parents:
2451
diff
changeset
|
397 |
(*RA3*) |
4091 | 398 |
by (full_simp_tac (simpset() addsimps [parts_insert_spies]) 3 |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
399 |
THEN Blast_tac 3); |
2455
9c4444bfd44e
Simplification and generalization of the guarantees.
paulson
parents:
2451
diff
changeset
|
400 |
(*RA1*) |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
401 |
by (Blast_tac 1); |
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2449
diff
changeset
|
402 |
(*RA2: it cannot be a new Nonce, contradiction.*) |
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
2637
diff
changeset
|
403 |
by (Blast_tac 1); |
2550
8d8344bcf98a
Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents:
2533
diff
changeset
|
404 |
qed "Cert_imp_Server_msg"; |