| author | wenzelm | 
| Sat, 13 Mar 2010 20:33:14 +0100 | |
| changeset 35765 | 09e238561460 | 
| parent 35416 | d8d7d1b785af | 
| child 36866 | 426d5781bb25 | 
| permissions | -rw-r--r-- | 
| 18886 | 1 | (* ID: $Id$ | 
| 2 | Author: Giampaolo Bella, Catania University | |
| 3 | *) | |
| 4 | ||
| 5 | header{*The Kerberos Protocol, Version V*}
 | |
| 6 | ||
| 7 | theory KerberosV imports Public begin | |
| 8 | ||
| 9 | text{*The "u" prefix indicates theorems referring to an updated version of the protocol. The "r" suffix indicates theorems where the confidentiality assumptions are relaxed by the corresponding arguments.*}
 | |
| 10 | ||
| 20768 | 11 | abbreviation | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 12 | Kas :: agent where | 
| 20768 | 13 | "Kas == Server" | 
| 18886 | 14 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 15 | abbreviation | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 16 | Tgs :: agent where | 
| 20768 | 17 | "Tgs == Friend 0" | 
| 18886 | 18 | |
| 19 | ||
| 20 | axioms | |
| 21 | Tgs_not_bad [iff]: "Tgs \<notin> bad" | |
| 22 |    --{*Tgs is secure --- we already know that Kas is secure*}
 | |
| 23 | ||
| 24 | constdefs | |
| 25 | (* authKeys are those contained in an authTicket *) | |
| 26 | authKeys :: "event list => key set" | |
| 27 |     "authKeys evs == {authK. \<exists>A Peer Ta. 
 | |
| 28 | Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Peer, Ta\<rbrace>, | |
| 29 | Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key authK, Ta\<rbrace> | |
| 30 | \<rbrace> \<in> set evs}" | |
| 31 | ||
| 32 | (* A is the true creator of X if she has sent X and X never appeared on | |
| 33 | the trace before this event. Recall that traces grow from head. *) | |
| 34 | Issues :: "[agent, agent, msg, event list] => bool" | |
| 35 |              ("_ Issues _ with _ on _")
 | |
| 36 | "A Issues B with X on evs == | |
| 37 |       \<exists>Y. Says A B Y \<in> set evs \<and> X \<in> parts {Y} \<and>
 | |
| 38 | X \<notin> parts (spies (takeWhile (% z. z \<noteq> Says A B Y) (rev evs)))" | |
| 39 | ||
| 40 | ||
| 41 | consts | |
| 42 | (*Duration of the authentication key*) | |
| 43 | authKlife :: nat | |
| 44 | ||
| 45 | (*Duration of the service key*) | |
| 46 | servKlife :: nat | |
| 47 | ||
| 48 | (*Duration of an authenticator*) | |
| 49 | authlife :: nat | |
| 50 | ||
| 51 | (*Upper bound on the time of reaction of a server*) | |
| 52 | replylife :: nat | |
| 53 | ||
| 54 | specification (authKlife) | |
| 55 | authKlife_LB [iff]: "2 \<le> authKlife" | |
| 56 | by blast | |
| 57 | ||
| 58 | specification (servKlife) | |
| 59 | servKlife_LB [iff]: "2 + authKlife \<le> servKlife" | |
| 60 | by blast | |
| 61 | ||
| 62 | specification (authlife) | |
| 63 | authlife_LB [iff]: "Suc 0 \<le> authlife" | |
| 64 | by blast | |
| 65 | ||
| 66 | specification (replylife) | |
| 67 | replylife_LB [iff]: "Suc 0 \<le> replylife" | |
| 68 | by blast | |
| 69 | ||
| 20768 | 70 | abbreviation | 
| 71 | (*The current time is just the length of the trace!*) | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 72 | CT :: "event list=>nat" where | 
| 20768 | 73 | "CT == length" | 
| 18886 | 74 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 75 | abbreviation | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 76 | expiredAK :: "[nat, event list] => bool" where | 
| 20768 | 77 | "expiredAK T evs == authKlife + T < CT evs" | 
| 18886 | 78 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 79 | abbreviation | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 80 | expiredSK :: "[nat, event list] => bool" where | 
| 20768 | 81 | "expiredSK T evs == servKlife + T < CT evs" | 
| 18886 | 82 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 83 | abbreviation | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 84 | expiredA :: "[nat, event list] => bool" where | 
| 20768 | 85 | "expiredA T evs == authlife + T < CT evs" | 
| 18886 | 86 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 87 | abbreviation | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
20768diff
changeset | 88 |   valid :: "[nat, nat] => bool"  ("valid _ wrt _") where
 | 
| 20768 | 89 | "valid T1 wrt T2 == T1 <= replylife + T2" | 
| 18886 | 90 | |
| 91 | (*---------------------------------------------------------------------*) | |
| 92 | ||
| 93 | ||
| 94 | (* Predicate formalising the association between authKeys and servKeys *) | |
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32960diff
changeset | 95 | definition AKcryptSK :: "[key, key, event list] => bool" where | 
| 18886 | 96 | "AKcryptSK authK servK evs == | 
| 97 | \<exists>A B tt. | |
| 98 | Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, tt\<rbrace>, | |
| 99 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, tt\<rbrace> \<rbrace> | |
| 100 | \<in> set evs" | |
| 101 | ||
| 23746 | 102 | inductive_set kerbV :: "event list set" | 
| 103 | where | |
| 18886 | 104 | |
| 105 | Nil: "[] \<in> kerbV" | |
| 106 | ||
| 23746 | 107 | | Fake: "\<lbrakk> evsf \<in> kerbV; X \<in> synth (analz (spies evsf)) \<rbrakk> | 
| 18886 | 108 | \<Longrightarrow> Says Spy B X # evsf \<in> kerbV" | 
| 109 | ||
| 110 | ||
| 111 | (*Authentication phase*) | |
| 23746 | 112 | | KV1: "\<lbrakk> evs1 \<in> kerbV \<rbrakk> | 
| 18886 | 113 | \<Longrightarrow> Says A Kas \<lbrace>Agent A, Agent Tgs, Number (CT evs1)\<rbrace> # evs1 | 
| 114 | \<in> kerbV" | |
| 115 | (*Unlike version IV, authTicket is not re-encrypted*) | |
| 23746 | 116 | | KV2: "\<lbrakk> evs2 \<in> kerbV; Key authK \<notin> used evs2; authK \<in> symKeys; | 
| 18886 | 117 | Says A' Kas \<lbrace>Agent A, Agent Tgs, Number T1\<rbrace> \<in> set evs2 \<rbrakk> | 
| 118 | \<Longrightarrow> Says Kas A \<lbrace> | |
| 119 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number (CT evs2)\<rbrace>, | |
| 120 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number (CT evs2)\<rbrace> | |
| 121 | \<rbrace> # evs2 \<in> kerbV" | |
| 122 | ||
| 123 | ||
| 124 | (* Authorisation phase *) | |
| 23746 | 125 | | KV3: "\<lbrakk> evs3 \<in> kerbV; A \<noteq> Kas; A \<noteq> Tgs; | 
| 18886 | 126 | Says A Kas \<lbrace>Agent A, Agent Tgs, Number T1\<rbrace> \<in> set evs3; | 
| 127 | Says Kas' A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 128 | authTicket\<rbrace> \<in> set evs3; | |
| 129 | valid Ta wrt T1 | |
| 130 | \<rbrakk> | |
| 131 | \<Longrightarrow> Says A Tgs \<lbrace>authTicket, | |
| 132 | (Crypt authK \<lbrace>Agent A, Number (CT evs3)\<rbrace>), | |
| 133 | Agent B\<rbrace> # evs3 \<in> kerbV" | |
| 134 | (*Unlike version IV, servTicket is not re-encrypted*) | |
| 23746 | 135 | | KV4: "\<lbrakk> evs4 \<in> kerbV; Key servK \<notin> used evs4; servK \<in> symKeys; | 
| 18886 | 136 | B \<noteq> Tgs; authK \<in> symKeys; | 
| 137 | Says A' Tgs \<lbrace> | |
| 138 | (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 139 | Number Ta\<rbrace>), | 
| 18886 | 140 | (Crypt authK \<lbrace>Agent A, Number T2\<rbrace>), Agent B\<rbrace> | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 141 | \<in> set evs4; | 
| 18886 | 142 | \<not> expiredAK Ta evs4; | 
| 143 | \<not> expiredA T2 evs4; | |
| 144 | servKlife + (CT evs4) <= authKlife + Ta | |
| 145 | \<rbrakk> | |
| 146 | \<Longrightarrow> Says Tgs A \<lbrace> | |
| 147 | Crypt authK \<lbrace>Key servK, Agent B, Number (CT evs4)\<rbrace>, | |
| 148 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number (CT evs4)\<rbrace> | |
| 149 | \<rbrace> # evs4 \<in> kerbV" | |
| 150 | ||
| 151 | ||
| 152 | (*Service phase*) | |
| 23746 | 153 | | KV5: "\<lbrakk> evs5 \<in> kerbV; authK \<in> symKeys; servK \<in> symKeys; | 
| 18886 | 154 | A \<noteq> Kas; A \<noteq> Tgs; | 
| 155 | Says A Tgs | |
| 156 | \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 157 | Agent B\<rbrace> | 
| 18886 | 158 | \<in> set evs5; | 
| 159 | Says Tgs' A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 160 | servTicket\<rbrace> | |
| 161 | \<in> set evs5; | |
| 162 | valid Ts wrt T2 \<rbrakk> | |
| 163 | \<Longrightarrow> Says A B \<lbrace>servTicket, | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 164 | Crypt servK \<lbrace>Agent A, Number (CT evs5)\<rbrace> \<rbrace> | 
| 18886 | 165 | # evs5 \<in> kerbV" | 
| 166 | ||
| 23746 | 167 | | KV6: "\<lbrakk> evs6 \<in> kerbV; B \<noteq> Kas; B \<noteq> Tgs; | 
| 18886 | 168 | Says A' B \<lbrace> | 
| 169 | (Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>), | |
| 170 | (Crypt servK \<lbrace>Agent A, Number T3\<rbrace>)\<rbrace> | |
| 171 | \<in> set evs6; | |
| 172 | \<not> expiredSK Ts evs6; | |
| 173 | \<not> expiredA T3 evs6 | |
| 174 | \<rbrakk> | |
| 175 | \<Longrightarrow> Says B A (Crypt servK (Number Ta2)) | |
| 176 | # evs6 \<in> kerbV" | |
| 177 | ||
| 178 | ||
| 179 | ||
| 180 | (* Leaking an authK... *) | |
| 23746 | 181 | | Oops1:"\<lbrakk> evsO1 \<in> kerbV; A \<noteq> Spy; | 
| 18886 | 182 | Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | 
| 183 | authTicket\<rbrace> \<in> set evsO1; | |
| 184 | expiredAK Ta evsO1 \<rbrakk> | |
| 185 | \<Longrightarrow> Notes Spy \<lbrace>Agent A, Agent Tgs, Number Ta, Key authK\<rbrace> | |
| 186 | # evsO1 \<in> kerbV" | |
| 187 | ||
| 188 | (*Leaking a servK... *) | |
| 23746 | 189 | | Oops2: "\<lbrakk> evsO2 \<in> kerbV; A \<noteq> Spy; | 
| 18886 | 190 | Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | 
| 191 | servTicket\<rbrace> \<in> set evsO2; | |
| 192 | expiredSK Ts evsO2 \<rbrakk> | |
| 193 | \<Longrightarrow> Notes Spy \<lbrace>Agent A, Agent B, Number Ts, Key servK\<rbrace> | |
| 194 | # evsO2 \<in> kerbV" | |
| 195 | ||
| 196 | ||
| 197 | ||
| 198 | declare Says_imp_knows_Spy [THEN parts.Inj, dest] | |
| 199 | declare parts.Body [dest] | |
| 200 | declare analz_into_parts [dest] | |
| 201 | declare Fake_parts_insert_in_Un [dest] | |
| 202 | ||
| 203 | ||
| 204 | ||
| 205 | subsection{*Lemmas about lists, for reasoning about  Issues*}
 | |
