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