| author | haftmann | 
| Thu, 25 Nov 2010 15:40:15 +0100 | |
| changeset 40705 | 03f1266a066e | 
| parent 35418 | 83b0f75810f0 | 
| child 41775 | 6214816d79d3 | 
| permissions | -rw-r--r-- | 
| 13508 | 1 | (****************************************************************************** | 
| 2 | from G. Karjoth, N. Asokan and C. Gulcu | |
| 3 | "Protecting the computation results of free-roaming agents" | |
| 4 | Mobiles Agents 1998, LNCS 1477 | |
| 5 | ||
| 6 | date: march 2002 | |
| 7 | author: Frederic Blanqui | |
| 8 | email: blanqui@lri.fr | |
| 9 | webpage: http://www.lri.fr/~blanqui/ | |
| 10 | ||
| 11 | University of Cambridge, Computer Laboratory | |
| 12 | William Gates Building, JJ Thomson Avenue | |
| 13 | Cambridge CB3 0FD, United Kingdom | |
| 14 | ******************************************************************************) | |
| 15 | ||
| 16 | header{*Protocol P2*}
 | |
| 17 | ||
| 16417 | 18 | theory P2 imports Guard_Public List_Msg begin | 
| 13508 | 19 | |
| 20 | subsection{*Protocol Definition*}
 | |
| 21 | ||
| 22 | ||
| 23 | text{*Like P1 except the definitions of @{text chain}, @{text shop},
 | |
| 24 |   @{text next_shop} and @{text nonce}*}
 | |
| 25 | ||
| 26 | subsubsection{*offer chaining:
 | |
| 27 | B chains his offer for A with the head offer of L for sending it to C*} | |
| 28 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 29 | definition chain :: "agent => nat => agent => msg => agent => msg" where | 
| 13508 | 30 | "chain B ofr A L C == | 
| 31 | let m1= sign B (Nonce ofr) in | |
| 32 | let m2= Hash {|head L, Agent C|} in
 | |
| 33 | {|Crypt (pubK A) m1, m2|}"
 | |