| 206 | ||
| 207 | lemma spies_Says_rev: "spies (evs @ [Says A B X]) = insert X (spies evs)" | |
| 208 | apply (induct_tac "evs") | |
| 209 | apply (induct_tac [2] "a", auto) | |
| 210 | done | |
| 211 | ||
| 212 | lemma spies_Gets_rev: "spies (evs @ [Gets A X]) = spies evs" | |
| 213 | apply (induct_tac "evs") | |
| 214 | apply (induct_tac [2] "a", auto) | |
| 215 | done | |
| 216 | ||
| 217 | lemma spies_Notes_rev: "spies (evs @ [Notes A X]) = | |
| 218 | (if A:bad then insert X (spies evs) else spies evs)" | |
| 219 | apply (induct_tac "evs") | |
| 220 | apply (induct_tac [2] "a", auto) | |
| 221 | done | |
| 222 | ||
| 223 | lemma spies_evs_rev: "spies evs = spies (rev evs)" | |
| 224 | apply (induct_tac "evs") | |
| 225 | apply (induct_tac [2] "a") | |
| 226 | apply (simp_all (no_asm_simp) add: spies_Says_rev spies_Gets_rev spies_Notes_rev) | |
| 227 | done | |
| 228 | ||
| 229 | lemmas parts_spies_evs_revD2 = spies_evs_rev [THEN equalityD2, THEN parts_mono] | |
| 230 | ||
| 231 | lemma spies_takeWhile: "spies (takeWhile P evs) <= spies evs" | |
| 232 | apply (induct_tac "evs") | |
| 233 | apply (induct_tac [2] "a", auto) | |
| 234 | txt{* Resembles @{text"used_subset_append"} in theory Event.*}
 | |
| 235 | done | |
| 236 | ||
| 237 | lemmas parts_spies_takeWhile_mono = spies_takeWhile [THEN parts_mono] | |
| 238 | ||
| 239 | ||
| 240 | subsection{*Lemmas about @{term authKeys}*}
 | |
| 241 | ||
| 242 | lemma authKeys_empty: "authKeys [] = {}"
 | |
| 243 | apply (unfold authKeys_def) | |
| 244 | apply (simp (no_asm)) | |
| 245 | done | |
| 246 | ||
| 247 | lemma authKeys_not_insert: | |
| 248 | "(\<forall>A Ta akey Peer. | |
| 249 | ev \<noteq> Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>akey, Agent Peer, Ta\<rbrace>, | |
| 250 | Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, akey, Ta\<rbrace> \<rbrace>) | |
| 251 | \<Longrightarrow> authKeys (ev # evs) = authKeys evs" | |
| 252 | apply (unfold authKeys_def, auto) | |
| 253 | done | |
| 254 | ||
| 255 | lemma authKeys_insert: | |
| 256 | "authKeys | |
| 257 | (Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key K, Agent Peer, Number Ta\<rbrace>, | |
| 258 | Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key K, Number Ta\<rbrace> \<rbrace> # evs) | |
| 259 | = insert K (authKeys evs)" | |
| 260 | apply (unfold authKeys_def, auto) | |
| 261 | done | |
| 262 | ||
| 263 | lemma authKeys_simp: | |
| 264 | "K \<in> authKeys | |
| 265 | (Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key K', Agent Peer, Number Ta\<rbrace>, | |
| 266 | Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key K', Number Ta\<rbrace> \<rbrace> # evs) | |
| 267 | \<Longrightarrow> K = K' | K \<in> authKeys evs" | |
| 268 | apply (unfold authKeys_def, auto) | |
| 269 | done | |
| 270 | ||
| 271 | lemma authKeysI: | |
| 272 | "Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key K, Agent Tgs, Number Ta\<rbrace>, | |
| 273 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key K, Number Ta\<rbrace> \<rbrace> \<in> set evs | |
| 274 | \<Longrightarrow> K \<in> authKeys evs" | |
| 275 | apply (unfold authKeys_def, auto) | |
| 276 | done | |
| 277 | ||
| 278 | lemma authKeys_used: "K \<in> authKeys evs \<Longrightarrow> Key K \<in> used evs" | |
| 279 | apply (simp add: authKeys_def, blast) | |
| 280 | done | |
| 281 | ||
| 282 | ||
| 283 | subsection{*Forwarding Lemmas*}
 | |
| 284 | ||
| 285 | lemma Says_ticket_parts: | |
| 286 | "Says S A \<lbrace>Crypt K \<lbrace>SesKey, B, TimeStamp\<rbrace>, Ticket\<rbrace> | |
| 287 | \<in> set evs \<Longrightarrow> Ticket \<in> parts (spies evs)" | |
| 288 | apply blast | |
| 289 | done | |
| 290 | ||
| 291 | lemma Says_ticket_analz: | |
| 292 | "Says S A \<lbrace>Crypt K \<lbrace>SesKey, B, TimeStamp\<rbrace>, Ticket\<rbrace> | |
| 293 | \<in> set evs \<Longrightarrow> Ticket \<in> analz (spies evs)" | |
| 294 | apply (blast dest: Says_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd]) | |
| 295 | done | |
| 296 | ||
| 297 | lemma Oops_range_spies1: | |
| 298 | "\<lbrakk> Says Kas A \<lbrace>Crypt KeyA \<lbrace>Key authK, Peer, Ta\<rbrace>, authTicket\<rbrace> | |
| 299 | \<in> set evs ; | |
| 300 | evs \<in> kerbV \<rbrakk> \<Longrightarrow> authK \<notin> range shrK & authK \<in> symKeys" | |
| 301 | apply (erule rev_mp) | |
| 302 | apply (erule kerbV.induct, auto) | |
| 303 | done | |
| 304 | ||
| 305 | lemma Oops_range_spies2: | |
| 306 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, servTicket\<rbrace> | |
| 307 | \<in> set evs ; | |
| 308 | evs \<in> kerbV \<rbrakk> \<Longrightarrow> servK \<notin> range shrK \<and> servK \<in> symKeys" | |
| 309 | apply (erule rev_mp) | |
| 310 | apply (erule kerbV.induct, auto) | |
| 311 | done | |
| 312 | ||
| 313 | ||
| 314 | (*Spy never sees another agent's shared key! (unless it's lost at start)*) | |
| 315 | lemma Spy_see_shrK [simp]: | |
| 316 | "evs \<in> kerbV \<Longrightarrow> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)" | |
| 317 | apply (erule kerbV.induct) | |
| 318 | apply (frule_tac [7] Says_ticket_parts) | |
| 319 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 320 | apply (blast+) | |
| 321 | done | |
| 322 | ||
| 323 | lemma Spy_analz_shrK [simp]: | |
| 324 | "evs \<in> kerbV \<Longrightarrow> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)" | |
| 325 | by auto | |
| 326 | ||
| 327 | lemma Spy_see_shrK_D [dest!]: | |
| 328 | "\<lbrakk> Key (shrK A) \<in> parts (spies evs); evs \<in> kerbV \<rbrakk> \<Longrightarrow> A:bad" | |
| 329 | by (blast dest: Spy_see_shrK) | |
| 330 | lemmas Spy_analz_shrK_D = analz_subset_parts [THEN subsetD, THEN Spy_see_shrK_D, dest!] | |
| 331 | ||
| 332 | text{*Nobody can have used non-existent keys!*}
 | |
| 333 | lemma new_keys_not_used [simp]: | |
| 334 | "\<lbrakk>Key K \<notin> used evs; K \<in> symKeys; evs \<in> kerbV\<rbrakk> | |
| 335 | \<Longrightarrow> K \<notin> keysFor (parts (spies evs))" | |
| 336 | apply (erule rev_mp) | |
| 337 | apply (erule kerbV.induct) | |
| 338 | apply (frule_tac [7] Says_ticket_parts) | |
| 339 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 340 | txt{*Fake*}
 | |
| 341 | apply (force dest!: keysFor_parts_insert) | |
| 342 | txt{*Others*}
 | |
| 343 | apply (force dest!: analz_shrK_Decrypt)+ | |
| 344 | done | |
| 345 | ||
| 346 | (*Earlier, all protocol proofs declared this theorem. | |
| 347 | But few of them actually need it! (Another is Yahalom) *) | |
| 348 | lemma new_keys_not_analzd: | |
| 349 | "\<lbrakk>evs \<in> kerbV; K \<in> symKeys; Key K \<notin> used evs\<rbrakk> | |
| 350 | \<Longrightarrow> K \<notin> keysFor (analz (spies evs))" | |
| 351 | by (blast dest: new_keys_not_used intro: keysFor_mono [THEN subsetD]) | |
| 352 | ||
| 353 | ||
| 354 | ||
| 355 | subsection{*Regularity Lemmas*}
 | |
| 356 | text{*These concern the form of items passed in messages*}
 | |
| 357 | ||
| 358 | text{*Describes the form of all components sent by Kas*}
 | |
| 359 | lemma Says_Kas_message_form: | |
| 360 | "\<lbrakk> Says Kas A \<lbrace>Crypt K \<lbrace>Key authK, Agent Peer, Ta\<rbrace>, authTicket\<rbrace> | |
| 361 | \<in> set evs; | |
| 362 | evs \<in> kerbV \<rbrakk> | |
| 363 | \<Longrightarrow> authK \<notin> range shrK \<and> authK \<in> authKeys evs \<and> authK \<in> symKeys \<and> | |
| 364 | authTicket = (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Ta\<rbrace>) \<and> | |
| 365 | K = shrK A \<and> Peer = Tgs" | |
| 366 | apply (erule rev_mp) | |
| 367 | apply (erule kerbV.induct) | |
| 368 | apply (simp_all (no_asm) add: authKeys_def authKeys_insert) | |
| 369 | apply blast+ | |
| 370 | done | |
| 371 | ||
| 372 | ||
| 373 | ||
| 374 | (*This lemma is essential for proving Says_Tgs_message_form: | |
| 375 | ||
| 376 | the session key authK | |
| 377 | supplied by Kas in the authentication ticket | |
| 378 | cannot be a long-term key! | |
| 379 | ||
| 380 | Generalised to any session keys (both authK and servK). | |
| 381 | *) | |
| 382 | lemma SesKey_is_session_key: | |
| 383 | "\<lbrakk> Crypt (shrK Tgs_B) \<lbrace>Agent A, Agent Tgs_B, Key SesKey, Number T\<rbrace> | |
| 384 | \<in> parts (spies evs); Tgs_B \<notin> bad; | |
| 385 | evs \<in> kerbV \<rbrakk> | |
| 386 | \<Longrightarrow> SesKey \<notin> range shrK" | |
| 387 | apply (erule rev_mp) | |
| 388 | apply (erule kerbV.induct) | |
| 389 | apply (frule_tac [7] Says_ticket_parts) | |
| 390 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast) | |
| 391 | done | |
| 392 | ||
| 393 | lemma authTicket_authentic: | |
| 394 | "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Ta\<rbrace> | |
| 395 | \<in> parts (spies evs); | |
| 396 | evs \<in> kerbV \<rbrakk> | |
| 397 | \<Longrightarrow> Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Ta\<rbrace>, | |
| 398 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Ta\<rbrace>\<rbrace> | |
| 399 | \<in> set evs" | |
| 400 | apply (erule rev_mp) | |
| 401 | apply (erule kerbV.induct) | |
| 402 | apply (frule_tac [7] Says_ticket_parts) | |
| 403 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 404 | txt{*Fake, K4*}
 | |
| 405 | apply (blast+) | |
| 406 | done | |
| 407 | ||
| 408 | lemma authTicket_crypt_authK: | |
| 409 | "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> | |
| 410 | \<in> parts (spies evs); | |
| 411 | evs \<in> kerbV \<rbrakk> | |
| 412 | \<Longrightarrow> authK \<in> authKeys evs" | |
| 413 | apply (frule authTicket_authentic, assumption) | |
| 414 | apply (simp (no_asm) add: authKeys_def) | |
| 415 | apply blast | |
| 416 | done | |
| 417 | ||
| 418 | text{*Describes the form of servK, servTicket and authK sent by Tgs*}
 | |
