author | paulson |
Thu, 12 Apr 2001 12:45:05 +0200 | |
changeset 11251 | a6816d47f41d |
parent 11230 | 756c5034f08b |
child 11655 | 923e4d0d36d5 |
permissions | -rw-r--r-- |
11251 | 1 |
(* Title: HOL/Auth/OtwayRees |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6308
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
6 |
Inductive relation "otway" for the Otway-Rees protocol |
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
7 |
extended by Gets primitive. |
1941 | 8 |
|
2014
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1976
diff
changeset
|
9 |
Version that encrypts Nonce NB |
5be4c8ca7b25
Correction of protocol; addition of Reveal message; proofs of
paulson
parents:
1976
diff
changeset
|
10 |
|
11251 | 11 |
From page 244 of |
12 |
Burrows, Abadi and Needham. A Logic of Authentication. |
|
13 |
Proc. Royal Soc. 426 (1989) |
|
1941 | 14 |
*) |
15 |
||
11251 | 16 |
theory OtwayRees = Shared: |
1941 | 17 |
|
6308
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
18 |
|
11251 | 19 |
consts otway :: "event list set" |
3519
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents:
3465
diff
changeset
|
20 |
inductive "otway" |
11251 | 21 |
intros |
1941 | 22 |
(*Initial trace is empty*) |
11251 | 23 |
Nil: "[] \<in> otway" |
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5359
diff
changeset
|
24 |
|
2032 | 25 |
(*The spy MAY say anything he CAN say. We do not expect him to |
1941 | 26 |
invent new nonces here, but he can also use NS1. Common to |
27 |
all similar protocols.*) |
|
11251 | 28 |
Fake: "[| evsf \<in> otway; X \<in> synth (analz (knows Spy evsf)) |] |
29 |
==> Says Spy B X # evsf \<in> otway" |
|
6308
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
30 |
|
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
31 |
(*A message that has been sent can be received by the |
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
32 |
intended recipient.*) |
11251 | 33 |
Reception: "[| evsr \<in> otway; Says A B X \<in>set evsr |] |
34 |
==> Gets B X # evsr \<in> otway" |
|
1941 | 35 |
|
36 |
(*Alice initiates a protocol run*) |
|
11251 | 37 |
OR1: "[| evs1 \<in> otway; Nonce NA \<notin> used evs1 |] |
38 |
==> Says A B {|Nonce NA, Agent A, Agent B, |
|
39 |
Crypt (shrK A) {|Nonce NA, Agent A, Agent B|} |} |
|
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
40 |
# evs1 : otway" |
1941 | 41 |
|
6333 | 42 |
(*Bob's response to Alice's message. Note that NB is encrypted.*) |
11251 | 43 |
OR2: "[| evs2 \<in> otway; Nonce NB \<notin> used evs2; |
6308
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
44 |
Gets B {|Nonce NA, Agent A, Agent B, X|} : set evs2 |] |
11251 | 45 |
==> Says B Server |
46 |
{|Nonce NA, Agent A, Agent B, X, |
|
2451
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
paulson
parents:
2378
diff
changeset
|
47 |
Crypt (shrK B) |
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
48 |
{|Nonce NA, Nonce NB, Agent A, Agent B|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
49 |
# evs2 : otway" |
1941 | 50 |
|
51 |
(*The Server receives Bob's message and checks that the three NAs |
|
52 |
match. Then he sends a new session key to Bob with a packet for |
|
53 |
forwarding to Alice.*) |
|
11251 | 54 |
OR3: "[| evs3 \<in> otway; Key KAB \<notin> used evs3; |
55 |
Gets Server |
|
56 |
{|Nonce NA, Agent A, Agent B, |
|
57 |
Crypt (shrK A) {|Nonce NA, Agent A, Agent B|}, |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2135
diff
changeset
|
58 |
Crypt (shrK B) {|Nonce NA, Nonce NB, Agent A, Agent B|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
59 |
: set evs3 |] |
11251 | 60 |
==> Says Server B |
61 |
{|Nonce NA, |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
62 |
Crypt (shrK A) {|Nonce NA, Key KAB|}, |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2451
diff
changeset
|
63 |
Crypt (shrK B) {|Nonce NB, Key KAB|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
64 |
# evs3 : otway" |
1941 | 65 |
|
66 |
(*Bob receives the Server's (?) message and compares the Nonces with |
|
5434
9b4bed3f394c
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents:
5359
diff
changeset
|
67 |
those in the message he previously sent the Server. |
11251 | 68 |
Need B \<noteq> Server because we allow messages to self.*) |
69 |
OR4: "[| evs4 \<in> otway; B \<noteq> Server; |
|
70 |
Says B Server {|Nonce NA, Agent A, Agent B, X', |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2135
diff
changeset
|
71 |
Crypt (shrK B) |
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2135
diff
changeset
|
72 |
{|Nonce NA, Nonce NB, Agent A, Agent B|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
73 |
: set evs4; |
6308
76f3865a2b1d
Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents:
5434
diff
changeset
|
74 |
Gets B {|Nonce NA, X, Crypt (shrK B) {|Nonce NB, Key K|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
75 |
: set evs4 |] |
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
76 |
==> Says B A {|Nonce NA, X|} # evs4 : otway" |
1941 | 77 |
|
2135 | 78 |
(*This message models possible leaks of session keys. The nonces |
79 |
identify the protocol run.*) |
|
11251 | 80 |
Oops: "[| evso \<in> otway; |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2135
diff
changeset
|
81 |
Says Server B {|Nonce NA, X, Crypt (shrK B) {|Nonce NB, Key K|}|} |
3659
eddedfe2f3f8
Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents:
3519
diff
changeset
|
82 |
: set evso |] |
4537
4e835bd9fada
Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents:
3683
diff
changeset
|
83 |
==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso : otway" |
1941 | 84 |
|
11251 | 85 |
|
86 |
declare Says_imp_knows_Spy [THEN analz.Inj, dest] |
|
87 |
declare parts.Body [dest] |
|
88 |
declare analz_into_parts [dest] |
|
89 |
declare Fake_parts_insert_in_Un [dest] |
|
90 |
||
91 |
||
92 |
(*A "possibility property": there are traces that reach the end*) |
|
93 |
lemma "B \<noteq> Server |
|
94 |
==> \<exists>K. \<exists>evs \<in> otway. |
|
95 |
Says B A {|Nonce NA, Crypt (shrK A) {|Nonce NA, Key K|}|} |
|
96 |
\<in> set evs" |
|
97 |
apply (intro exI bexI) |
|
98 |
apply (rule_tac [2] otway.Nil |
|
99 |
[THEN otway.OR1, THEN otway.Reception, |
|
100 |
THEN otway.OR2, THEN otway.Reception, |
|
101 |
THEN otway.OR3, THEN otway.Reception, THEN otway.OR4]) |
|
102 |
apply possibility |
|
103 |
done |
|
104 |
||
105 |
lemma Gets_imp_Says [dest!]: |
|
106 |
"[| Gets B X \<in> set evs; evs \<in> otway |] ==> \<exists>A. Says A B X \<in> set evs" |
|
107 |
apply (erule rev_mp) |
|
108 |
apply (erule otway.induct) |
|
109 |
apply auto |
|
110 |
done |
|
111 |
||
112 |
||
113 |
(**** Inductive proofs about otway ****) |
|
114 |
||
115 |
(** For reasoning about the encrypted portion of messages **) |
|
116 |
||
117 |
lemma OR2_analz_knows_Spy: |
|
118 |
"[| Gets B {|N, Agent A, Agent B, X|} \<in> set evs; evs \<in> otway |] |
|
119 |
==> X \<in> analz (knows Spy evs)" |
|
120 |
by blast |
|
121 |
||
122 |
lemma OR4_analz_knows_Spy: |
|
123 |
"[| Gets B {|N, X, Crypt (shrK B) X'|} \<in> set evs; evs \<in> otway |] |
|
124 |
==> X \<in> analz (knows Spy evs)" |
|
125 |
by blast |
|
126 |
||
127 |
(*These lemmas assist simplification by removing forwarded X-variables. |
|
128 |
We can replace them by rewriting with parts_insert2 and proving using |
|
129 |
dest: parts_cut, but the proofs become more difficult.*) |
|
130 |
lemmas OR2_parts_knows_Spy = |
|
131 |
OR2_analz_knows_Spy [THEN analz_into_parts, standard] |
|
132 |
||
133 |
(*There could be OR4_parts_knows_Spy and Oops_parts_knows_Spy, but for |
|
134 |
some reason proofs work without them!*) |
|
135 |
||
136 |
||
137 |
(** Theorems of the form X \<notin> parts (knows Spy evs) imply that NOBODY |
|
138 |
sends messages containing X! **) |
|
139 |
||
140 |
(*Spy never sees a good agent's shared key!*) |
|
141 |
lemma Spy_see_shrK [simp]: |
|
142 |
"evs \<in> otway ==> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)" |
|
143 |
apply (erule otway.induct, force, |
|
144 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
145 |
apply blast+ |
|
146 |
done |
|
147 |
||
148 |
lemma Spy_analz_shrK [simp]: |
|
149 |
"evs \<in> otway ==> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)" |
|
150 |
by auto |
|
151 |
||
152 |
lemma Spy_see_shrK_D [dest!]: |
|
153 |
"[|Key (shrK A) \<in> parts (knows Spy evs); evs \<in> otway|] ==> A \<in> bad" |
|
154 |
by (blast dest: Spy_see_shrK) |
|
155 |
||
156 |
||
157 |
(*** Proofs involving analz ***) |
|
158 |
||
159 |
(*Describes the form of K and NA when the Server sends this message. Also |
|
160 |
for Oops case.*) |
|
161 |
lemma Says_Server_message_form: |
|
162 |
"[| Says Server B {|NA, X, Crypt (shrK B) {|NB, Key K|}|} \<in> set evs; |
|
163 |
evs \<in> otway |] |
|
164 |
==> K \<notin> range shrK & (\<exists>i. NA = Nonce i) & (\<exists>j. NB = Nonce j)" |
|
165 |
apply (erule rev_mp, erule otway.induct, simp_all) |
|
166 |
apply blast |
|
167 |
done |
|
168 |
||
169 |
||
170 |
(**** |
|
171 |
The following is to prove theorems of the form |
|
172 |
||
173 |
Key K \<in> analz (insert (Key KAB) (knows Spy evs)) ==> |
|
174 |
Key K \<in> analz (knows Spy evs) |
|
175 |
||
176 |
A more general formula must be proved inductively. |
|
177 |
****) |
|
178 |
||
179 |
||
180 |
(** Session keys are not used to encrypt other session keys **) |
|
181 |
||
182 |
(*The equality makes the induction hypothesis easier to apply*) |
|
183 |
lemma analz_image_freshK [rule_format]: |
|
184 |
"evs \<in> otway ==> |
|
185 |
\<forall>K KK. KK <= -(range shrK) --> |
|
186 |
(Key K \<in> analz (Key`KK Un (knows Spy evs))) = |
|
187 |
(K \<in> KK | Key K \<in> analz (knows Spy evs))" |
|
188 |
apply (erule otway.induct, force) |
|
189 |
apply (frule_tac [7] Says_Server_message_form) |
|
190 |
apply (drule_tac [6] OR4_analz_knows_Spy) |
|
191 |
apply (drule_tac [4] OR2_analz_knows_Spy) |
|
192 |
apply analz_freshK |
|
193 |
apply spy_analz |
|
194 |
done |
|
195 |
||
196 |
||
197 |
lemma analz_insert_freshK: |
|
198 |
"[| evs \<in> otway; KAB \<notin> range shrK |] ==> |
|
199 |
Key K \<in> analz (insert (Key KAB) (knows Spy evs)) = |
|
200 |
(K = KAB | Key K \<in> analz (knows Spy evs))" |
|
201 |
by (simp only: analz_image_freshK analz_image_freshK_simps) |
|
202 |
||
203 |
||
204 |
(*** The Key K uniquely identifies the Server's message. **) |
|
205 |
||
206 |
lemma unique_session_keys: |
|
207 |
"[| Says Server B {|NA, X, Crypt (shrK B) {|NB, K|}|} \<in> set evs; |
|
208 |
Says Server B' {|NA',X',Crypt (shrK B') {|NB',K|}|} \<in> set evs; |
|
209 |
evs \<in> otway |] ==> X=X' & B=B' & NA=NA' & NB=NB'" |
|
210 |
apply (erule rev_mp) |
|
211 |
apply (erule rev_mp) |
|
212 |
apply (erule otway.induct, simp_all) |
|
213 |
(*Remaining cases: OR3 and OR4*) |
|
214 |
apply blast+ |
|
215 |
done |
|
216 |
||
217 |
||
218 |
(**** Authenticity properties relating to NA ****) |
|
219 |
||
220 |
(*Only OR1 can have caused such a part of a message to appear.*) |
|
221 |
lemma Crypt_imp_OR1 [rule_format]: |
|
222 |
"[| A \<notin> bad; evs \<in> otway |] |
|
223 |
==> Crypt (shrK A) {|NA, Agent A, Agent B|} \<in> parts (knows Spy evs) --> |
|
224 |
Says A B {|NA, Agent A, Agent B, |
|
225 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} |
|
226 |
\<in> set evs" |
|
227 |
apply (erule otway.induct, force, |
|
228 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
229 |
apply blast+ |
|
230 |
done |
|
231 |
||
232 |
lemma Crypt_imp_OR1_Gets: |
|
233 |
"[| Gets B {|NA, Agent A, Agent B, |
|
234 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} \<in> set evs; |
|
235 |
A \<notin> bad; evs \<in> otway |] |
|
236 |
==> Says A B {|NA, Agent A, Agent B, |
|
237 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} |
|
238 |
\<in> set evs" |
|
239 |
by (blast dest: Crypt_imp_OR1) |
|
240 |
||
241 |
||
242 |
(** The Nonce NA uniquely identifies A's message. **) |
|
243 |
||
244 |
lemma unique_NA: |
|
245 |
"[| Crypt (shrK A) {|NA, Agent A, Agent B|} \<in> parts (knows Spy evs); |
|
246 |
Crypt (shrK A) {|NA, Agent A, Agent C|} \<in> parts (knows Spy evs); |
|
247 |
evs \<in> otway; A \<notin> bad |] |
|
248 |
==> B = C" |
|
249 |
apply (erule rev_mp, erule rev_mp) |
|
250 |
apply (erule otway.induct, force, |
|
251 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
252 |
apply blast+ |
|
253 |
done |
|
254 |
||
255 |
||
256 |
(*It is impossible to re-use a nonce in both OR1 and OR2. This holds because |
|
257 |
OR2 encrypts Nonce NB. It prevents the attack that can occur in the |
|
258 |
over-simplified version of this protocol: see OtwayRees_Bad.*) |
|
259 |
lemma no_nonce_OR1_OR2: |
|
260 |
"[| Crypt (shrK A) {|NA, Agent A, Agent B|} \<in> parts (knows Spy evs); |
|
261 |
A \<notin> bad; evs \<in> otway |] |
|
262 |
==> Crypt (shrK A) {|NA', NA, Agent A', Agent A|} \<notin> parts (knows Spy evs)" |
|
263 |
apply (erule rev_mp) |
|
264 |
apply (erule otway.induct, force, |
|
265 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
266 |
apply blast+ |
|
267 |
done |
|
268 |
||
269 |
(*Crucial property: If the encrypted message appears, and A has used NA |
|
270 |
to start a run, then it originated with the Server!*) |
|
271 |
lemma NA_Crypt_imp_Server_msg [rule_format]: |
|
272 |
"[| A \<notin> bad; evs \<in> otway |] |
|
273 |
==> Says A B {|NA, Agent A, Agent B, |
|
274 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} \<in> set evs --> |
|
275 |
Crypt (shrK A) {|NA, Key K|} \<in> parts (knows Spy evs) |
|
276 |
--> (\<exists>NB. Says Server B |
|
277 |
{|NA, |
|
278 |
Crypt (shrK A) {|NA, Key K|}, |
|
279 |
Crypt (shrK B) {|NB, Key K|}|} \<in> set evs)" |
|
280 |
apply (erule otway.induct, force, |
|
281 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
282 |
apply blast |
|
283 |
(*OR1: it cannot be a new Nonce, contradiction.*) |
|
284 |
apply blast |
|
285 |
(*OR3*) |
|
286 |
apply (blast dest!: no_nonce_OR1_OR2 intro: unique_NA) |
|
287 |
(*OR4*) |
|
288 |
apply (blast intro!: Crypt_imp_OR1) |
|
289 |
done |
|
290 |
||
291 |
||
292 |
(*Corollary: if A receives B's OR4 message and the nonce NA agrees |
|
293 |
then the key really did come from the Server! CANNOT prove this of the |
|
294 |
bad form of this protocol, even though we can prove |
|
295 |
Spy_not_see_encrypted_key*) |
|
296 |
lemma A_trusts_OR4: |
|
297 |
"[| Says A B {|NA, Agent A, Agent B, |
|
298 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} \<in> set evs; |
|
299 |
Says B' A {|NA, Crypt (shrK A) {|NA, Key K|}|} \<in> set evs; |
|
300 |
A \<notin> bad; evs \<in> otway |] |
|
301 |
==> \<exists>NB. Says Server B |
|
302 |
{|NA, |
|
303 |
Crypt (shrK A) {|NA, Key K|}, |
|
304 |
Crypt (shrK B) {|NB, Key K|}|} |
|
305 |
\<in> set evs" |
|
306 |
by (blast intro!: NA_Crypt_imp_Server_msg) |
|
307 |
||
308 |
||
309 |
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3 |
|
310 |
Does not in itself guarantee security: an attack could violate |
|
311 |
the premises, e.g. by having A=Spy **) |
|
312 |
||
313 |
lemma secrecy_lemma: |
|
314 |
"[| A \<notin> bad; B \<notin> bad; evs \<in> otway |] |
|
315 |
==> Says Server B |
|
316 |
{|NA, Crypt (shrK A) {|NA, Key K|}, |
|
317 |
Crypt (shrK B) {|NB, Key K|}|} \<in> set evs --> |
|
318 |
Notes Spy {|NA, NB, Key K|} \<notin> set evs --> |
|
319 |
Key K \<notin> analz (knows Spy evs)" |
|
320 |
apply (erule otway.induct, force) |
|
321 |
apply (frule_tac [7] Says_Server_message_form) |
|
322 |
apply (drule_tac [6] OR4_analz_knows_Spy) |
|
323 |
apply (drule_tac [4] OR2_analz_knows_Spy) |
|
324 |
apply (simp_all add: analz_insert_eq analz_insert_freshK pushes) |
|
325 |
apply spy_analz (*Fake*) |
|
326 |
(*OR3, OR4, Oops*) |
|
327 |
apply (blast dest: unique_session_keys)+ |
|
328 |
done |
|
329 |
||
330 |
lemma Spy_not_see_encrypted_key: |
|
331 |
"[| Says Server B |
|
332 |
{|NA, Crypt (shrK A) {|NA, Key K|}, |
|
333 |
Crypt (shrK B) {|NB, Key K|}|} \<in> set evs; |
|
334 |
Notes Spy {|NA, NB, Key K|} \<notin> set evs; |
|
335 |
A \<notin> bad; B \<notin> bad; evs \<in> otway |] |
|
336 |
==> Key K \<notin> analz (knows Spy evs)" |
|
337 |
by (blast dest: Says_Server_message_form secrecy_lemma) |
|
338 |
||
339 |
||
340 |
(*A's guarantee. The Oops premise quantifies over NB because A cannot know |
|
341 |
what it is.*) |
|
342 |
lemma A_gets_good_key: |
|
343 |
"[| Says A B {|NA, Agent A, Agent B, |
|
344 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} \<in> set evs; |
|
345 |
Says B' A {|NA, Crypt (shrK A) {|NA, Key K|}|} \<in> set evs; |
|
346 |
\<forall>NB. Notes Spy {|NA, NB, Key K|} \<notin> set evs; |
|
347 |
A \<notin> bad; B \<notin> bad; evs \<in> otway |] |
|
348 |
==> Key K \<notin> analz (knows Spy evs)" |
|
349 |
by (blast dest!: A_trusts_OR4 Spy_not_see_encrypted_key) |
|
350 |
||
351 |
||
352 |
||
353 |
(**** Authenticity properties relating to NB ****) |
|
354 |
||
355 |
(*Only OR2 can have caused such a part of a message to appear. We do not |
|
356 |
know anything about X: it does NOT have to have the right form.*) |
|
357 |
lemma Crypt_imp_OR2: |
|
358 |
"[| Crypt (shrK B) {|NA, NB, Agent A, Agent B|} \<in> parts (knows Spy evs); |
|
359 |
B \<notin> bad; evs \<in> otway |] |
|
360 |
==> \<exists>X. Says B Server |
|
361 |
{|NA, Agent A, Agent B, X, |
|
362 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|}|} |
|
363 |
\<in> set evs" |
|
364 |
apply (erule rev_mp) |
|
365 |
apply (erule otway.induct, force, |
|
366 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
367 |
apply blast+ |
|
368 |
done |
|
369 |
||
370 |
||
371 |
(** The Nonce NB uniquely identifies B's message. **) |
|
372 |
||
373 |
lemma unique_NB: |
|
374 |
"[| Crypt (shrK B) {|NA, NB, Agent A, Agent B|} \<in> parts(knows Spy evs); |
|
375 |
Crypt (shrK B) {|NC, NB, Agent C, Agent B|} \<in> parts(knows Spy evs); |
|
376 |
evs \<in> otway; B \<notin> bad |] |
|
377 |
==> NC = NA & C = A" |
|
378 |
apply (erule rev_mp, erule rev_mp) |
|
379 |
apply (erule otway.induct, force, |
|
380 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
381 |
(*Fake, OR2*) |
|
382 |
apply blast+ |
|
383 |
done |
|
384 |
||
385 |
(*If the encrypted message appears, and B has used Nonce NB, |
|
386 |
then it originated with the Server! Quite messy proof.*) |
|
387 |
lemma NB_Crypt_imp_Server_msg [rule_format]: |
|
388 |
"[| B \<notin> bad; evs \<in> otway |] |
|
389 |
==> Crypt (shrK B) {|NB, Key K|} \<in> parts (knows Spy evs) |
|
390 |
--> (\<forall>X'. Says B Server |
|
391 |
{|NA, Agent A, Agent B, X', |
|
392 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|}|} |
|
393 |
\<in> set evs |
|
394 |
--> Says Server B |
|
395 |
{|NA, Crypt (shrK A) {|NA, Key K|}, |
|
396 |
Crypt (shrK B) {|NB, Key K|}|} |
|
397 |
\<in> set evs)" |
|
398 |
apply simp |
|
399 |
apply (erule otway.induct, force, |
|
400 |
drule_tac [4] OR2_parts_knows_Spy, simp_all) |
|
401 |
apply blast |
|
402 |
(*OR1: it cannot be a new Nonce, contradiction.*) |
|
403 |
(*OR2*) |
|
404 |
apply blast |
|
405 |
(*OR3: needs elim: MPair_parts or it takes forever!*) |
|
406 |
apply (blast dest: unique_NB dest!: no_nonce_OR1_OR2) |
|
407 |
(*OR4*) |
|
408 |
apply (blast dest!: Crypt_imp_OR2) |
|
409 |
done |
|
410 |
||
411 |
||
412 |
(*Guarantee for B: if it gets a message with matching NB then the Server |
|
413 |
has sent the correct message.*) |
|
414 |
lemma B_trusts_OR3: |
|
415 |
"[| Says B Server {|NA, Agent A, Agent B, X', |
|
416 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} |
|
417 |
\<in> set evs; |
|
418 |
Gets B {|NA, X, Crypt (shrK B) {|NB, Key K|}|} \<in> set evs; |
|
419 |
B \<notin> bad; evs \<in> otway |] |
|
420 |
==> Says Server B |
|
421 |
{|NA, |
|
422 |
Crypt (shrK A) {|NA, Key K|}, |
|
423 |
Crypt (shrK B) {|NB, Key K|}|} |
|
424 |
\<in> set evs" |
|
425 |
by (blast intro!: NB_Crypt_imp_Server_msg) |
|
426 |
||
427 |
||
428 |
(*The obvious combination of B_trusts_OR3 with Spy_not_see_encrypted_key*) |
|
429 |
lemma B_gets_good_key: |
|
430 |
"[| Says B Server {|NA, Agent A, Agent B, X', |
|
431 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} |
|
432 |
\<in> set evs; |
|
433 |
Gets B {|NA, X, Crypt (shrK B) {|NB, Key K|}|} \<in> set evs; |
|
434 |
Notes Spy {|NA, NB, Key K|} \<notin> set evs; |
|
435 |
A \<notin> bad; B \<notin> bad; evs \<in> otway |] |
|
436 |
==> Key K \<notin> analz (knows Spy evs)" |
|
437 |
by (blast dest!: B_trusts_OR3 Spy_not_see_encrypted_key) |
|
438 |
||
439 |
||
440 |
lemma OR3_imp_OR2: |
|
441 |
"[| Says Server B |
|
442 |
{|NA, Crypt (shrK A) {|NA, Key K|}, |
|
443 |
Crypt (shrK B) {|NB, Key K|}|} \<in> set evs; |
|
444 |
B \<notin> bad; evs \<in> otway |] |
|
445 |
==> \<exists>X. Says B Server {|NA, Agent A, Agent B, X, |
|
446 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} |
|
447 |
\<in> set evs" |
|
448 |
apply (erule rev_mp) |
|
449 |
apply (erule otway.induct, simp_all) |
|
450 |
apply (blast dest!: Crypt_imp_OR2)+ |
|
451 |
done |
|
452 |
||
453 |
||
454 |
(*After getting and checking OR4, agent A can trust that B has been active. |
|
455 |
We could probably prove that X has the expected form, but that is not |
|
456 |
strictly necessary for authentication.*) |
|
457 |
lemma A_auths_B: |
|
458 |
"[| Says B' A {|NA, Crypt (shrK A) {|NA, Key K|}|} \<in> set evs; |
|
459 |
Says A B {|NA, Agent A, Agent B, |
|
460 |
Crypt (shrK A) {|NA, Agent A, Agent B|}|} \<in> set evs; |
|
461 |
A \<notin> bad; B \<notin> bad; evs \<in> otway |] |
|
462 |
==> \<exists>NB X. Says B Server {|NA, Agent A, Agent B, X, |
|
463 |
Crypt (shrK B) {|NA, NB, Agent A, Agent B|} |} |
|
464 |
\<in> set evs" |
|
465 |
by (blast dest!: A_trusts_OR4 OR3_imp_OR2) |
|
466 |
||
1941 | 467 |
end |