| 34 | ||
| 35 | declare Let_def [simp] | |
| 36 | ||
| 37 | lemma chain_inj [iff]: "(chain B ofr A L C = chain B' ofr' A' L' C') | |
| 38 | = (B=B' & ofr=ofr' & A=A' & head L = head L' & C=C')" | |
| 39 | by (auto simp: chain_def Let_def) | |
| 40 | ||
| 41 | lemma Nonce_in_chain [iff]: "Nonce ofr:parts {chain B ofr A L C}"
 | |
| 42 | by (auto simp: chain_def sign_def) | |
| 43 | ||
| 44 | subsubsection{*agent whose key is used to sign an offer*}
 | |
| 45 | ||
| 35418 | 46 | fun shop :: "msg => msg" where | 
| 13508 | 47 | "shop {|Crypt K {|B,ofr,Crypt K' H|},m2|} = Agent (agt K')"
 | 
| 48 | ||
| 49 | lemma shop_chain [simp]: "shop (chain B ofr A L C) = Agent B" | |
| 50 | by (simp add: chain_def sign_def) | |
| 51 | ||
| 52 | subsubsection{*nonce used in an offer*}
 | |
| 53 | ||
| 35418 | 54 | fun nonce :: "msg => msg" where | 
| 13508 | 55 | "nonce {|Crypt K {|B,ofr,CryptH|},m2|} = ofr"
 | 
| 56 | ||
| 57 | lemma nonce_chain [simp]: "nonce (chain B ofr A L C) = Nonce ofr" | |
| 58 | by (simp add: chain_def sign_def) | |
| 59 | ||
| 60 | subsubsection{*next shop*}
 | |
| 61 | ||
| 35418 | 62 | fun next_shop :: "msg => agent" where | 
| 13508 | 63 | "next_shop {|m1,Hash {|headL,Agent C|}|} = C"
 | 
| 64 | ||
| 65 | lemma "next_shop (chain B ofr A L C) = C" | |
| 66 | by (simp add: chain_def sign_def) | |
| 67 | ||
| 68 | subsubsection{*anchor of the offer list*}
 | |
| 69 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 70 | definition anchor :: "agent => nat => agent => msg" where | 
| 13508 | 71 | "anchor A n B == chain A n A (cons nil nil) B" | 
| 72 | ||
| 73 | lemma anchor_inj [iff]: | |
| 74 | "(anchor A n B = anchor A' n' B') = (A=A' & n=n' & B=B')" | |
| 75 | by (auto simp: anchor_def) | |
| 76 | ||
| 77 | lemma Nonce_in_anchor [iff]: "Nonce n:parts {anchor A n B}"
 | |
| 78 | by (auto simp: anchor_def) | |
| 79 | ||
| 80 | lemma shop_anchor [simp]: "shop (anchor A n B) = Agent A" | |
| 81 | by (simp add: anchor_def) | |
| 82 | ||
| 83 | subsubsection{*request event*}
 | |
| 84 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 85 | definition reqm :: "agent => nat => nat => msg => agent => msg" where | 
| 13508 | 86 | "reqm A r n I B == {|Agent A, Number r, cons (Agent A) (cons (Agent B) I),
 | 
| 87 | cons (anchor A n B) nil|}" | |
| 88 | ||
| 89 | lemma reqm_inj [iff]: "(reqm A r n I B = reqm A' r' n' I' B') | |
| 90 | = (A=A' & r=r' & n=n' & I=I' & B=B')" | |
| 91 | by (auto simp: reqm_def) | |
| 92 | ||
| 93 | lemma Nonce_in_reqm [iff]: "Nonce n:parts {reqm A r n I B}"
 | |
| 94 | by (auto simp: reqm_def) | |
| 95 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 96 | definition req :: "agent => nat => nat => msg => agent => event" where | 
| 13508 | 97 | "req A r n I B == Says A B (reqm A r n I B)" | 
| 98 | ||
| 99 | lemma req_inj [iff]: "(req A r n I B = req A' r' n' I' B') | |
| 100 | = (A=A' & r=r' & n=n' & I=I' & B=B')" | |
| 101 | by (auto simp: req_def) | |
| 102 | ||
| 103 | subsubsection{*propose event*}
 | |
| 104 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 105 | definition prom :: "agent => nat => agent => nat => msg => msg => | 
| 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 106 | msg => agent => msg" where | 
| 13508 | 107 | "prom B ofr A r I L J C == {|Agent A, Number r,
 | 
| 108 | app (J, del (Agent B, I)), cons (chain B ofr A L C) L|}" | |
| 109 | ||
| 110 | lemma prom_inj [dest]: "prom B ofr A r I L J C = prom B' ofr' A' r' I' L' J' C' | |
| 111 | ==> B=B' & ofr=ofr' & A=A' & r=r' & L=L' & C=C'" | |
| 112 | by (auto simp: prom_def) | |
| 113 | ||
| 114 | lemma Nonce_in_prom [iff]: "Nonce ofr:parts {prom B ofr A r I L J C}"
 | |
| 115 | by (auto simp: prom_def) | |
| 116 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 117 | definition pro :: "agent => nat => agent => nat => msg => msg => | 
| 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
23746diff
changeset | 118 | msg => agent => event" where | 
| 13508 | 119 | "pro B ofr A r I L J C == Says B C (prom B ofr A r I L J C)" | 
| 120 | ||
| 121 | lemma pro_inj [dest]: "pro B ofr A r I L J C = pro B' ofr' A' r' I' L' J' C' | |
| 122 | ==> B=B' & ofr=ofr' & A=A' & r=r' & L=L' & C=C'" | |
| 123 | by (auto simp: pro_def dest: prom_inj) | |
| 124 | ||
| 125 | subsubsection{*protocol*}
 | |
| 126 | ||
| 23746 | 127 | inductive_set p2 :: "event list set" | 
| 128 | where | |
| 13508 | 129 | |
| 23746 | 130 | Nil: "[]:p2" | 
| 13508 | 131 | |
| 23746 | 132 | | Fake: "[| evsf:p2; X:synth (analz (spies evsf)) |] ==> Says Spy B X # evsf : p2" | 
| 13508 | 133 | |
| 23746 | 134 | | Request: "[| evsr:p2; Nonce n ~:used evsr; I:agl |] ==> req A r n I B # evsr : p2" | 
| 13508 | 135 | |
| 23746 | 136 | | Propose: "[| evsp:p2; Says A' B {|Agent A,Number r,I,cons M L|}:set evsp;
 | 
| 137 | I:agl; J:agl; isin (Agent C, app (J, del (Agent B, I))); | |
| 138 | Nonce ofr ~:used evsp |] ==> pro B ofr A r I (cons M L) J C # evsp : p2" | |
| 13508 | 139 | |
| 140 | subsubsection{*valid offer lists*}
 | |
| 141 | ||
| 23746 | 142 | inductive_set | 
| 143 | valid :: "agent => nat => agent => msg set" | |
| 144 | for A :: agent and n :: nat and B :: agent | |
| 145 | where | |
| 146 | Request [intro]: "cons (anchor A n B) nil:valid A n B" | |
| 13508 | 147 | |
| 23746 | 148 | | Propose [intro]: "L:valid A n B | 
| 149 | ==> cons (chain (next_shop (head L)) ofr A L C) L:valid A n B" | |
| 13508 | 150 | |
| 151 | subsubsection{*basic properties of valid*}
 | |