| 419 | lemma Says_Tgs_message_form: | |
| 420 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, servTicket\<rbrace> | |
| 421 | \<in> set evs; | |
| 422 | evs \<in> kerbV \<rbrakk> | |
| 423 | \<Longrightarrow> B \<noteq> Tgs \<and> | |
| 424 | servK \<notin> range shrK \<and> servK \<notin> authKeys evs \<and> servK \<in> symKeys \<and> | |
| 425 | servTicket = (Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace>) \<and> | |
| 426 | authK \<notin> range shrK \<and> authK \<in> authKeys evs \<and> authK \<in> symKeys" | |
| 427 | apply (erule rev_mp) | |
| 428 | apply (erule kerbV.induct) | |
| 429 | apply (simp_all add: authKeys_insert authKeys_not_insert authKeys_empty authKeys_simp, blast, auto) | |
| 430 | txt{*Three subcases of Message 4*}
 | |
| 431 | apply (blast dest!: authKeys_used Says_Kas_message_form) | |
| 432 | apply (blast dest!: SesKey_is_session_key) | |
| 433 | apply (blast dest: authTicket_crypt_authK) | |
| 434 | done | |
| 435 | ||
| 436 | ||
| 437 | ||
| 438 | (* | |
| 439 | lemma authTicket_form: | |
| 440 | lemma servTicket_form: | |
| 441 | lemma Says_kas_message_form: | |
| 442 | lemma Says_tgs_message_form: | |
| 443 | ||
| 444 | cannot be proved for version V, but a new proof strategy can be used in their | |
| 445 | place. The new strategy merely says that both the authTicket and the servTicket | |
| 446 | are in parts and in analz as soon as they appear, using lemmas Says_ticket_parts and Says_ticket_analz. | |
| 447 | The new strategy always lets the simplifier solve cases K3 and K5, saving on | |
| 448 | long dedicated analyses, which seemed unavoidable. For this reason, lemma | |
| 449 | servK_notin_authKeysD is no longer needed. | |
| 450 | *) | |
| 451 | ||
| 452 | subsection{*Authenticity theorems: confirm origin of sensitive messages*}
 | |
| 453 | ||
| 454 | lemma authK_authentic: | |
| 455 | "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace> | |
| 456 | \<in> parts (spies evs); | |
| 457 | A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 458 | \<Longrightarrow> \<exists> AT. Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace>, AT\<rbrace> | |
| 459 | \<in> set evs" | |
| 460 | apply (erule rev_mp) | |
| 461 | apply (erule kerbV.induct) | |
| 462 | apply (frule_tac [7] Says_ticket_parts) | |
| 463 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 464 | apply blast+ | |
| 465 | done | |
| 466 | ||
| 467 | text{*If a certain encrypted message appears then it originated with Tgs*}
 | |
| 468 | lemma servK_authentic: | |
| 469 | "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace> | |
| 470 | \<in> parts (spies evs); | |
| 471 | Key authK \<notin> analz (spies evs); | |
| 472 | authK \<notin> range shrK; | |
| 473 | evs \<in> kerbV \<rbrakk> | |
| 474 | \<Longrightarrow> \<exists>A ST. Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, ST\<rbrace> | |
| 475 | \<in> set evs" | |
| 476 | apply (erule rev_mp) | |
| 477 | apply (erule rev_mp) | |
| 478 | apply (erule kerbV.induct, analz_mono_contra) | |
| 479 | apply (frule_tac [7] Says_ticket_parts) | |
| 480 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 481 | apply blast+ | |
| 482 | done | |
| 483 | ||
| 484 | lemma servK_authentic_bis: | |
| 485 | "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace> | |
| 486 | \<in> parts (spies evs); | |
| 487 | Key authK \<notin> analz (spies evs); | |
| 488 | B \<noteq> Tgs; | |
| 489 | evs \<in> kerbV \<rbrakk> | |
| 490 | \<Longrightarrow> \<exists>A ST. Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, ST\<rbrace> | |
| 491 | \<in> set evs" | |
| 492 | apply (erule rev_mp) | |
| 493 | apply (erule rev_mp) | |
| 494 | apply (erule kerbV.induct, analz_mono_contra) | |
| 495 | apply (frule_tac [7] Says_ticket_parts) | |
| 496 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast+) | |
| 497 | done | |
| 498 | ||
| 499 | text{*Authenticity of servK for B*}
 | |
| 500 | lemma servTicket_authentic_Tgs: | |
| 501 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace> | |
| 502 | \<in> parts (spies evs); B \<noteq> Tgs; B \<notin> bad; | |
| 503 | evs \<in> kerbV \<rbrakk> | |
| 504 | \<Longrightarrow> \<exists>authK. | |
| 505 | Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, | |
| 506 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace>\<rbrace> | |
| 507 | \<in> set evs" | |
| 508 | apply (erule rev_mp) | |
| 509 | apply (erule kerbV.induct) | |
| 510 | apply (frule_tac [7] Says_ticket_parts) | |
| 511 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast+) | |
| 512 | done | |
| 513 | ||
| 514 | text{*Anticipated here from next subsection*}
 | |
| 515 | lemma K4_imp_K2: | |
| 516 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 517 | \<in> set evs; evs \<in> kerbV\<rbrakk> | |
| 518 | \<Longrightarrow> \<exists>Ta. Says Kas A | |
| 519 | \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 520 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> \<rbrace> | |
| 521 | \<in> set evs" | |
| 522 | apply (erule rev_mp) | |
| 523 | apply (erule kerbV.induct) | |
| 524 | apply (frule_tac [7] Says_ticket_parts) | |
| 525 | apply (frule_tac [5] Says_ticket_parts, simp_all, auto) | |
| 526 | apply (blast dest!: Says_imp_spies [THEN parts.Inj, THEN parts.Fst, THEN authTicket_authentic]) | |
| 527 | done | |
| 528 | ||
| 529 | text{*Anticipated here from next subsection*}
 | |
| 530 | lemma u_K4_imp_K2: | |
| 531 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> \<in> set evs; evs \<in> kerbV\<rbrakk> | |
| 532 | \<Longrightarrow> \<exists>Ta. Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 533 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> \<rbrace> | |
| 534 | \<in> set evs | |
| 535 | \<and> servKlife + Ts <= authKlife + Ta" | |
| 536 | apply (erule rev_mp) | |
| 537 | apply (erule kerbV.induct) | |
| 538 | apply (frule_tac [7] Says_ticket_parts) | |
| 539 | apply (frule_tac [5] Says_ticket_parts, simp_all, auto) | |
| 540 | apply (blast dest!: Says_imp_spies [THEN parts.Inj, THEN parts.Fst, THEN authTicket_authentic]) | |
| 541 | done | |
| 542 | ||
| 543 | lemma servTicket_authentic_Kas: | |
| 544 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 545 | \<in> parts (spies evs); B \<noteq> Tgs; B \<notin> bad; | |
| 546 | evs \<in> kerbV \<rbrakk> | |
| 547 | \<Longrightarrow> \<exists>authK Ta. | |
| 548 | Says Kas A | |
| 549 | \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 550 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> \<rbrace> | |
| 551 | \<in> set evs" | |
| 552 | apply (blast dest!: servTicket_authentic_Tgs K4_imp_K2) | |
| 553 | done | |
| 554 | ||
| 555 | lemma u_servTicket_authentic_Kas: | |
| 556 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 557 | \<in> parts (spies evs); B \<noteq> Tgs; B \<notin> bad; | |
| 558 | evs \<in> kerbV \<rbrakk> | |
| 559 | \<Longrightarrow> \<exists>authK Ta. | |
| 560 | Says Kas A | |
| 561 | \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 562 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> \<rbrace> | |
| 563 | \<in> set evs \<and> | |
| 564 | servKlife + Ts <= authKlife + Ta" | |
| 565 | apply (blast dest!: servTicket_authentic_Tgs u_K4_imp_K2) | |
| 566 | done | |
| 567 | ||
| 568 | lemma servTicket_authentic: | |
| 569 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 570 | \<in> parts (spies evs); B \<noteq> Tgs; B \<notin> bad; | |
| 571 | evs \<in> kerbV \<rbrakk> | |
| 572 | \<Longrightarrow> \<exists>Ta authK. | |
| 573 | Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 574 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace> \<rbrace> \<in> set evs | |
| 575 | \<and> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 576 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace> | |
| 577 | \<in> set evs" | |
| 578 | apply (blast dest: servTicket_authentic_Tgs K4_imp_K2) | |
| 579 | done | |
| 580 | ||
| 581 | lemma u_servTicket_authentic: | |
| 582 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 583 | \<in> parts (spies evs); B \<noteq> Tgs; B \<notin> bad; | |
| 584 | evs \<in> kerbV \<rbrakk> | |
| 585 | \<Longrightarrow> \<exists>Ta authK. | |
| 586 | Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 587 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace> \<in> set evs | |
| 588 | \<and> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 589 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace> | |
| 590 | \<in> set evs | |
| 591 | \<and> servKlife + Ts <= authKlife + Ta" | |
| 592 | apply (blast dest: servTicket_authentic_Tgs u_K4_imp_K2) | |
| 593 | done | |
| 594 | ||
| 595 | lemma u_NotexpiredSK_NotexpiredAK: | |
| 596 | "\<lbrakk> \<not> expiredSK Ts evs; servKlife + Ts <= authKlife + Ta \<rbrakk> | |
| 597 | \<Longrightarrow> \<not> expiredAK Ta evs" | |
| 598 | apply (blast dest: leI le_trans dest: leD) | |
| 599 | done | |
| 600 | ||
| 601 | ||
| 602 | subsection{* Reliability: friendly agents send somthing if something else happened*}
 | |
| 603 | ||
| 604 | lemma K3_imp_K2: | |
| 605 | "\<lbrakk> Says A Tgs | |
| 606 | \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace> | |
| 607 | \<in> set evs; | |
| 608 | A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 609 | \<Longrightarrow> \<exists>Ta AT. Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Ta\<rbrace>, | |
| 610 | AT\<rbrace> \<in> set evs" | |
| 611 | apply (erule rev_mp) | |
| 612 | apply (erule kerbV.induct) | |
| 613 | apply (frule_tac [7] Says_ticket_parts) | |
| 614 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast, blast) | |
| 615 | apply (blast dest: Says_imp_spies [THEN parts.Inj, THEN parts.Fst, THEN authK_authentic]) | |
| 616 | done | |
| 617 | ||
| 618 | text{*Anticipated here from next subsection. An authK is encrypted by one and only one Shared key. A servK is encrypted by one and only one authK.*}
 | |
| 619 | lemma Key_unique_SesKey: | |
| 620 | "\<lbrakk> Crypt K \<lbrace>Key SesKey, Agent B, T\<rbrace> | |
| 621 | \<in> parts (spies evs); | |
| 622 | Crypt K' \<lbrace>Key SesKey, Agent B', T'\<rbrace> | |
| 623 | \<in> parts (spies evs); Key SesKey \<notin> analz (spies evs); | |
| 624 | evs \<in> kerbV \<rbrakk> | |
| 625 | \<Longrightarrow> K=K' \<and> B=B' \<and> T=T'" | |
| 626 | apply (erule rev_mp) | |
| 627 | apply (erule rev_mp) | |
| 628 | apply (erule rev_mp) | |
| 629 | apply (erule kerbV.induct, analz_mono_contra) | |
| 630 | apply (frule_tac [7] Says_ticket_parts) | |
| 631 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 632 | txt{*Fake, K2, K4*}
 | |
| 633 | apply (blast+) | |
| 634 | done | |
| 635 | ||
| 636 | text{*This inevitably has an existential form in version V*}
 | |
| 637 | lemma Says_K5: | |
| 638 | "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs); | |
| 639 | Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 640 | servTicket\<rbrace> \<in> set evs; | |
| 641 | Key servK \<notin> analz (spies evs); | |
| 642 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 643 | \<Longrightarrow> \<exists> ST. Says A B \<lbrace>ST, Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs" | |
| 644 | apply (erule rev_mp) | |
| 645 | apply (erule rev_mp) | |
| 646 | apply (erule rev_mp) | |
| 647 | apply (erule kerbV.induct, analz_mono_contra) | |
| 648 | apply (frule_tac [5] Says_ticket_parts) | |
| 649 | apply (frule_tac [7] Says_ticket_parts) | |
| 650 | apply (simp_all (no_asm_simp) add: all_conj_distrib) | |
| 651 | apply blast | |
| 652 | txt{*K3*}
 | |
