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