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