| 653 | apply (blast dest: authK_authentic Says_Kas_message_form Says_Tgs_message_form) | |
| 654 | txt{*K4*}
 | |
| 655 | apply (force dest!: Crypt_imp_keysFor) | |
| 656 | txt{*K5*}
 | |
| 657 | apply (blast dest: Key_unique_SesKey) | |
| 658 | done | |
| 659 | ||
| 660 | text{*Anticipated here from next subsection*}
 | |
| 661 | lemma unique_CryptKey: | |
| 662 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key SesKey, T\<rbrace> | |
| 663 | \<in> parts (spies evs); | |
| 664 | Crypt (shrK B') \<lbrace>Agent A', Agent B', Key SesKey, T'\<rbrace> | |
| 665 | \<in> parts (spies evs); Key SesKey \<notin> analz (spies evs); | |
| 666 | evs \<in> kerbV \<rbrakk> | |
| 667 | \<Longrightarrow> A=A' & B=B' & T=T'" | |
| 668 | apply (erule rev_mp) | |
| 669 | apply (erule rev_mp) | |
| 670 | apply (erule rev_mp) | |
| 671 | apply (erule kerbV.induct, analz_mono_contra) | |
| 672 | apply (frule_tac [7] Says_ticket_parts) | |
| 673 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 674 | txt{*Fake, K2, K4*}
 | |
| 675 | apply (blast+) | |
| 676 | done | |
| 677 | ||
| 678 | lemma Says_K6: | |
| 679 | "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs); | |
| 680 | Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 681 | servTicket\<rbrace> \<in> set evs; | |
| 682 | Key servK \<notin> analz (spies evs); | |
| 683 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 684 | \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs" | |
| 685 | apply (frule Says_Tgs_message_form, assumption, clarify) | |
| 686 | apply (erule rev_mp) | |
| 687 | apply (erule rev_mp) | |
| 688 | apply (erule rev_mp) | |
| 689 | apply (erule kerbV.induct, analz_mono_contra) | |
| 690 | apply (frule_tac [7] Says_ticket_parts) | |
| 691 | apply (frule_tac [5] Says_ticket_parts) | |
| 692 | apply (simp_all (no_asm_simp)) | |
| 693 | ||
| 694 | txt{*fake*}
 | |
| 695 | apply blast | |
| 696 | txt{*K4*}
 | |
| 697 | apply (force dest!: Crypt_imp_keysFor, clarify) | |
| 698 | txt{*K6*}
 | |
| 32404 | 699 | apply (metis Says_imp_spies Says_ticket_parts analz.Fst analz.Inj analz_conj_parts unique_CryptKey) | 
| 18886 | 700 | done | 
| 701 | ||
| 702 | text{*Needs a unicity theorem, hence moved here*}
 | |
| 703 | lemma servK_authentic_ter: | |
| 704 | "\<lbrakk> Says Kas A | |
| 705 | \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Ta\<rbrace>, authTicket\<rbrace> \<in> set evs; | |
| 706 | Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace> | |
| 707 | \<in> parts (spies evs); | |
| 708 | Key authK \<notin> analz (spies evs); | |
| 709 | evs \<in> kerbV \<rbrakk> | |
| 710 | \<Longrightarrow> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Ts\<rbrace>, | |
| 711 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace> \<rbrace> | |
| 712 | \<in> set evs" | |
| 713 | apply (frule Says_Kas_message_form, assumption) | |
| 714 | apply clarify | |
| 715 | apply (erule rev_mp) | |
| 716 | apply (erule rev_mp) | |
| 717 | apply (erule rev_mp) | |
| 718 | apply (erule kerbV.induct, analz_mono_contra) | |
| 719 | apply (frule_tac [7] Says_ticket_parts) | |
| 720 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast) | |
| 721 | txt{*K2 and K4 remain*}
 | |
| 722 | apply (blast dest!: servK_authentic Says_Tgs_message_form authKeys_used) | |
| 723 | apply (blast dest!: unique_CryptKey) | |
| 724 | done | |
| 725 | ||
| 726 | ||
| 727 | subsection{*Unicity Theorems*}
 | |
| 728 | ||
| 729 | text{* The session key, if secure, uniquely identifies the Ticket
 | |
| 730 | whether authTicket or servTicket. As a matter of fact, one can read | |
| 731 | also Tgs in the place of B. *} | |
| 732 | ||
| 733 | ||
| 734 | lemma unique_authKeys: | |
| 735 | "\<lbrakk> Says Kas A | |
| 736 | \<lbrace>Crypt Ka \<lbrace>Key authK, Agent Tgs, Ta\<rbrace>, X\<rbrace> \<in> set evs; | |
| 737 | Says Kas A' | |
| 738 | \<lbrace>Crypt Ka' \<lbrace>Key authK, Agent Tgs, Ta'\<rbrace>, X'\<rbrace> \<in> set evs; | |
| 739 | evs \<in> kerbV \<rbrakk> \<Longrightarrow> A=A' \<and> Ka=Ka' \<and> Ta=Ta' \<and> X=X'" | |
| 740 | apply (erule rev_mp) | |
| 741 | apply (erule rev_mp) | |
| 742 | apply (erule kerbV.induct) | |
| 743 | apply (frule_tac [7] Says_ticket_parts) | |
| 744 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 745 | apply blast+ | |
| 746 | done | |
| 747 | ||
| 748 | text{* servK uniquely identifies the message from Tgs *}
 | |
| 749 | lemma unique_servKeys: | |
| 750 | "\<lbrakk> Says Tgs A | |
| 751 | \<lbrace>Crypt K \<lbrace>Key servK, Agent B, Ts\<rbrace>, X\<rbrace> \<in> set evs; | |
| 752 | Says Tgs A' | |
| 753 | \<lbrace>Crypt K' \<lbrace>Key servK, Agent B', Ts'\<rbrace>, X'\<rbrace> \<in> set evs; | |
| 754 | evs \<in> kerbV \<rbrakk> \<Longrightarrow> A=A' \<and> B=B' \<and> K=K' \<and> Ts=Ts' \<and> X=X'" | |
| 755 | apply (erule rev_mp) | |
| 756 | apply (erule rev_mp) | |
| 757 | apply (erule kerbV.induct) | |
| 758 | apply (frule_tac [7] Says_ticket_parts) | |
| 759 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 760 | apply blast+ | |
| 761 | done | |
| 762 | ||
| 763 | subsection{*Lemmas About the Predicate @{term AKcryptSK}*}
 | |
| 764 | ||
| 765 | lemma not_AKcryptSK_Nil [iff]: "\<not> AKcryptSK authK servK []" | |
| 766 | apply (simp add: AKcryptSK_def) | |
| 767 | done | |
| 768 | ||
| 769 | lemma AKcryptSKI: | |
| 770 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, tt\<rbrace>, X \<rbrace> \<in> set evs; | |
| 771 | evs \<in> kerbV \<rbrakk> \<Longrightarrow> AKcryptSK authK servK evs" | |
| 772 | apply (unfold AKcryptSK_def) | |
| 773 | apply (blast dest: Says_Tgs_message_form) | |
| 774 | done | |
| 775 | ||
| 776 | lemma AKcryptSK_Says [simp]: | |
| 777 | "AKcryptSK authK servK (Says S A X # evs) = | |
| 778 | (S = Tgs \<and> | |
| 779 | (\<exists>B tt. X = \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, tt\<rbrace>, | |
| 780 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, tt\<rbrace> \<rbrace>) | |
| 781 | | AKcryptSK authK servK evs)" | |
| 782 | apply (unfold AKcryptSK_def) | |
| 783 | apply (simp (no_asm)) | |
| 784 | apply blast | |
| 785 | done | |
| 786 | ||
| 787 | lemma AKcryptSK_Notes [simp]: | |
| 788 | "AKcryptSK authK servK (Notes A X # evs) = | |
| 789 | AKcryptSK authK servK evs" | |
| 790 | apply (unfold AKcryptSK_def) | |
| 791 | apply (simp (no_asm)) | |
| 792 | done | |
| 793 | ||
| 794 | (*A fresh authK cannot be associated with any other | |
| 795 | (with respect to a given trace). *) | |
| 796 | lemma Auth_fresh_not_AKcryptSK: | |
| 797 | "\<lbrakk> Key authK \<notin> used evs; evs \<in> kerbV \<rbrakk> | |
| 798 | \<Longrightarrow> \<not> AKcryptSK authK servK evs" | |
| 799 | apply (unfold AKcryptSK_def) | |
| 800 | apply (erule rev_mp) | |
| 801 | apply (erule kerbV.induct) | |
| 802 | apply (frule_tac [7] Says_ticket_parts) | |
| 803 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast) | |
| 804 | done | |
| 805 | ||
| 806 | (*A fresh servK cannot be associated with any other | |
| 807 | (with respect to a given trace). *) | |
| 808 | lemma Serv_fresh_not_AKcryptSK: | |
| 809 | "Key servK \<notin> used evs \<Longrightarrow> \<not> AKcryptSK authK servK evs" | |
| 810 | apply (unfold AKcryptSK_def, blast) | |
| 811 | done | |
| 812 | ||
| 813 | lemma authK_not_AKcryptSK: | |
| 814 | "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, tk\<rbrace> | |
| 815 | \<in> parts (spies evs); evs \<in> kerbV \<rbrakk> | |
| 816 | \<Longrightarrow> \<not> AKcryptSK K authK evs" | |
| 817 | apply (erule rev_mp) | |
| 818 | apply (erule kerbV.induct) | |
| 819 | apply (frule_tac [7] Says_ticket_parts) | |
| 820 | apply (frule_tac [5] Says_ticket_parts, simp_all) | |
| 821 | txt{*Fake*}
 | |
| 822 | apply blast | |
| 823 | txt{*K2: by freshness*}
 | |
| 824 | apply (simp add: AKcryptSK_def) | |
| 825 | apply blast | |
| 826 | txt{*K4*}
 | |
| 827 | apply blast | |
| 828 | done | |
| 829 | ||
| 830 | text{*A secure serverkey cannot have been used to encrypt others*}
 | |
| 831 | lemma servK_not_AKcryptSK: | |
| 832 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key SK, tt\<rbrace> \<in> parts (spies evs); | |
| 833 | Key SK \<notin> analz (spies evs); SK \<in> symKeys; | |
| 834 | B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 835 | \<Longrightarrow> \<not> AKcryptSK SK K evs" | |
| 836 | apply (erule rev_mp) | |
| 837 | apply (erule rev_mp) | |
| 838 | apply (erule kerbV.induct, analz_mono_contra) | |
| 839 | apply (frule_tac [7] Says_ticket_parts) | |
| 840 | apply (frule_tac [5] Says_ticket_parts, simp_all, blast) | |
| 32404 | 841 | txt{*K4*}
 | 
| 842 | apply (metis Auth_fresh_not_AKcryptSK Crypt_imp_invKey_keysFor Says_ticket_analz | |
| 843 | analz.Fst invKey_K new_keys_not_analzd parts.Fst Says_imp_parts_knows_Spy | |
| 844 | unique_CryptKey) | |
| 18886 | 845 | done | 
| 846 | ||
| 847 | text{*Long term keys are not issued as servKeys*}
 | |