| 152 | ||
| 153 | lemma valid_not_empty: "L:valid A n B ==> EX M L'. L = cons M L'" | |
| 154 | by (erule valid.cases, auto) | |
| 155 | ||
| 156 | lemma valid_pos_len: "L:valid A n B ==> 0 < len L" | |
| 157 | by (erule valid.induct, auto) | |
| 158 | ||
| 159 | subsubsection{*list of offers*}
 | |
| 160 | ||
| 35418 | 161 | fun offers :: "msg => msg" | 
| 162 | where | |
| 163 |   "offers (cons M L) = cons {|shop M, nonce M|} (offers L)"
 | |
| 164 | | "offers other = nil" | |
| 13508 | 165 | |
| 166 | ||
| 167 | subsection{*Properties of Protocol P2*}
 | |
| 168 | ||
| 169 | text{*same as @{text P1_Prop} except that publicly verifiable forward
 | |
| 170 | integrity is replaced by forward privacy*} | |
| 171 | ||
| 172 | subsection{*strong forward integrity:
 | |
| 173 | except the last one, no offer can be modified*} | |
| 174 | ||
| 175 | lemma strong_forward_integrity: "ALL L. Suc i < len L | |
| 176 | --> L:valid A n B --> repl (L,Suc i,M):valid A n B --> M = ith (L,Suc i)" | |
| 177 | apply (induct i) | |
| 178 | (* i = 0 *) | |
| 179 | apply clarify | |
| 180 | apply (frule len_not_empty, clarsimp) | |
| 181 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 182 | apply (ind_cases "{|x,xa,l'a|}:valid A n B" for x xa l'a)
 | 
| 183 | apply (ind_cases "{|x,M,l'a|}:valid A n B" for x l'a)
 | |
| 13508 | 184 | apply (simp add: chain_def) | 
| 185 | (* i > 0 *) | |
| 186 | apply clarify | |
| 187 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 188 | apply (ind_cases "{|x,repl(l',Suc na,M)|}:valid A n B" for x l' na)
 | 
| 13508 | 189 | apply (frule len_not_empty, clarsimp) | 
| 23746 | 190 | apply (ind_cases "{|x,l'|}:valid A n B" for x l')
 | 
| 13508 | 191 | by (drule_tac x=l' in spec, simp, blast) | 
| 192 | ||
| 193 | subsection{*insertion resilience:
 | |
| 194 | except at the beginning, no offer can be inserted*} | |
| 195 | ||
| 196 | lemma chain_isnt_head [simp]: "L:valid A n B ==> | |
| 197 | head L ~= chain (next_shop (head L)) ofr A L C" | |
| 198 | by (erule valid.induct, auto simp: chain_def sign_def anchor_def) | |
| 199 | ||
| 200 | lemma insertion_resilience: "ALL L. L:valid A n B --> Suc i < len L | |
| 201 | --> ins (L,Suc i,M) ~:valid A n B" | |
| 202 | apply (induct i) | |
| 203 | (* i = 0 *) | |
| 204 | apply clarify | |
| 205 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 206 | apply (ind_cases "{|x,l'|}:valid A n B" for x l', simp)
 | 
| 207 | apply (ind_cases "{|x,M,l'|}:valid A n B" for x l', clarsimp)
 | |
| 208 | apply (ind_cases "{|head l',l'|}:valid A n B" for l', simp, simp)
 | |
| 13508 | 209 | (* i > 0 *) | 
| 210 | apply clarify | |
| 211 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 212 | apply (ind_cases "{|x,l'|}:valid A n B" for x l')
 | 
| 13508 | 213 | apply (frule len_not_empty, clarsimp) | 
| 23746 | 214 | apply (ind_cases "{|x,ins(l',Suc na,M)|}:valid A n B" for x l' na)
 | 
| 13508 | 215 | apply (frule len_not_empty, clarsimp) | 
| 216 | by (drule_tac x=l' in spec, clarsimp) | |
| 217 | ||
| 218 | subsection{*truncation resilience:
 | |
| 219 | only shop i can truncate at offer i*} | |
| 220 | ||
| 221 | lemma truncation_resilience: "ALL L. L:valid A n B --> Suc i < len L | |
| 222 | --> cons M (trunc (L,Suc i)):valid A n B --> shop M = shop (ith (L,i))" | |
| 223 | apply (induct i) | |
| 224 | (* i = 0 *) | |
| 225 | apply clarify | |
| 226 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 227 | apply (ind_cases "{|x,l'|}:valid A n B" for x l')
 | 
| 13508 | 228 | apply (frule len_not_empty, clarsimp) | 
| 23746 | 229 | apply (ind_cases "{|M,l'|}:valid A n B" for l')
 | 
| 13508 | 230 | apply (frule len_not_empty, clarsimp, simp) | 
| 231 | (* i > 0 *) | |
| 232 | apply clarify | |
| 233 | apply (frule len_not_empty, clarsimp) | |
| 23746 | 234 | apply (ind_cases "{|x,l'|}:valid A n B" for x l')
 | 
| 13508 | 235 | apply (frule len_not_empty, clarsimp) | 
| 236 | by (drule_tac x=l' in spec, clarsimp) | |
| 237 | ||
| 238 | subsection{*declarations for tactics*}
 | |
| 239 | ||
| 240 | declare knows_Spy_partsEs [elim] | |
| 241 | declare Fake_parts_insert [THEN subsetD, dest] | |
| 242 | declare initState.simps [simp del] | |
| 243 | ||
| 244 | subsection{*get components of a message*}
 | |
| 245 | ||
| 246 | lemma get_ML [dest]: "Says A' B {|A,R,I,M,L|}:set evs ==>
 | |
| 247 | M:parts (spies evs) & L:parts (spies evs)" | |
| 248 | by blast | |
| 249 | ||
| 250 | subsection{*general properties of p2*}
 | |
| 251 | ||
| 252 | lemma reqm_neq_prom [iff]: | |
| 253 | "reqm A r n I B ~= prom B' ofr A' r' I' (cons M L) J C" | |
| 254 | by (auto simp: reqm_def prom_def) | |
| 255 | ||
| 256 | lemma prom_neq_reqm [iff]: | |
| 257 | "prom B' ofr A' r' I' (cons M L) J C ~= reqm A r n I B" | |
| 258 | by (auto simp: reqm_def prom_def) | |
| 259 | ||
| 260 | lemma req_neq_pro [iff]: "req A r n I B ~= pro B' ofr A' r' I' (cons M L) J C" | |
| 261 | by (auto simp: req_def pro_def) | |
| 262 | ||
| 263 | lemma pro_neq_req [iff]: "pro B' ofr A' r' I' (cons M L) J C ~= req A r n I B" | |
| 264 | by (auto simp: req_def pro_def) | |
| 265 | ||
| 266 | lemma p2_has_no_Gets: "evs:p2 ==> ALL A X. Gets A X ~:set evs" | |
| 267 | by (erule p2.induct, auto simp: req_def pro_def) | |
| 268 | ||
| 269 | lemma p2_is_Gets_correct [iff]: "Gets_correct p2" | |
| 270 | by (auto simp: Gets_correct_def dest: p2_has_no_Gets) | |
| 271 | ||
| 272 | lemma p2_is_one_step [iff]: "one_step p2" | |
| 23746 | 273 | by (unfold one_step_def, clarify, ind_cases "ev#evs:p2" for ev evs, auto) | 
| 13508 | 274 | |
| 275 | lemma p2_has_only_Says' [rule_format]: "evs:p2 ==> | |
| 276 | ev:set evs --> (EX A B X. ev=Says A B X)" | |
| 277 | by (erule p2.induct, auto simp: req_def pro_def) | |
| 278 | ||
| 279 | lemma p2_has_only_Says [iff]: "has_only_Says p2" | |
| 280 | by (auto simp: has_only_Says_def dest: p2_has_only_Says') | |
| 281 | ||
| 282 | lemma p2_is_regular [iff]: "regular p2" | |
| 283 | apply (simp only: regular_def, clarify) | |
| 284 | apply (erule_tac p2.induct) | |
| 285 | apply (simp_all add: initState.simps knows.simps pro_def prom_def | |
| 286 | req_def reqm_def anchor_def chain_def sign_def) | |
| 287 | by (auto dest: no_Key_in_agl no_Key_in_appdel parts_trans) | |
| 288 | ||
| 289 | subsection{*private keys are safe*}
 | |
| 290 | ||
| 291 | lemma priK_parts_Friend_imp_bad [rule_format,dest]: | |
| 292 | "[| evs:p2; Friend B ~= A |] | |
| 293 | ==> (Key (priK A):parts (knows (Friend B) evs)) --> (A:bad)" | |
| 294 | apply (erule p2.induct) | |
| 295 | apply (simp_all add: initState.simps knows.simps pro_def prom_def | |
| 17778 | 296 | req_def reqm_def anchor_def chain_def sign_def) | 
| 13508 | 297 | apply (blast dest: no_Key_in_agl) | 
| 298 | apply (auto del: parts_invKey disjE dest: parts_trans | |
| 299 | simp add: no_Key_in_appdel) | |
| 300 | done | |
| 301 | ||
| 302 | lemma priK_analz_Friend_imp_bad [rule_format,dest]: | |
| 303 | "[| evs:p2; Friend B ~= A |] | |
| 304 | ==> (Key (priK A):analz (knows (Friend B) evs)) --> (A:bad)" | |
| 305 | by auto | |
| 306 | ||
| 307 | lemma priK_notin_knows_max_Friend: | |
| 308 | "[| evs:p2; A ~:bad; A ~= Friend C |] | |
| 309 | ==> Key (priK A) ~:analz (knows_max (Friend C) evs)" | |
| 310 | apply (rule not_parts_not_analz, simp add: knows_max_def, safe) | |
| 311 | apply (drule_tac H="spies' evs" in parts_sub) | |
| 312 | apply (rule_tac p=p2 in knows_max'_sub_spies', simp+) | |
| 313 | apply (drule_tac H="spies evs" in parts_sub) | |
| 314 | by (auto dest: knows'_sub_knows [THEN subsetD] priK_notin_initState_Friend) | |
| 315 | ||
| 316 | subsection{*general guardedness properties*}
 | |
| 317 | ||
| 318 | lemma agl_guard [intro]: "I:agl ==> I:guard n Ks" | |
| 319 | by (erule agl.induct, auto) | |
| 320 | ||
| 321 | lemma Says_to_knows_max'_guard: "[| Says A' C {|A'',r,I,L|}:set evs;
 | |
| 322 | Guard n Ks (knows_max' C evs) |] ==> L:guard n Ks" | |
| 323 | by (auto dest: Says_to_knows_max') | |
| 324 | ||
| 325 | lemma Says_from_knows_max'_guard: "[| Says C A' {|A'',r,I,L|}:set evs;
 | |
| 326 | Guard n Ks (knows_max' C evs) |] ==> L:guard n Ks" | |
| 327 | by (auto dest: Says_from_knows_max') | |
| 328 | ||
| 329 | lemma Says_Nonce_not_used_guard: "[| Says A' B {|A'',r,I,L|}:set evs;
 | |
| 330 | Nonce n ~:used evs |] ==> L:guard n Ks" | |
| 331 | by (drule not_used_not_parts, auto) | |
| 332 | ||
| 333 | subsection{*guardedness of messages*}
 | |
| 334 | ||
| 335 | lemma chain_guard [iff]: "chain B ofr A L C:guard n {priK A}"
 | |
| 336 | by (case_tac "ofr=n", auto simp: chain_def sign_def) | |
| 337 | ||
| 338 | lemma chain_guard_Nonce_neq [intro]: "n ~= ofr | |
| 339 | ==> chain B ofr A' L C:guard n {priK A}"
 | |
| 340 | by (auto simp: chain_def sign_def) | |
| 341 | ||
| 342 | lemma anchor_guard [iff]: "anchor A n' B:guard n {priK A}"
 | |
| 343 | by (case_tac "n'=n", auto simp: anchor_def) | |
| 344 | ||
| 345 | lemma anchor_guard_Nonce_neq [intro]: "n ~= n' | |
| 346 | ==> anchor A' n' B:guard n {priK A}"
 | |
| 347 | by (auto simp: anchor_def) | |
| 348 | ||
| 349 | lemma reqm_guard [intro]: "I:agl ==> reqm A r n' I B:guard n {priK A}"
 | |
| 350 | by (case_tac "n'=n", auto simp: reqm_def) | |
| 351 | ||
| 352 | lemma reqm_guard_Nonce_neq [intro]: "[| n ~= n'; I:agl |] | |
| 353 | ==> reqm A' r n' I B:guard n {priK A}"
 | |
| 354 | by (auto simp: reqm_def) | |
| 355 | ||
| 356 | lemma prom_guard [intro]: "[| I:agl; J:agl; L:guard n {priK A} |]
 | |
| 357 | ==> prom B ofr A r I L J C:guard n {priK A}"
 | |
| 358 | by (auto simp: prom_def) | |
| 359 | ||
| 360 | lemma prom_guard_Nonce_neq [intro]: "[| n ~= ofr; I:agl; J:agl; | |
| 361 | L:guard n {priK A} |] ==> prom B ofr A' r I L J C:guard n {priK A}"
 | |
| 362 | by (auto simp: prom_def) | |
| 363 | ||
| 364 | subsection{*Nonce uniqueness*}
 | |
| 365 | ||
| 366 | lemma uniq_Nonce_in_chain [dest]: "Nonce k:parts {chain B ofr A L C} ==> k=ofr"
 | |
| 367 | by (auto simp: chain_def sign_def) | |
| 368 | ||
| 369 | lemma uniq_Nonce_in_anchor [dest]: "Nonce k:parts {anchor A n B} ==> k=n"
 | |
| 370 | by (auto simp: anchor_def chain_def sign_def) | |
| 371 | ||
| 372 | lemma uniq_Nonce_in_reqm [dest]: "[| Nonce k:parts {reqm A r n I B};
 | |
| 373 | I:agl |] ==> k=n" | |
| 374 | by (auto simp: reqm_def dest: no_Nonce_in_agl) | |
| 375 | ||
| 376 | lemma uniq_Nonce_in_prom [dest]: "[| Nonce k:parts {prom B ofr A r I L J C};
 | |
| 377 | I:agl; J:agl; Nonce k ~:parts {L} |] ==> k=ofr"
 | |
| 378 | by (auto simp: prom_def dest: no_Nonce_in_agl no_Nonce_in_appdel) | |
| 379 | ||
| 380 | subsection{*requests are guarded*}
 | |
| 381 | ||
| 382 | lemma req_imp_Guard [rule_format]: "[| evs:p2; A ~:bad |] ==> | |
| 383 | req A r n I B:set evs --> Guard n {priK A} (spies evs)"
 | |
| 384 | apply (erule p2.induct, simp) | |
| 385 | apply (simp add: req_def knows.simps, safe) | |
| 386 | apply (erule in_synth_Guard, erule Guard_analz, simp) | |
| 387 | by (auto simp: req_def pro_def dest: Says_imp_knows_Spy) | |
| 388 | ||
| 389 | lemma req_imp_Guard_Friend: "[| evs:p2; A ~:bad; req A r n I B:set evs |] | |
| 390 | ==> Guard n {priK A} (knows_max (Friend C) evs)"
 | |
| 391 | apply (rule Guard_knows_max') | |
| 392 | apply (rule_tac H="spies evs" in Guard_mono) | |
| 393 | apply (rule req_imp_Guard, simp+) | |
| 394 | apply (rule_tac B="spies' evs" in subset_trans) | |
| 395 | apply (rule_tac p=p2 in knows_max'_sub_spies', simp+) | |
| 396 | by (rule knows'_sub_knows) | |
| 397 | ||
| 398 | subsection{*propositions are guarded*}
 | |
| 399 | ||
| 400 | lemma pro_imp_Guard [rule_format]: "[| evs:p2; B ~:bad; A ~:bad |] ==> | |
| 401 | pro B ofr A r I (cons M L) J C:set evs --> Guard ofr {priK A} (spies evs)"
 | |
| 402 | apply (erule p2.induct) (* +3 subgoals *) | |
| 403 | (* Nil *) | |
| 404 | apply simp | |
| 405 | (* Fake *) | |
| 406 | apply (simp add: pro_def, safe) (* +4 subgoals *) | |
| 407 | (* 1 *) | |
| 408 | apply (erule in_synth_Guard, drule Guard_analz, simp, simp) | |
| 409 | (* 2 *) | |
| 410 | apply simp | |
| 411 | (* 3 *) | |
| 412 | apply (simp, simp add: req_def pro_def, blast) | |
| 413 | (* 4 *) | |
| 414 | apply (simp add: pro_def) | |
| 415 | apply (blast dest: prom_inj Says_Nonce_not_used_guard Nonce_not_used_Guard) | |
| 416 | (* 5 *) | |
| 417 | apply simp | |
| 418 | apply safe (* +1 subgoal *) | |
| 419 | apply (simp add: pro_def) | |
| 420 | apply (blast dest: prom_inj Says_Nonce_not_used_guard) | |
| 421 | (* 6 *) | |
| 422 | apply (simp add: pro_def) | |
| 423 | apply (blast dest: Says_imp_knows_Spy) | |
| 424 | (* Request *) | |
| 425 | apply (simp add: pro_def) | |
| 426 | apply (blast dest: prom_inj Says_Nonce_not_used_guard Nonce_not_used_Guard) | |
| 427 | (* Propose *) | |
| 428 | apply simp | |
| 429 | apply safe (* +1 subgoal *) | |
| 430 | (* 1 *) | |
| 431 | apply (simp add: pro_def) | |
| 432 | apply (blast dest: prom_inj Says_Nonce_not_used_guard) | |
| 433 | (* 2 *) | |
| 434 | apply (simp add: pro_def) | |
| 435 | by (blast dest: Says_imp_knows_Spy) | |
| 436 | ||
| 437 | lemma pro_imp_Guard_Friend: "[| evs:p2; B ~:bad; A ~:bad; | |
| 438 | pro B ofr A r I (cons M L) J C:set evs |] | |
| 439 | ==> Guard ofr {priK A} (knows_max (Friend D) evs)"
 | |
| 440 | apply (rule Guard_knows_max') | |
| 441 | apply (rule_tac H="spies evs" in Guard_mono) | |
| 442 | apply (rule pro_imp_Guard, simp+) | |
| 443 | apply (rule_tac B="spies' evs" in subset_trans) | |
| 444 | apply (rule_tac p=p2 in knows_max'_sub_spies', simp+) | |
| 445 | by (rule knows'_sub_knows) | |
| 446 | ||
| 447 | subsection{*data confidentiality:
 | |
| 448 | no one other than the originator can decrypt the offers*} | |
| 449 | ||
| 450 | lemma Nonce_req_notin_spies: "[| evs:p2; req A r n I B:set evs; A ~:bad |] | |
| 451 | ==> Nonce n ~:analz (spies evs)" | |
| 452 | by (frule req_imp_Guard, simp+, erule Guard_Nonce_analz, simp+) | |
| 453 | ||
| 454 | lemma Nonce_req_notin_knows_max_Friend: "[| evs:p2; req A r n I B:set evs; | |
| 455 | A ~:bad; A ~= Friend C |] ==> Nonce n ~:analz (knows_max (Friend C) evs)" | |
| 456 | apply (clarify, frule_tac C=C in req_imp_Guard_Friend, simp+) | |
| 457 | apply (simp add: knows_max_def, drule Guard_invKey_keyset, simp+) | |
| 458 | by (drule priK_notin_knows_max_Friend, auto simp: knows_max_def) | |
| 459 | ||
| 460 | lemma Nonce_pro_notin_spies: "[| evs:p2; B ~:bad; A ~:bad; | |
| 461 | pro B ofr A r I (cons M L) J C:set evs |] ==> Nonce ofr ~:analz (spies evs)" | |
| 462 | by (frule pro_imp_Guard, simp+, erule Guard_Nonce_analz, simp+) | |
| 463 | ||
| 464 | lemma Nonce_pro_notin_knows_max_Friend: "[| evs:p2; B ~:bad; A ~:bad; | |
| 465 | A ~= Friend D; pro B ofr A r I (cons M L) J C:set evs |] | |
| 466 | ==> Nonce ofr ~:analz (knows_max (Friend D) evs)" | |
| 467 | apply (clarify, frule_tac A=A in pro_imp_Guard_Friend, simp+) | |
| 468 | apply (simp add: knows_max_def, drule Guard_invKey_keyset, simp+) | |
| 469 | by (drule priK_notin_knows_max_Friend, auto simp: knows_max_def) | |
| 470 | ||
| 471 | subsection{*forward privacy:
 | |
| 472 | only the originator can know the identity of the shops*} | |
| 473 | ||
| 474 | lemma forward_privacy_Spy: "[| evs:p2; B ~:bad; A ~:bad; | |
| 475 | pro B ofr A r I (cons M L) J C:set evs |] | |
| 476 | ==> sign B (Nonce ofr) ~:analz (spies evs)" | |
| 477 | by (auto simp:sign_def dest: Nonce_pro_notin_spies) | |
| 478 | ||
| 479 | lemma forward_privacy_Friend: "[| evs:p2; B ~:bad; A ~:bad; A ~= Friend D; | |
| 480 | pro B ofr A r I (cons M L) J C:set evs |] | |
| 481 | ==> sign B (Nonce ofr) ~:analz (knows_max (Friend D) evs)" | |
| 482 | by (auto simp:sign_def dest:Nonce_pro_notin_knows_max_Friend ) | |
| 483 | ||
| 484 | subsection{*non repudiability: an offer signed by B has been sent by B*}
 | |
| 485 | ||
| 486 | lemma Crypt_reqm: "[| Crypt (priK A) X:parts {reqm A' r n I B}; I:agl |] ==> A=A'"
 | |
| 487 | by (auto simp: reqm_def anchor_def chain_def sign_def dest: no_Crypt_in_agl) | |
| 488 | ||
| 489 | lemma Crypt_prom: "[| Crypt (priK A) X:parts {prom B ofr A' r I L J C};
 | |
| 490 | I:agl; J:agl |] ==> A=B | Crypt (priK A) X:parts {L}"
 | |
| 491 | apply (simp add: prom_def anchor_def chain_def sign_def) | |
| 492 | by (blast dest: no_Crypt_in_agl no_Crypt_in_appdel) | |
| 493 | ||
| 494 | lemma Crypt_safeness: "[| evs:p2; A ~:bad |] ==> Crypt (priK A) X:parts (spies evs) | |
| 495 | --> (EX B Y. Says A B Y:set evs & Crypt (priK A) X:parts {Y})"
 | |
| 496 | apply (erule p2.induct) | |
| 497 | (* Nil *) | |
| 498 | apply simp | |
| 499 | (* Fake *) | |
| 500 | apply clarsimp | |
| 501 | apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp) | |
| 502 | apply (erule disjE) | |
| 503 | apply (drule_tac K="priK A" in Crypt_synth, simp+, blast, blast) | |
| 504 | (* Request *) | |
| 505 | apply (simp add: req_def, clarify) | |
| 506 | apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp) | |
| 507 | apply (erule disjE) | |
| 508 | apply (frule Crypt_reqm, simp, clarify) | |
| 509 | apply (rule_tac x=B in exI, rule_tac x="reqm A r n I B" in exI, simp, blast) | |
| 510 | (* Propose *) | |
| 511 | apply (simp add: pro_def, clarify) | |
| 512 | apply (drule_tac P="%G. Crypt (priK A) X:G" in parts_insert_substD, simp) | |
| 513 | apply (rotate_tac -1, erule disjE) | |
| 514 | apply (frule Crypt_prom, simp, simp) | |
| 515 | apply (rotate_tac -1, erule disjE) | |
| 516 | apply (rule_tac x=C in exI) | |
| 517 | apply (rule_tac x="prom B ofr Aa r I (cons M L) J C" in exI, blast) | |
| 518 | apply (subgoal_tac "cons M L:parts (spies evsp)") | |
| 519 | apply (drule_tac G="{cons M L}" and H="spies evsp" in parts_trans, blast, blast)
 | |
| 520 | apply (drule Says_imp_spies, rotate_tac -1, drule parts.Inj) | |
| 521 | apply (drule parts.Snd, drule parts.Snd, drule parts.Snd) | |
| 522 | by auto | |
| 523 | ||
| 524 | lemma Crypt_Hash_imp_sign: "[| evs:p2; A ~:bad |] ==> | |
| 525 | Crypt (priK A) (Hash X):parts (spies evs) | |
| 526 | --> (EX B Y. Says A B Y:set evs & sign A X:parts {Y})"
 | |
| 527 | apply (erule p2.induct) | |
| 528 | (* Nil *) | |
| 529 | apply simp | |
| 530 | (* Fake *) | |
| 531 | apply clarsimp | |
| 532 | apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD) | |
| 533 | apply simp | |
| 534 | apply (erule disjE) | |
| 535 | apply (drule_tac K="priK A" in Crypt_synth, simp+, blast, blast) | |
| 536 | (* Request *) | |
| 537 | apply (simp add: req_def, clarify) | |
| 538 | apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD) | |
| 539 | apply simp | |
| 540 | apply (erule disjE) | |
| 541 | apply (frule Crypt_reqm, simp+) | |
| 542 | apply (rule_tac x=B in exI, rule_tac x="reqm Aa r n I B" in exI) | |
| 543 | apply (simp add: reqm_def sign_def anchor_def no_Crypt_in_agl) | |
| 544 | apply (simp add: chain_def sign_def, blast) | |
| 545 | (* Propose *) | |
| 546 | apply (simp add: pro_def, clarify) | |
| 547 | apply (drule_tac P="%G. Crypt (priK A) (Hash X):G" in parts_insert_substD) | |
| 548 | apply simp | |
| 549 | apply (rotate_tac -1, erule disjE) | |
| 550 | apply (simp add: prom_def sign_def no_Crypt_in_agl no_Crypt_in_appdel) | |
| 551 | apply (simp add: chain_def sign_def) | |
| 552 | apply (rotate_tac -1, erule disjE) | |
| 553 | apply (rule_tac x=C in exI) | |
| 554 | apply (rule_tac x="prom B ofr Aa r I (cons M L) J C" in exI) | |
| 555 | apply (simp add: prom_def chain_def sign_def) | |
| 556 | apply (erule impE) | |
| 557 | apply (blast dest: get_ML parts_sub) | |
| 558 | apply (blast del: MPair_parts)+ | |
| 559 | done | |
| 560 | ||
| 561 | lemma sign_safeness: "[| evs:p2; A ~:bad |] ==> sign A X:parts (spies evs) | |
| 562 | --> (EX B Y. Says A B Y:set evs & sign A X:parts {Y})"
 | |
| 563 | apply (clarify, simp add: sign_def, frule parts.Snd) | |
| 564 | apply (blast dest: Crypt_Hash_imp_sign [unfolded sign_def]) | |
| 565 | done | |
| 566 | ||
| 567 | end |