| 848 | lemma shrK_not_AKcryptSK: | |
| 849 | "evs \<in> kerbV \<Longrightarrow> \<not> AKcryptSK K (shrK A) evs" | |
| 850 | apply (unfold AKcryptSK_def) | |
| 851 | apply (erule kerbV.induct) | |
| 852 | apply (frule_tac [7] Says_ticket_parts) | |
| 853 | apply (frule_tac [5] Says_ticket_parts, auto) | |
| 854 | done | |
| 855 | ||
| 856 | text{*The Tgs message associates servK with authK and therefore not with any
 | |
| 857 | other key authK.*} | |
| 858 | lemma Says_Tgs_AKcryptSK: | |
| 859 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, tt\<rbrace>, X \<rbrace> | |
| 860 | \<in> set evs; | |
| 861 | authK' \<noteq> authK; evs \<in> kerbV \<rbrakk> | |
| 862 | \<Longrightarrow> \<not> AKcryptSK authK' servK evs" | |
| 863 | apply (unfold AKcryptSK_def) | |
| 864 | apply (blast dest: unique_servKeys) | |
| 865 | done | |
| 866 | ||
| 867 | lemma AKcryptSK_not_AKcryptSK: | |
| 868 | "\<lbrakk> AKcryptSK authK servK evs; evs \<in> kerbV \<rbrakk> | |
| 869 | \<Longrightarrow> \<not> AKcryptSK servK K evs" | |
| 870 | apply (erule rev_mp) | |
| 871 | apply (erule kerbV.induct) | |
| 872 | apply (frule_tac [7] Says_ticket_parts) | |
| 873 | apply (frule_tac [5] Says_ticket_parts) | |
| 874 | apply (simp_all, safe) | |
| 875 | txt{*K4 splits into subcases*}
 | |
| 876 | (*apply simp_all*) | |
| 877 | prefer 4 apply (blast dest!: authK_not_AKcryptSK) | |
| 878 | txt{*servK is fresh and so could not have been used, by
 | |
| 879 |    @{text new_keys_not_used}*}
 | |
| 880 | prefer 2 | |
| 881 | apply (force dest!: Crypt_imp_invKey_keysFor simp add: AKcryptSK_def) | |
| 882 | txt{*Others by freshness*}
 | |
| 883 | apply (blast+) | |
| 884 | done | |
| 885 | ||
| 886 | lemma not_different_AKcryptSK: | |
| 887 | "\<lbrakk> AKcryptSK authK servK evs; | |
| 888 | authK' \<noteq> authK; evs \<in> kerbV \<rbrakk> | |
| 889 | \<Longrightarrow> \<not> AKcryptSK authK' servK evs \<and> servK \<in> symKeys" | |
| 890 | apply (simp add: AKcryptSK_def) | |
| 891 | apply (blast dest: unique_servKeys Says_Tgs_message_form) | |
| 892 | done | |
| 893 | ||
| 894 | text{*The only session keys that can be found with the help of session keys are
 | |
| 895 | those sent by Tgs in step K4. *} | |
| 896 | ||
| 897 | text{*We take some pains to express the property
 | |
| 898 | as a logical equivalence so that the simplifier can apply it.*} | |
| 899 | lemma Key_analz_image_Key_lemma: | |
| 900 | "P \<longrightarrow> (Key K \<in> analz (Key`KK Un H)) \<longrightarrow> (K:KK | Key K \<in> analz H) | |
| 901 | \<Longrightarrow> | |
| 902 | P \<longrightarrow> (Key K \<in> analz (Key`KK Un H)) = (K:KK | Key K \<in> analz H)" | |
| 903 | by (blast intro: analz_mono [THEN subsetD]) | |
| 904 | ||
| 905 | ||
| 906 | lemma AKcryptSK_analz_insert: | |
| 907 | "\<lbrakk> AKcryptSK K K' evs; K \<in> symKeys; evs \<in> kerbV \<rbrakk> | |
| 908 | \<Longrightarrow> Key K' \<in> analz (insert (Key K) (spies evs))" | |
| 909 | apply (simp add: AKcryptSK_def, clarify) | |
| 910 | apply (drule Says_imp_spies [THEN analz.Inj, THEN analz_insertI], auto) | |
| 911 | done | |
| 912 | ||
| 913 | lemma authKeys_are_not_AKcryptSK: | |
| 914 | "\<lbrakk> K \<in> authKeys evs Un range shrK; evs \<in> kerbV \<rbrakk> | |
| 915 | \<Longrightarrow> \<forall>SK. \<not> AKcryptSK SK K evs \<and> K \<in> symKeys" | |
| 916 | apply (simp add: authKeys_def AKcryptSK_def) | |
| 917 | apply (blast dest: Says_Kas_message_form Says_Tgs_message_form) | |
| 918 | done | |
| 919 | ||
| 920 | lemma not_authKeys_not_AKcryptSK: | |
| 921 | "\<lbrakk> K \<notin> authKeys evs; | |
| 922 | K \<notin> range shrK; evs \<in> kerbV \<rbrakk> | |
| 923 | \<Longrightarrow> \<forall>SK. \<not> AKcryptSK K SK evs" | |
| 924 | apply (simp add: AKcryptSK_def) | |
| 925 | apply (blast dest: Says_Tgs_message_form) | |
| 926 | done | |
| 927 | ||
| 928 | ||
| 929 | subsection{*Secrecy Theorems*}
 | |
| 930 | ||
| 931 | text{*For the Oops2 case of the next theorem*}
 | |
| 932 | lemma Oops2_not_AKcryptSK: | |
| 933 | "\<lbrakk> evs \<in> kerbV; | |
| 934 | Says Tgs A \<lbrace>Crypt authK | |
| 935 | \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 936 | \<in> set evs \<rbrakk> | |
| 937 | \<Longrightarrow> \<not> AKcryptSK servK SK evs" | |
| 938 | apply (blast dest: AKcryptSKI AKcryptSK_not_AKcryptSK) | |
| 939 | done | |
| 940 | ||
| 941 | text{* Big simplification law for keys SK that are not crypted by keys in KK
 | |
| 942 | It helps prove three, otherwise hard, facts about keys. These facts are | |
| 943 | exploited as simplification laws for analz, and also "limit the damage" | |
| 944 | in case of loss of a key to the spy. See ESORICS98.*} | |
| 945 | lemma Key_analz_image_Key [rule_format (no_asm)]: | |
| 946 | "evs \<in> kerbV \<Longrightarrow> | |
| 947 | (\<forall>SK KK. SK \<in> symKeys & KK <= -(range shrK) \<longrightarrow> | |
| 948 | (\<forall>K \<in> KK. \<not> AKcryptSK K SK evs) \<longrightarrow> | |
| 949 | (Key SK \<in> analz (Key`KK Un (spies evs))) = | |
| 950 | (SK \<in> KK | Key SK \<in> analz (spies evs)))" | |
| 951 | apply (erule kerbV.induct) | |
| 952 | apply (frule_tac [10] Oops_range_spies2) | |
| 953 | apply (frule_tac [9] Oops_range_spies1) | |
| 954 | (*Used to apply Says_tgs_message form, which is no longer available. | |
| 955 | Instead\<dots>*) | |
| 956 | apply (drule_tac [7] Says_ticket_analz) | |
| 957 | (*Used to apply Says_kas_message form, which is no longer available. | |
| 958 | Instead\<dots>*) | |
| 959 | apply (drule_tac [5] Says_ticket_analz) | |
| 960 | apply (safe del: impI intro!: Key_analz_image_Key_lemma [THEN impI]) | |
| 961 | txt{*Case-splits for Oops1 and message 5: the negated case simplifies using
 | |
| 962 | the induction hypothesis*} | |
| 963 | apply (case_tac [9] "AKcryptSK authK SK evsO1") | |
| 964 | apply (case_tac [7] "AKcryptSK servK SK evs5") | |
| 965 | apply (simp_all del: image_insert | |
| 966 | add: analz_image_freshK_simps AKcryptSK_Says shrK_not_AKcryptSK | |
| 967 | Oops2_not_AKcryptSK Auth_fresh_not_AKcryptSK | |
| 968 | Serv_fresh_not_AKcryptSK Says_Tgs_AKcryptSK Spy_analz_shrK) | |
| 969 | txt{*Fake*} 
 | |
| 970 | apply spy_analz | |
| 971 | txt{*K2*}
 | |
| 972 | apply blast | |
| 973 | txt{*Cases K3 and K5 solved by the simplifier thanks to the ticket being in 
 | |
| 974 | analz - this strategy is new wrt version IV*} | |
| 975 | txt{*K4*}
 | |
| 976 | apply (blast dest!: authK_not_AKcryptSK) | |
| 977 | txt{*Oops1*}
 | |
| 32404 | 978 | apply (metis AKcryptSK_analz_insert insert_Key_singleton) | 
| 18886 | 979 | done | 
| 980 | ||
| 981 | text{* First simplification law for analz: no session keys encrypt
 | |
| 982 | authentication keys or shared keys. *} | |
| 983 | lemma analz_insert_freshK1: | |
| 984 | "\<lbrakk> evs \<in> kerbV; K \<in> authKeys evs Un range shrK; | |
| 985 | SesKey \<notin> range shrK \<rbrakk> | |
| 986 | \<Longrightarrow> (Key K \<in> analz (insert (Key SesKey) (spies evs))) = | |
| 987 | (K = SesKey | Key K \<in> analz (spies evs))" | |
| 988 | apply (frule authKeys_are_not_AKcryptSK, assumption) | |
| 989 | apply (simp del: image_insert | |
| 990 | add: analz_image_freshK_simps add: Key_analz_image_Key) | |
| 991 | done | |
| 992 | ||
| 993 | ||
| 994 | text{* Second simplification law for analz: no service keys encrypt any other keys.*}
 | |
| 995 | lemma analz_insert_freshK2: | |
| 996 | "\<lbrakk> evs \<in> kerbV; servK \<notin> (authKeys evs); servK \<notin> range shrK; | |
| 997 | K \<in> symKeys \<rbrakk> | |
| 998 | \<Longrightarrow> (Key K \<in> analz (insert (Key servK) (spies evs))) = | |
| 999 | (K = servK | Key K \<in> analz (spies evs))" | |
| 1000 | apply (frule not_authKeys_not_AKcryptSK, assumption, assumption) | |
| 1001 | apply (simp del: image_insert | |
| 1002 | add: analz_image_freshK_simps add: Key_analz_image_Key) | |
| 1003 | done | |
| 1004 | ||
| 1005 | ||
| 1006 | text{* Third simplification law for analz: only one authentication key encrypts a certain service key.*}
 | |
| 1007 | ||
| 1008 | lemma analz_insert_freshK3: | |
| 1009 | "\<lbrakk> AKcryptSK authK servK evs; | |
| 1010 | authK' \<noteq> authK; authK' \<notin> range shrK; evs \<in> kerbV \<rbrakk> | |
| 1011 | \<Longrightarrow> (Key servK \<in> analz (insert (Key authK') (spies evs))) = | |
| 1012 | (servK = authK' | Key servK \<in> analz (spies evs))" | |
| 1013 | apply (drule_tac authK' = authK' in not_different_AKcryptSK, blast, assumption) | |
| 1014 | apply (simp del: image_insert | |
| 1015 | add: analz_image_freshK_simps add: Key_analz_image_Key) | |
| 1016 | done | |
| 1017 | ||
| 1018 | lemma analz_insert_freshK3_bis: | |
| 1019 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 1020 | \<in> set evs; | |
| 1021 | authK \<noteq> authK'; authK' \<notin> range shrK; evs \<in> kerbV \<rbrakk> | |
| 1022 | \<Longrightarrow> (Key servK \<in> analz (insert (Key authK') (spies evs))) = | |
| 1023 | (servK = authK' | Key servK \<in> analz (spies evs))" | |
| 1024 | apply (frule AKcryptSKI, assumption) | |
| 1025 | apply (simp add: analz_insert_freshK3) | |
| 1026 | done | |
| 1027 | ||
| 1028 | text{*a weakness of the protocol*}
 | |
| 1029 | lemma authK_compromises_servK: | |
| 1030 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 1031 | \<in> set evs; authK \<in> symKeys; | |
| 1032 | Key authK \<in> analz (spies evs); evs \<in> kerbV \<rbrakk> | |
| 1033 | \<Longrightarrow> Key servK \<in> analz (spies evs)" | |
| 32404 | 1034 | by (metis Says_imp_analz_Spy analz.Fst analz_Decrypt') | 
| 1035 | ||
| 18886 | 1036 | |
| 1037 | text{*lemma @{text servK_notin_authKeysD} not needed in version V*}
 | |
| 1038 | ||
| 1039 | text{*If Spy sees the Authentication Key sent in msg K2, then
 | |
| 1040 | the Key has expired.*} | |
| 1041 | lemma Confidentiality_Kas_lemma [rule_format]: | |
| 1042 | "\<lbrakk> authK \<in> symKeys; A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1043 | \<Longrightarrow> Says Kas A | |
| 1044 | \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, | |
| 1045 | Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace> | |
| 1046 | \<in> set evs \<longrightarrow> | |
| 1047 | Key authK \<in> analz (spies evs) \<longrightarrow> | |
| 1048 | expiredAK Ta evs" | |
| 1049 | apply (erule kerbV.induct) | |
| 1050 | apply (frule_tac [10] Oops_range_spies2) | |
| 1051 | apply (frule_tac [9] Oops_range_spies1) | |
| 1052 | apply (frule_tac [7] Says_ticket_analz) | |
| 1053 | apply (frule_tac [5] Says_ticket_analz) | |
| 1054 | apply (safe del: impI conjI impCE) | |
| 1055 | apply (simp_all (no_asm_simp) add: Says_Kas_message_form less_SucI analz_insert_eq not_parts_not_analz analz_insert_freshK1 pushes) | |
| 1056 | txt{*Fake*}
 | |
| 1057 | apply spy_analz | |
| 1058 | txt{*K2*}
 | |
| 1059 | apply blast | |
| 1060 | txt{*K4*}
 | |
| 1061 | apply blast | |
| 1062 | txt{*Oops1*}
 | |
| 1063 | apply (blast dest!: unique_authKeys intro: less_SucI) | |
| 1064 | txt{*Oops2*}
 | |
| 1065 | apply (blast dest: Says_Tgs_message_form Says_Kas_message_form) | |
| 1066 | done | |
| 1067 | ||
| 1068 | lemma Confidentiality_Kas: | |
| 1069 | "\<lbrakk> Says Kas A | |
| 1070 | \<lbrace>Crypt Ka \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, authTicket\<rbrace> | |
| 1071 | \<in> set evs; | |
| 1072 | \<not> expiredAK Ta evs; | |
| 1073 | A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1074 | \<Longrightarrow> Key authK \<notin> analz (spies evs)" | |
| 1075 | apply (blast dest: Says_Kas_message_form Confidentiality_Kas_lemma) | |
| 1076 | done | |
| 1077 | ||
| 1078 | text{*If Spy sees the Service Key sent in msg K4, then
 | |
| 1079 | the Key has expired.*} | |
| 1080 | ||
| 1081 | lemma Confidentiality_lemma [rule_format]: | |
| 1082 | "\<lbrakk> Says Tgs A | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1083 | \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1084 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace> | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1085 | \<in> set evs; | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1086 | Key authK \<notin> analz (spies evs); | 
| 18886 | 1087 | servK \<in> symKeys; | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1088 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | 
| 18886 | 1089 | \<Longrightarrow> Key servK \<in> analz (spies evs) \<longrightarrow> | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32404diff
changeset | 1090 | expiredSK Ts evs" | 
| 18886 | 1091 | apply (erule rev_mp) | 
| 1092 | apply (erule rev_mp) | |
| 1093 | apply (erule kerbV.induct) | |
| 1094 | apply (rule_tac [9] impI)+; | |
| 1095 |   --{*The Oops1 case is unusual: must simplify
 | |
| 1096 |     @{term "Authkey \<notin> analz (spies (ev#evs))"}, not letting
 | |
| 1097 |    @{text analz_mono_contra} weaken it to
 | |
| 1098 |    @{term "Authkey \<notin> analz (spies evs)"},
 | |
| 1099 |   for we then conclude @{term "authK \<noteq> authKa"}.*}
 | |
| 1100 | apply analz_mono_contra | |
| 1101 | apply (frule_tac [10] Oops_range_spies2) | |
| 1102 | apply (frule_tac [9] Oops_range_spies1) | |
| 1103 | apply (frule_tac [7] Says_ticket_analz) | |
| 1104 | apply (frule_tac [5] Says_ticket_analz) | |
| 1105 | apply (safe del: impI conjI impCE) | |
| 1106 | apply (simp_all add: less_SucI new_keys_not_analzd Says_Kas_message_form Says_Tgs_message_form analz_insert_eq not_parts_not_analz analz_insert_freshK1 analz_insert_freshK2 analz_insert_freshK3_bis pushes) | |
| 32404 | 1107 |     txt{*Fake*}
 | 
| 1108 | apply spy_analz | |
| 1109 |    txt{*K2*}
 | |
| 1110 | apply (blast intro: parts_insertI less_SucI) | |
| 1111 |   txt{*K4*}
 | |
| 1112 | apply (blast dest: authTicket_authentic Confidentiality_Kas) | |
| 1113 |  txt{*Oops1*}
 | |
| 18886 | 1114 | apply (blast dest: Says_Kas_message_form Says_Tgs_message_form intro: less_SucI) | 
| 1115 | txt{*Oops2*}
 | |
| 32404 | 1116 | apply (metis Suc_le_eq linorder_linear linorder_not_le msg.simps(2) unique_servKeys) | 
| 18886 | 1117 | done | 
| 1118 | ||
| 1119 | ||
| 1120 | text{* In the real world Tgs can't check wheter authK is secure! *}
 | |
| 1121 | lemma Confidentiality_Tgs: | |
| 1122 | "\<lbrakk> Says Tgs A | |
| 1123 | \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 1124 | \<in> set evs; | |
| 1125 | Key authK \<notin> analz (spies evs); | |
| 1126 | \<not> expiredSK Ts evs; | |
| 1127 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1128 | \<Longrightarrow> Key servK \<notin> analz (spies evs)" | |
| 1129 | apply (blast dest: Says_Tgs_message_form Confidentiality_lemma) | |
| 1130 | done | |
| 1131 | ||
| 1132 | text{* In the real world Tgs CAN check what Kas sends! *}
 | |
| 1133 | lemma Confidentiality_Tgs_bis: | |
| 1134 | "\<lbrakk> Says Kas A | |
| 1135 | \<lbrace>Crypt Ka \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace>, authTicket\<rbrace> | |
| 1136 | \<in> set evs; | |
| 1137 | Says Tgs A | |
| 1138 | \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 1139 | \<in> set evs; | |
| 1140 | \<not> expiredAK Ta evs; \<not> expiredSK Ts evs; | |
| 1141 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1142 | \<Longrightarrow> Key servK \<notin> analz (spies evs)" | |
| 1143 | apply (blast dest!: Confidentiality_Kas Confidentiality_Tgs) | |
| 1144 | done | |
| 1145 | ||
| 1146 | text{*Most general form*}
 | |
| 1147 | lemmas Confidentiality_Tgs_ter = authTicket_authentic [THEN Confidentiality_Tgs_bis] | |
| 1148 | ||
| 1149 | lemmas Confidentiality_Auth_A = authK_authentic [THEN exE, THEN Confidentiality_Kas] | |
| 1150 | ||
| 1151 | text{*Needs a confidentiality guarantee, hence moved here.
 | |
| 1152 | Authenticity of servK for A*} | |
| 1153 | lemma servK_authentic_bis_r: | |
| 1154 | "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1155 | \<in> parts (spies evs); | |
| 1156 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1157 | \<in> parts (spies evs); | |
| 1158 | \<not> expiredAK Ta evs; A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1159 | \<Longrightarrow> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, | |
| 1160 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> \<rbrace> | |
| 1161 | \<in> set evs" | |
| 1162 | apply (frule authK_authentic, assumption, assumption) | |
| 1163 | apply (erule exE) | |
| 1164 | apply (drule Confidentiality_Auth_A, assumption, assumption) | |
| 1165 | apply (blast, assumption, assumption, assumption) | |
| 1166 | apply (blast dest: servK_authentic_ter) | |
| 1167 | done | |
| 1168 | ||
| 1169 | lemma Confidentiality_Serv_A: | |
| 1170 | "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1171 | \<in> parts (spies evs); | |
| 1172 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1173 | \<in> parts (spies evs); | |
| 1174 | \<not> expiredAK Ta evs; \<not> expiredSK Ts evs; | |
| 1175 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1176 | \<Longrightarrow> Key servK \<notin> analz (spies evs)" | |
| 1177 | apply (drule authK_authentic, assumption, assumption) | |
| 1178 | apply (blast dest: Confidentiality_Kas Says_Kas_message_form servK_authentic_ter Confidentiality_Tgs_bis) | |
| 1179 | done | |
| 1180 | ||
| 1181 | lemma Confidentiality_B: | |
| 1182 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1183 | \<in> parts (spies evs); | |
| 1184 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1185 | \<in> parts (spies evs); | |
| 1186 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1187 | \<in> parts (spies evs); | |
| 1188 | \<not> expiredSK Ts evs; \<not> expiredAK Ta evs; | |
| 1189 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1190 | \<Longrightarrow> Key servK \<notin> analz (spies evs)" | |
| 1191 | apply (frule authK_authentic) | |
| 1192 | apply (erule_tac [3] exE) | |
| 1193 | apply (frule_tac [3] Confidentiality_Kas) | |
| 1194 | apply (frule_tac [6] servTicket_authentic, auto) | |
| 1195 | apply (blast dest!: Confidentiality_Tgs_bis dest: Says_Kas_message_form servK_authentic unique_servKeys unique_authKeys) | |
| 1196 | done | |
| 1197 | ||
| 1198 | lemma u_Confidentiality_B: | |
| 1199 | "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1200 | \<in> parts (spies evs); | |
| 1201 | \<not> expiredSK Ts evs; | |
| 1202 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1203 | \<Longrightarrow> Key servK \<notin> analz (spies evs)" | |
| 1204 | apply (blast dest: u_servTicket_authentic u_NotexpiredSK_NotexpiredAK Confidentiality_Tgs_bis) | |
| 1205 | done | |
| 1206 | ||
| 1207 | ||
| 1208 | ||
| 1209 | subsection{*Parties authentication: each party verifies "the identity of
 | |
| 1210 | another party who generated some data" (quoted from Neuman and Ts'o).*} | |
| 1211 | ||
| 1212 | text{*These guarantees don't assess whether two parties agree on
 | |
| 1213 | the same session key: sending a message containing a key | |
| 1214 | doesn't a priori state knowledge of the key.*} | |
| 1215 | ||
| 1216 | ||
| 1217 | text{*These didn't have existential form in version IV*}
 | |
| 1218 | lemma B_authenticates_A: | |
| 1219 | "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs); | |
| 1220 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1221 | \<in> parts (spies evs); | |
| 1222 | Key servK \<notin> analz (spies evs); | |
| 1223 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1224 | \<Longrightarrow> \<exists> ST. Says A B \<lbrace>ST, Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<rbrace> \<in> set evs" | |
| 1225 | apply (blast dest: servTicket_authentic_Tgs intro: Says_K5) | |
| 1226 | done | |
| 1227 | ||
| 1228 | text{*The second assumption tells B what kind of key servK is.*}
 | |
| 1229 | lemma B_authenticates_A_r: | |
| 1230 | "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs); | |
| 1231 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1232 | \<in> parts (spies evs); | |
| 1233 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1234 | \<in> parts (spies evs); | |
| 1235 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1236 | \<in> parts (spies evs); | |
| 1237 | \<not> expiredSK Ts evs; \<not> expiredAK Ta evs; | |
| 1238 | B \<noteq> Tgs; A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1239 | \<Longrightarrow> \<exists> ST. Says A B \<lbrace>ST, Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<rbrace> \<in> set evs" | |
| 1240 | apply (blast intro: Says_K5 dest: Confidentiality_B servTicket_authentic_Tgs) | |
| 1241 | done | |
| 1242 | ||
| 1243 | text{* @{text u_B_authenticates_A} would be the same as @{text B_authenticates_A} because the
 | |
| 1244 | servK confidentiality assumption is yet unrelaxed*} | |
| 1245 | ||
| 1246 | lemma u_B_authenticates_A_r: | |
| 1247 | "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs); | |
| 1248 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1249 | \<in> parts (spies evs); | |
| 1250 | \<not> expiredSK Ts evs; | |
| 1251 | B \<noteq> Tgs; A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1252 | \<Longrightarrow> \<exists> ST. Says A B \<lbrace>ST, Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<rbrace> \<in> set evs" | |
| 1253 | apply (blast intro: Says_K5 dest: u_Confidentiality_B servTicket_authentic_Tgs) | |
| 1254 | done | |
| 1255 | ||
| 1256 | lemma A_authenticates_B: | |
| 1257 | "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs); | |
| 1258 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1259 | \<in> parts (spies evs); | |
| 1260 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1261 | \<in> parts (spies evs); | |
| 1262 | Key authK \<notin> analz (spies evs); Key servK \<notin> analz (spies evs); | |
| 1263 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1264 | \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs" | |
| 32404 | 1265 | by (metis authK_authentic Oops_range_spies1 Says_K6 servK_authentic u_K4_imp_K2 unique_authKeys) | 
| 18886 | 1266 | |
| 1267 | lemma A_authenticates_B_r: | |
| 1268 | "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs); | |
| 1269 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1270 | \<in> parts (spies evs); | |
| 1271 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1272 | \<in> parts (spies evs); | |
| 1273 | \<not> expiredAK Ta evs; \<not> expiredSK Ts evs; | |
| 1274 | A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1275 | \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs" | |
| 1276 | apply (frule authK_authentic) | |
| 1277 | apply (erule_tac [3] exE) | |
| 1278 | apply (frule_tac [3] Says_Kas_message_form) | |
| 1279 | apply (frule_tac [4] Confidentiality_Kas) | |
| 1280 | apply (frule_tac [7] servK_authentic) | |
| 1281 | prefer 8 apply blast | |
| 1282 | apply (erule_tac [9] exE) | |
| 1283 | apply (erule_tac [9] exE) | |
| 1284 | apply (frule_tac [9] K4_imp_K2) | |
| 1285 | apply assumption+ | |
| 32404 | 1286 | apply (blast dest: Key_unique_SesKey intro!: Says_K6 dest: Confidentiality_Tgs) | 
| 18886 | 1287 | done | 
| 1288 | ||
| 1289 | ||
| 1290 | ||
| 1291 | ||
| 1292 | subsection{*Parties' knowledge of session keys. 
 | |
| 1293 | An agent knows a session key if he used it to issue a cipher. These | |
| 1294 | guarantees can be interpreted both in terms of key distribution | |
| 1295 | and of non-injective agreement on the session key.*} | |
| 1296 | ||
| 1297 | lemma Kas_Issues_A: | |
| 1298 | "\<lbrakk> Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace>, authTicket\<rbrace> \<in> set evs; | |
| 1299 | evs \<in> kerbV \<rbrakk> | |
| 1300 | \<Longrightarrow> Kas Issues A with (Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace>) | |
| 1301 | on evs" | |
| 1302 | apply (simp (no_asm) add: Issues_def) | |
| 1303 | apply (rule exI) | |
| 1304 | apply (rule conjI, assumption) | |
| 1305 | apply (simp (no_asm)) | |
| 1306 | apply (erule rev_mp) | |
| 1307 | apply (erule kerbV.induct) | |
| 1308 | apply (frule_tac [5] Says_ticket_parts) | |
| 1309 | apply (frule_tac [7] Says_ticket_parts) | |
| 1310 | apply (simp_all (no_asm_simp) add: all_conj_distrib) | |
| 1311 | txt{*K2*}
 | |
| 1312 | apply (simp add: takeWhile_tail) | |
| 1313 | apply (blast dest: authK_authentic parts_spies_takeWhile_mono [THEN subsetD] parts_spies_evs_revD2 [THEN subsetD]) | |
| 1314 | done | |
| 1315 | ||
| 1316 | lemma A_authenticates_and_keydist_to_Kas: | |
| 1317 | "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace> \<in> parts (spies evs); | |
| 1318 | A \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1319 | \<Longrightarrow> Kas Issues A with (Crypt (shrK A) \<lbrace>Key authK, Peer, Ta\<rbrace>) | |
| 1320 | on evs" | |
| 1321 | by (blast dest!: authK_authentic Kas_Issues_A) | |
| 1322 | ||
| 1323 | lemma Tgs_Issues_A: | |
| 1324 | "\<lbrakk> Says Tgs A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>, servTicket\<rbrace> | |
| 1325 | \<in> set evs; | |
| 1326 | Key authK \<notin> analz (spies evs); evs \<in> kerbV \<rbrakk> | |
| 1327 | \<Longrightarrow> Tgs Issues A with | |
| 1328 | (Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>) on evs" | |
| 1329 | apply (simp (no_asm) add: Issues_def) | |
| 1330 | apply (rule exI) | |
| 1331 | apply (rule conjI, assumption) | |
| 1332 | apply (simp (no_asm)) | |
| 1333 | apply (erule rev_mp) | |
| 1334 | apply (erule rev_mp) | |
| 1335 | apply (erule kerbV.induct, analz_mono_contra) | |
| 1336 | apply (frule_tac [5] Says_ticket_parts) | |
| 1337 | apply (frule_tac [7] Says_ticket_parts) | |
| 1338 | apply (simp_all (no_asm_simp) add: all_conj_distrib) | |
| 1339 | apply (simp add: takeWhile_tail) | |
| 1340 | (*Last two thms installed only to derive authK \<notin> range shrK*) | |
| 1341 | apply (blast dest: servK_authentic parts_spies_takeWhile_mono [THEN subsetD] | |
| 1342 | parts_spies_evs_revD2 [THEN subsetD] authTicket_authentic | |
| 1343 | Says_Kas_message_form) | |
| 1344 | done | |
| 1345 | ||
| 1346 | lemma A_authenticates_and_keydist_to_Tgs: | |
| 1347 | "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1348 | \<in> parts (spies evs); | |
| 1349 | Key authK \<notin> analz (spies evs); B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1350 | \<Longrightarrow> \<exists>A. Tgs Issues A with | |
| 1351 | (Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace>) on evs" | |
| 1352 | by (blast dest: Tgs_Issues_A servK_authentic_bis) | |
| 1353 | ||
| 1354 | lemma B_Issues_A: | |
| 1355 | "\<lbrakk> Says B A (Crypt servK (Number T3)) \<in> set evs; | |
| 1356 | Key servK \<notin> analz (spies evs); | |
| 1357 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1358 | \<Longrightarrow> B Issues A with (Crypt servK (Number T3)) on evs" | |
| 1359 | apply (simp (no_asm) add: Issues_def) | |
| 1360 | apply (rule exI) | |
| 1361 | apply (rule conjI, assumption) | |
| 1362 | apply (simp (no_asm)) | |
| 1363 | apply (erule rev_mp) | |
| 1364 | apply (erule rev_mp) | |
| 1365 | apply (erule kerbV.induct, analz_mono_contra) | |
| 1366 | apply (simp_all (no_asm_simp) add: all_conj_distrib) | |
| 1367 | apply blast | |
| 1368 | txt{*K6 requires numerous lemmas*}
 | |
| 1369 | apply (simp add: takeWhile_tail) | |
| 1370 | apply (blast intro: Says_K6 dest: servTicket_authentic | |
| 1371 | parts_spies_takeWhile_mono [THEN subsetD] | |
| 1372 | parts_spies_evs_revD2 [THEN subsetD]) | |
| 1373 | done | |
| 1374 | ||
| 1375 | lemma A_authenticates_and_keydist_to_B: | |
| 1376 | "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs); | |
| 1377 | Crypt authK \<lbrace>Key servK, Agent B, Number Ts\<rbrace> | |
| 1378 | \<in> parts (spies evs); | |
| 1379 | Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta\<rbrace> | |
| 1380 | \<in> parts (spies evs); | |
| 1381 | Key authK \<notin> analz (spies evs); Key servK \<notin> analz (spies evs); | |
| 1382 | A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbV \<rbrakk> | |
| 1383 | \<Longrightarrow> B Issues A with (Crypt servK (Number T3)) on evs" | |
| 1384 | by (blast dest!: A_authenticates_B B_Issues_A) | |
| 1385 | ||
| 1386 | ||
| 1387 | (*Must use \<le> rather than =, otherwise it cannot be proved inductively!*) | |
| 1388 | (*This is too strong for version V but would hold for version IV if only B | |
| 1389 | in K6 said a fresh timestamp. | |
| 1390 | lemma honest_never_says_newer_timestamp: | |
| 1391 |      "\<lbrakk> (CT evs) \<le> T ; Number T \<in> parts {X}; evs \<in> kerbV \<rbrakk> 
 | |
| 1392 | \<Longrightarrow> \<forall> A B. A \<noteq> Spy \<longrightarrow> Says A B X \<notin> set evs" | |
| 1393 | apply (erule rev_mp) | |
| 1394 | apply (erule kerbV.induct) | |
| 1395 | apply (simp_all) | |
| 1396 | apply force | |
| 1397 | apply force | |
| 1398 | txt{*clarifying case K3*}
 | |
| 1399 | apply (rule impI) | |
| 1400 | apply (rule impI) | |
| 1401 | apply (frule Suc_leD) | |
| 1402 | apply (clarify) | |
| 1403 | txt{*cannot solve K3 or K5 because the spy might send CT evs as authTicket
 | |
| 1404 | or servTicket, which the honest agent would forward*} | |
| 1405 | prefer 2 apply force | |
| 1406 | prefer 4 apply force | |
| 1407 | prefer 4 apply force | |
| 1408 | txt{*cannot solve K6 unless B updates the timestamp - rather than bouncing T3*}
 | |
| 1409 | oops | |
| 1410 | *) | |
| 1411 | ||
| 1412 | ||
| 1413 | text{*But can prove a less general fact conerning only authenticators!*}
 | |
| 1414 | lemma honest_never_says_newer_timestamp_in_auth: | |
| 1415 |      "\<lbrakk> (CT evs) \<le> T; Number T \<in> parts {X}; A \<notin> bad; evs \<in> kerbV \<rbrakk> 
 | |
| 1416 | \<Longrightarrow> Says A B \<lbrace>Y, X\<rbrace> \<notin> set evs" | |
| 1417 | apply (erule rev_mp) | |
| 1418 | apply (erule kerbV.induct) | |
| 1419 | apply (simp_all) | |
| 1420 | apply force+ | |
| 1421 | done | |
| 1422 | ||
| 1423 | lemma honest_never_says_current_timestamp_in_auth: | |
| 1424 |      "\<lbrakk> (CT evs) = T; Number T \<in> parts {X}; A \<notin> bad; evs \<in> kerbV \<rbrakk> 
 | |
| 1425 | \<Longrightarrow> Says A B \<lbrace>Y, X\<rbrace> \<notin> set evs" | |
| 1426 | apply (frule eq_imp_le) | |
| 1427 | apply (blast dest: honest_never_says_newer_timestamp_in_auth) | |
| 1428 | done | |
| 1429 | ||
| 1430 | ||
| 1431 | ||
| 1432 | lemma A_Issues_B: | |
| 1433 | "\<lbrakk> Says A B \<lbrace>ST, Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs; | |
| 1434 | Key servK \<notin> analz (spies evs); | |
| 1435 | B \<noteq> Tgs; A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1436 | \<Longrightarrow> A Issues B with (Crypt servK \<lbrace>Agent A, Number T3\<rbrace>) on evs" | |
| 1437 | apply (simp (no_asm) add: Issues_def) | |
| 1438 | apply (rule exI) | |
| 1439 | apply (rule conjI, assumption) | |
| 1440 | apply (simp (no_asm)) | |
| 1441 | apply (erule rev_mp) | |
| 1442 | apply (erule rev_mp) | |
| 1443 | apply (erule kerbV.induct, analz_mono_contra) | |
| 1444 | apply (frule_tac [7] Says_ticket_parts) | |
| 1445 | apply (frule_tac [5] Says_ticket_parts) | |
| 1446 | apply (simp_all (no_asm_simp)) | |
| 1447 | txt{*K5*}
 | |
| 1448 | apply auto | |
| 1449 | apply (simp add: takeWhile_tail) | |
| 1450 | txt{*Level 15: case study necessary because the assumption doesn't state
 | |
| 1451 | the form of servTicket. The guarantee becomes stronger.*} | |
| 1452 | prefer 2 apply (simp add: takeWhile_tail) | |
| 1453 | (**This single command of version IV... | |
| 1454 | apply (blast dest: Says_imp_spies [THEN analz.Inj, THEN analz_Decrypt'] | |
| 1455 | K3_imp_K2 K4_trustworthy' | |
| 1456 | parts_spies_takeWhile_mono [THEN subsetD] | |
| 1457 | parts_spies_evs_revD2 [THEN subsetD] | |
| 1458 | intro: Says_Auth) | |
| 1459 | ...expands as follows - including extra exE because of new form of lemmas*) | |
| 1460 | apply (frule K3_imp_K2, assumption, assumption, erule exE, erule exE) | |
| 1461 | apply (case_tac "Key authK \<in> analz (spies evs5)") | |
| 32404 | 1462 | apply (metis Says_imp_analz_Spy analz.Fst analz_Decrypt') | 
| 18886 | 1463 | apply (frule K3_imp_K2, assumption, assumption, erule exE, erule exE) | 
| 1464 | apply (drule Says_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst]) | |
| 1465 | apply (frule servK_authentic_ter, blast, assumption+) | |
| 1466 | apply (drule parts_spies_takeWhile_mono [THEN subsetD]) | |
| 1467 | apply (drule parts_spies_evs_revD2 [THEN subsetD]) | |
| 1468 | txt{* @{term Says_K5} closes the proof in version IV because it is clear which 
 | |
| 1469 | servTicket an authenticator appears with in msg 5. In version V an authenticator can appear with any item that the spy could replace the servTicket with*} | |
| 1470 | apply (frule Says_K5, blast, assumption, assumption, assumption, assumption, erule exE) | |
| 1471 | txt{*We need to state that an honest agent wouldn't send the wrong timestamp
 | |
| 1472 | within an authenticator, wathever it is paired with*} | |
| 1473 | apply (simp add: honest_never_says_current_timestamp_in_auth) | |
| 1474 | done | |
| 1475 | ||
| 1476 | lemma B_authenticates_and_keydist_to_A: | |
| 1477 | "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs); | |
| 1478 | Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> | |
| 1479 | \<in> parts (spies evs); | |
| 1480 | Key servK \<notin> analz (spies evs); | |
| 1481 | B \<noteq> Tgs; A \<notin> bad; B \<notin> bad; evs \<in> kerbV \<rbrakk> | |
| 1482 | \<Longrightarrow> A Issues B with (Crypt servK \<lbrace>Agent A, Number T3\<rbrace>) on evs" | |
| 1483 | by (blast dest: B_authenticates_A A_Issues_B) | |
| 1484 | ||
| 1485 | ||
| 1486 | ||
| 1487 | subsection{*
 | |
| 1488 | Novel guarantees, never studied before. Because honest agents always say | |
| 1489 | the right timestamp in authenticators, we can prove unicity guarantees based | |
| 1490 | exactly on timestamps. Classical unicity guarantees are based on nonces. | |
| 1491 | Of course assuming the agent to be different from the Spy, rather than not in | |
| 1492 | bad, would suffice below. Similar guarantees must also hold of | |
| 1493 | Kerberos IV.*} | |
| 1494 | ||
| 1495 | text{*Notice that an honest agent can send the same timestamp on two
 | |
| 1496 | different traces of the same length, but not on the same trace!*} | |
| 1497 | ||
| 1498 | lemma unique_timestamp_authenticator1: | |
| 1499 | "\<lbrakk> Says A Kas \<lbrace>Agent A, Agent Tgs, Number T1\<rbrace> \<in> set evs; | |
| 1500 | Says A Kas' \<lbrace>Agent A, Agent Tgs', Number T1\<rbrace> \<in> set evs; | |
| 1501 | A \<notin>bad; evs \<in> kerbV \<rbrakk> | |
| 1502 | \<Longrightarrow> Kas=Kas' \<and> Tgs=Tgs'" | |
| 1503 | apply (erule rev_mp, erule rev_mp) | |
| 1504 | apply (erule kerbV.induct) | |
| 1505 | apply (simp_all, blast) | |
| 1506 | apply auto | |
| 1507 | apply (simp_all add: honest_never_says_current_timestamp_in_auth) | |
| 1508 | done | |
| 1509 | ||
| 1510 | lemma unique_timestamp_authenticator2: | |
| 1511 | "\<lbrakk> Says A Tgs \<lbrace>AT, Crypt AK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace> \<in> set evs; | |
| 1512 | Says A Tgs' \<lbrace>AT', Crypt AK' \<lbrace>Agent A, Number T2\<rbrace>, Agent B'\<rbrace> \<in> set evs; | |
| 1513 | A \<notin>bad; evs \<in> kerbV \<rbrakk> | |
| 1514 | \<Longrightarrow> Tgs=Tgs' \<and> AT=AT' \<and> AK=AK' \<and> B=B'" | |
| 1515 | apply (erule rev_mp, erule rev_mp) | |
| 1516 | apply (erule kerbV.induct) | |
| 1517 | apply (simp_all, blast) | |
| 1518 | apply auto | |
| 1519 | apply (simp_all add: honest_never_says_current_timestamp_in_auth) | |
| 1520 | done | |
| 1521 | ||
| 1522 | lemma unique_timestamp_authenticator3: | |
| 1523 | "\<lbrakk> Says A B \<lbrace>ST, Crypt SK \<lbrace>Agent A, Number T\<rbrace>\<rbrace> \<in> set evs; | |
| 1524 | Says A B' \<lbrace>ST', Crypt SK' \<lbrace>Agent A, Number T\<rbrace>\<rbrace> \<in> set evs; | |
| 1525 | A \<notin>bad; evs \<in> kerbV \<rbrakk> | |
| 1526 | \<Longrightarrow> B=B' \<and> ST=ST' \<and> SK=SK'" | |
| 1527 | apply (erule rev_mp, erule rev_mp) | |
| 1528 | apply (erule kerbV.induct) | |
| 1529 | apply (simp_all, blast) | |
| 1530 | apply (auto simp add: honest_never_says_current_timestamp_in_auth) | |
| 1531 | done | |
| 1532 | ||
| 1533 | text{*The second part of the message is treated as an authenticator by the last
 | |
| 1534 | simplification step, even if it is not an authenticator!*} | |
| 1535 | lemma unique_timestamp_authticket: | |
| 1536 | "\<lbrakk> Says Kas A \<lbrace>X, Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key AK, T\<rbrace>\<rbrace> \<in> set evs; | |
| 1537 | Says Kas A' \<lbrace>X', Crypt (shrK Tgs') \<lbrace>Agent A', Agent Tgs', Key AK', T\<rbrace>\<rbrace> \<in> set evs; | |
| 1538 | evs \<in> kerbV \<rbrakk> | |
| 1539 | \<Longrightarrow> A=A' \<and> X=X' \<and> Tgs=Tgs' \<and> AK=AK'" | |
| 1540 | apply (erule rev_mp, erule rev_mp) | |
| 1541 | apply (erule kerbV.induct) | |
| 1542 | apply (auto simp add: honest_never_says_current_timestamp_in_auth) | |
| 1543 | done | |
| 1544 | ||
| 1545 | text{*The second part of the message is treated as an authenticator by the last
 | |
| 1546 | simplification step, even if it is not an authenticator!*} | |
| 1547 | lemma unique_timestamp_servticket: | |
| 1548 | "\<lbrakk> Says Tgs A \<lbrace>X, Crypt (shrK B) \<lbrace>Agent A, Agent B, Key SK, T\<rbrace>\<rbrace> \<in> set evs; | |
| 1549 | Says Tgs A' \<lbrace>X', Crypt (shrK B') \<lbrace>Agent A', Agent B', Key SK', T\<rbrace>\<rbrace> \<in> set evs; | |
| 1550 | evs \<in> kerbV \<rbrakk> | |
| 1551 | \<Longrightarrow> A=A' \<and> X=X' \<and> B=B' \<and> SK=SK'" | |
| 1552 | apply (erule rev_mp, erule rev_mp) | |
| 1553 | apply (erule kerbV.induct) | |
| 1554 | apply (auto simp add: honest_never_says_current_timestamp_in_auth) | |
| 1555 | done | |
| 1556 | ||
| 1557 | (*Uses assumption K6's assumption that B \<noteq> Kas, otherwise B should say | |
| 1558 | fresh timestamp*) | |
| 1559 | lemma Kas_never_says_newer_timestamp: | |
| 1560 |      "\<lbrakk> (CT evs) \<le> T; Number T \<in> parts {X}; evs \<in> kerbV \<rbrakk> 
 | |
| 1561 | \<Longrightarrow> \<forall> A. Says Kas A X \<notin> set evs" | |
| 1562 | apply (erule rev_mp) | |
| 1563 | apply (erule kerbV.induct, auto) | |
| 1564 | done | |
| 1565 | ||
| 1566 | lemma Kas_never_says_current_timestamp: | |
| 1567 |      "\<lbrakk> (CT evs) = T; Number T \<in> parts {X}; evs \<in> kerbV \<rbrakk> 
 | |
| 1568 | \<Longrightarrow> \<forall> A. Says Kas A X \<notin> set evs" | |
| 1569 | apply (frule eq_imp_le) | |
| 1570 | apply (blast dest: Kas_never_says_newer_timestamp) | |
| 1571 | done | |
| 1572 | ||
| 1573 | lemma unique_timestamp_msg2: | |
| 1574 | "\<lbrakk> Says Kas A \<lbrace>Crypt (shrK A) \<lbrace>Key AK, Agent Tgs, T\<rbrace>, AT\<rbrace> \<in> set evs; | |
| 1575 | Says Kas A' \<lbrace>Crypt (shrK A') \<lbrace>Key AK', Agent Tgs', T\<rbrace>, AT'\<rbrace> \<in> set evs; | |
| 1576 | evs \<in> kerbV \<rbrakk> | |
| 1577 | \<Longrightarrow> A=A' \<and> AK=AK' \<and> Tgs=Tgs' \<and> AT=AT'" | |
| 1578 | apply (erule rev_mp, erule rev_mp) | |
| 1579 | apply (erule kerbV.induct) | |
| 1580 | apply (auto simp add: Kas_never_says_current_timestamp) | |
| 1581 | done | |
| 1582 | ||
| 1583 | (*Uses assumption K6's assumption that B \<noteq> Tgs, otherwise B should say | |
| 1584 | fresh timestamp*) | |
| 1585 | lemma Tgs_never_says_newer_timestamp: | |
| 1586 |      "\<lbrakk> (CT evs) \<le> T; Number T \<in> parts {X}; evs \<in> kerbV \<rbrakk> 
 | |
| 1587 | \<Longrightarrow> \<forall> A. Says Tgs A X \<notin> set evs" | |
| 1588 | apply (erule rev_mp) | |
| 1589 | apply (erule kerbV.induct, auto) | |
| 1590 | done | |
| 1591 | ||
| 1592 | lemma Tgs_never_says_current_timestamp: | |
| 1593 |      "\<lbrakk> (CT evs) = T; Number T \<in> parts {X}; evs \<in> kerbV \<rbrakk> 
 | |
| 1594 | \<Longrightarrow> \<forall> A. Says Tgs A X \<notin> set evs" | |
| 1595 | apply (frule eq_imp_le) | |
| 1596 | apply (blast dest: Tgs_never_says_newer_timestamp) | |
| 1597 | done | |
| 1598 | ||
| 1599 | ||
| 1600 | lemma unique_timestamp_msg4: | |
| 1601 | "\<lbrakk> Says Tgs A \<lbrace>Crypt (shrK A) \<lbrace>Key SK, Agent B, T\<rbrace>, ST\<rbrace> \<in> set evs; | |
| 1602 | Says Tgs A' \<lbrace>Crypt (shrK A') \<lbrace>Key SK', Agent B', T\<rbrace>, ST'\<rbrace> \<in> set evs; | |
| 1603 | evs \<in> kerbV \<rbrakk> | |
| 1604 | \<Longrightarrow> A=A' \<and> SK=SK' \<and> B=B' \<and> ST=ST'" | |
| 1605 | apply (erule rev_mp, erule rev_mp) | |
| 1606 | apply (erule kerbV.induct) | |
| 1607 | apply (auto simp add: Tgs_never_says_current_timestamp) | |
| 1608 | done | |
| 1609 | ||
| 1610 | end |