| author | hoelzl | 
| Tue, 05 Nov 2013 09:45:00 +0100 | |
| changeset 54261 | 89991ef58448 | 
| parent 51798 | ad3a241def73 | 
| child 58889 | 5b7a9633cfa8 | 
| permissions | -rw-r--r-- | 
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32149diff
changeset | 1 | (* Author: Giampaolo Bella, Catania University | 
| 18886 | 2 | *) | 
| 3 | ||
| 4 | header{*Original Shoup-Rubin protocol*}
 | |
| 5 | ||
| 6 | theory ShoupRubin imports Smartcard begin | |
| 7 | ||
| 41774 | 8 | axiomatization sesK :: "nat*key => key" | 
| 9 | where | |
| 18886 | 10 | (*sesK is injective on each component*) | 
| 41774 | 11 | inj_sesK [iff]: "(sesK(m,k) = sesK(m',k')) = (m = m' \<and> k = k')" and | 
| 18886 | 12 | (*all long-term keys differ from sesK*) | 
| 41774 | 13 | shrK_disj_sesK [iff]: "shrK A \<noteq> sesK(m,pk)" and | 
| 14 | crdK_disj_sesK [iff]: "crdK C \<noteq> sesK(m,pk)" and | |
| 15 | pin_disj_sesK [iff]: "pin P \<noteq> sesK(m,pk)" and | |
| 16 | pairK_disj_sesK[iff]:"pairK(A,B) \<noteq> sesK(m,pk)" and | |
| 18886 | 17 | |
| 18 | (*needed for base case in analz_image_freshK*) | |
| 19 | Atomic_distrib [iff]: "Atomic`(KEY`K \<union> NONCE`N) = | |
| 41774 | 20 | Atomic`(KEY`K) \<union> Atomic`(NONCE`N)" and | 
| 18886 | 21 | |
| 22 | (*this protocol makes the assumption of secure means | |
| 23 | between each agent and his smartcard*) | |
| 24 | shouprubin_assumes_securemeans [iff]: "evs \<in> sr \<Longrightarrow> secureM" | |
| 25 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32149diff
changeset | 26 | definition Unique :: "[event, event list] => bool" ("Unique _ on _") where
 | 
| 18886 | 27 | "Unique ev on evs == | 
| 28 | ev \<notin> set (tl (dropWhile (% z. z \<noteq> ev) evs))" | |
| 29 | ||
| 30 | ||
| 23746 | 31 | inductive_set sr :: "event list set" | 
| 32 | where | |
| 18886 | 33 | |
| 34 | Nil: "[]\<in> sr" | |
| 35 | ||
| 36 | ||
| 37 | ||
| 23746 | 38 | | Fake: "\<lbrakk> evsF\<in> sr; X\<in> synth (analz (knows Spy evsF)); | 
| 18886 | 39 | illegalUse(Card B) \<rbrakk> | 
| 40 | \<Longrightarrow> Says Spy A X # | |
| 41 | Inputs Spy (Card B) X # evsF \<in> sr" | |
| 42 | ||
| 43 | (*In general this rule causes the assumption Card B \<notin> cloned | |
| 44 | in most guarantees for B - starting with confidentiality - | |
| 45 | otherwise pairK_confidential could not apply*) | |
| 23746 | 46 | | Forge: | 
| 18886 | 47 | "\<lbrakk> evsFo \<in> sr; Nonce Nb \<in> analz (knows Spy evsFo); | 
| 48 | Key (pairK(A,B)) \<in> knows Spy evsFo \<rbrakk> | |
| 49 | \<Longrightarrow> Notes Spy (Key (sesK(Nb,pairK(A,B)))) # evsFo \<in> sr" | |
| 50 | ||
| 51 | ||
| 52 | ||
| 23746 | 53 | | Reception: "\<lbrakk> evsR\<in> sr; Says A B X \<in> set evsR \<rbrakk> | 
| 18886 | 54 | \<Longrightarrow> Gets B X # evsR \<in> sr" | 
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | (*A AND THE SERVER *) | |
| 23746 | 59 | | SR1: "\<lbrakk> evs1\<in> sr; A \<noteq> Server\<rbrakk> | 
| 18886 | 60 | \<Longrightarrow> Says A Server \<lbrace>Agent A, Agent B\<rbrace> | 
| 61 | # evs1 \<in> sr" | |
| 62 | ||
| 23746 | 63 | | SR2: "\<lbrakk> evs2\<in> sr; | 
| 18886 | 64 | Gets Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs2 \<rbrakk> | 
| 65 | \<Longrightarrow> Says Server A \<lbrace>Nonce (Pairkey(A,B)), | |
| 66 | Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), Agent B\<rbrace> | |
| 67 | \<rbrace> | |
| 68 | # evs2 \<in> sr" | |
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | (*A AND HER CARD*) | |
| 74 | (*A cannot decrypt the verifier for she dosn't know shrK A, | |
| 75 | but the pairkey is recognisable*) | |
| 23746 | 76 | | SR3: "\<lbrakk> evs3\<in> sr; legalUse(Card A); | 
| 18886 | 77 | Says A Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs3; | 
| 78 | Gets A \<lbrace>Nonce Pk, Certificate\<rbrace> \<in> set evs3 \<rbrakk> | |
| 79 | \<Longrightarrow> Inputs A (Card A) (Agent A) | |
| 80 | # evs3 \<in> sr" (*however A only queries her card | |
| 81 | if she has previously contacted the server to initiate with some B. | |
| 82 | Otherwise she would do so even if the Server had not been active. | |
| 83 | Still, this doesn't and can't mean that the pairkey originated with | |
| 84 | the server*) | |
| 85 | ||
| 86 | (*The card outputs the nonce Na to A*) | |
| 23746 | 87 | | SR4: "\<lbrakk> evs4\<in> sr; A \<noteq> Server; | 
| 18886 | 88 | Nonce Na \<notin> used evs4; legalUse(Card A); | 
| 89 | Inputs A (Card A) (Agent A) \<in> set evs4 \<rbrakk> | |
| 90 | \<Longrightarrow> Outpts (Card A) A \<lbrace>Nonce Na, Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | |
| 91 | # evs4 \<in> sr" | |
| 92 | ||
| 93 | (*The card can be exploited by the spy*) | |
| 94 | (*because of the assumptions on the card, A is certainly not server nor spy*) | |
| 23746 | 95 | | SR4Fake: "\<lbrakk> evs4F\<in> sr; Nonce Na \<notin> used evs4F; | 
| 96 | illegalUse(Card A); | |
| 97 | Inputs Spy (Card A) (Agent A) \<in> set evs4F \<rbrakk> | |
| 18886 | 98 | \<Longrightarrow> Outpts (Card A) Spy \<lbrace>Nonce Na, Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | 
| 99 | # evs4F \<in> sr" | |
| 100 | ||
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | (*A TOWARDS B*) | |
| 23746 | 105 | | SR5: "\<lbrakk> evs5\<in> sr; | 
| 18886 | 106 | Outpts (Card A) A \<lbrace>Nonce Na, Certificate\<rbrace> \<in> set evs5; | 
| 107 | \<forall> p q. Certificate \<noteq> \<lbrace>p, q\<rbrace> \<rbrakk> | |
| 108 | \<Longrightarrow> Says A B \<lbrace>Agent A, Nonce Na\<rbrace> # evs5 \<in> sr" | |
| 109 | (*A must check that the verifier is not a compound message, | |
| 110 | otherwise this would also fire after SR7 *) | |
| 111 | ||
| 112 | ||
| 113 | ||
| 114 | ||
| 115 | (*B AND HIS CARD*) | |
| 23746 | 116 | | SR6: "\<lbrakk> evs6\<in> sr; legalUse(Card B); | 
| 18886 | 117 | Gets B \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs6 \<rbrakk> | 
| 118 | \<Longrightarrow> Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> | |
| 119 | # evs6 \<in> sr" | |
| 120 | ||
| 121 | (*B gets back from the card the session key and various verifiers*) | |
| 23746 | 122 | | SR7: "\<lbrakk> evs7\<in> sr; | 
| 18886 | 123 | Nonce Nb \<notin> used evs7; legalUse(Card B); B \<noteq> Server; | 
| 124 | K = sesK(Nb,pairK(A,B)); | |
| 125 | Key K \<notin> used evs7; | |
| 126 | Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs7\<rbrakk> | |
| 127 | \<Longrightarrow> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, | |
| 128 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 129 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 130 | # evs7 \<in> sr" | |
| 131 | ||
| 132 | (*The card can be exploited by the spy*) | |
| 133 | (*because of the assumptions on the card, A is certainly not server nor spy*) | |
| 23746 | 134 | | SR7Fake: "\<lbrakk> evs7F\<in> sr; Nonce Nb \<notin> used evs7F; | 
| 135 | illegalUse(Card B); | |
| 136 | K = sesK(Nb,pairK(A,B)); | |
| 137 | Key K \<notin> used evs7F; | |
| 138 | Inputs Spy (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs7F \<rbrakk> | |
| 18886 | 139 | \<Longrightarrow> Outpts (Card B) Spy \<lbrace>Nonce Nb, Key K, | 
| 140 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 141 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 142 | # evs7F \<in> sr" | |
| 143 | ||
| 144 | ||
| 145 | ||
| 146 | ||
| 147 | (*B TOWARDS A*) | |
| 148 | (*having sent an input that mentions A is the only memory B relies on, | |
| 149 | since the output doesn't mention A - lack of explicitness*) | |
| 23746 | 150 | | SR8: "\<lbrakk> evs8\<in> sr; | 
| 18886 | 151 | Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs8; | 
| 152 | Outpts (Card B) B \<lbrace>Nonce Nb, Key K, | |
| 153 | Cert1, Cert2\<rbrace> \<in> set evs8 \<rbrakk> | |
| 154 | \<Longrightarrow> Says B A \<lbrace>Nonce Nb, Cert1\<rbrace> # evs8 \<in> sr" | |
| 155 | ||
| 156 | ||
| 157 | ||
| 158 | ||
| 159 | (*A AND HER CARD*) | |
| 160 | (*A cannot check the form of the verifiers - although I can prove the form of | |
| 161 | Cert2 - and just feeds her card with what she's got*) | |
| 23746 | 162 | | SR9: "\<lbrakk> evs9\<in> sr; legalUse(Card A); | 
| 18886 | 163 | Gets A \<lbrace>Nonce Pk, Cert1\<rbrace> \<in> set evs9; | 
| 164 | Outpts (Card A) A \<lbrace>Nonce Na, Cert2\<rbrace> \<in> set evs9; | |
| 165 | Gets A \<lbrace>Nonce Nb, Cert3\<rbrace> \<in> set evs9; | |
| 166 | \<forall> p q. Cert2 \<noteq> \<lbrace>p, q\<rbrace> \<rbrakk> | |
| 167 | \<Longrightarrow> Inputs A (Card A) | |
| 168 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 169 | Cert1, Cert3, Cert2\<rbrace> | |
| 170 | # evs9 \<in> sr" | |
| 171 | ||
| 172 | (*But the card will only give outputs to the inputs of the correct form*) | |
| 23746 | 173 | | SR10: "\<lbrakk> evs10\<in> sr; legalUse(Card A); A \<noteq> Server; | 
| 18886 | 174 | K = sesK(Nb,pairK(A,B)); | 
| 175 | Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, | |
| 176 | Nonce (Pairkey(A,B)), | |
| 177 | Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), | |
| 178 | Agent B\<rbrace>, | |
| 179 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 180 | Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | |
| 181 | \<in> set evs10 \<rbrakk> | |
| 182 | \<Longrightarrow> Outpts (Card A) A \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 183 | # evs10 \<in> sr" | |
| 184 | ||
| 185 | (*The card can be exploited by the spy*) | |
| 186 | (*because of the assumptions on the card, A is certainly not server nor spy*) | |
| 23746 | 187 | | SR10Fake: "\<lbrakk> evs10F\<in> sr; | 
| 188 | illegalUse(Card A); | |
| 189 | K = sesK(Nb,pairK(A,B)); | |
| 190 | Inputs Spy (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, | |
| 191 | Nonce (Pairkey(A,B)), | |
| 192 | Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), | |
| 193 | Agent B\<rbrace>, | |
| 194 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 195 | Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | |
| 196 | \<in> set evs10F \<rbrakk> | |
| 18886 | 197 | \<Longrightarrow> Outpts (Card A) Spy \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | 
| 198 | # evs10F \<in> sr" | |
| 199 | ||
| 200 | ||
| 201 | ||
| 202 | ||
| 203 | (*A TOWARDS B*) | |
| 204 | (*having initiated with B is the only memory A relies on, | |
| 205 | since the output doesn't mention B - lack of explicitness*) | |
| 23746 | 206 | | SR11: "\<lbrakk> evs11\<in> sr; | 
| 18886 | 207 | Says A Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs11; | 
| 208 | Outpts (Card A) A \<lbrace>Key K, Certificate\<rbrace> \<in> set evs11 \<rbrakk> | |
| 209 | \<Longrightarrow> Says A B (Certificate) | |
| 210 | # evs11 \<in> sr" | |
| 211 | ||
| 212 | ||
| 213 | ||
| 214 | (*Both peers may leak by accident the session keys obtained from their | |
| 215 | cards*) | |
| 23746 | 216 | | Oops1: | 
| 18886 | 217 | "\<lbrakk> evsO1 \<in> sr; | 
| 218 | Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Certificate, | |
| 219 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evsO1 \<rbrakk> | |
| 220 | \<Longrightarrow> Notes Spy \<lbrace>Key K, Nonce Nb, Agent A, Agent B\<rbrace> # evsO1 \<in> sr" | |
| 221 | ||
| 23746 | 222 | | Oops2: | 
| 18886 | 223 | "\<lbrakk> evsO2 \<in> sr; | 
| 224 | Outpts (Card A) A \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 225 | \<in> set evsO2 \<rbrakk> | |
| 226 | \<Longrightarrow> Notes Spy \<lbrace>Key K, Nonce Nb, Agent A, Agent B\<rbrace> # evsO2 \<in> sr" | |
| 227 | ||
| 228 | ||
| 229 | ||
| 230 | ||
| 231 | ||
| 232 | ||
| 233 | (*To solve Fake case when it doesn't involve analz - used to be condensed | |
| 234 | into Fake_parts_insert_tac*) | |
| 235 | declare Fake_parts_insert_in_Un [dest] | |
| 236 | declare analz_into_parts [dest] | |
| 237 | (*declare parts_insertI [intro]*) | |
| 238 | ||
| 239 | ||
| 240 | ||
| 241 | (*General facts about message reception*) | |
| 242 | lemma Gets_imp_Says: | |
| 243 | "\<lbrakk> Gets B X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> \<exists> A. Says A B X \<in> set evs" | |
| 244 | apply (erule rev_mp, erule sr.induct) | |
| 245 | apply auto | |
| 246 | done | |
| 247 | ||
| 248 | lemma Gets_imp_knows_Spy: | |
| 249 | "\<lbrakk> Gets B X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> X \<in> knows Spy evs" | |
| 250 | apply (blast dest!: Gets_imp_Says Says_imp_knows_Spy) | |
| 251 | done | |
| 252 | ||
| 253 | lemma Gets_imp_knows_Spy_parts_Snd: | |
| 254 | "\<lbrakk> Gets B \<lbrace>X, Y\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> Y \<in> parts (knows Spy evs)" | |
| 255 | apply (blast dest!: Gets_imp_Says Says_imp_knows_Spy parts.Inj parts.Snd) | |
| 256 | done | |
| 257 | ||
| 258 | lemma Gets_imp_knows_Spy_analz_Snd: | |
| 259 | "\<lbrakk> Gets B \<lbrace>X, Y\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> Y \<in> analz (knows Spy evs)" | |
| 260 | apply (blast dest!: Gets_imp_Says Says_imp_knows_Spy analz.Inj analz.Snd) | |
| 261 | done | |
| 262 | ||
| 263 | (*end general facts*) | |
| 264 | ||
| 265 | ||
| 266 | ||
| 24122 | 267 | (*Begin lemmas on secure means, from Event.thy, proved for shouprubin. They help | 
| 18886 | 268 | the simplifier, especially in analz_image_freshK*) | 
| 269 | ||
| 270 | ||
| 271 | lemma Inputs_imp_knows_Spy_secureM_sr: | |
| 272 | "\<lbrakk> Inputs Spy C X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> X \<in> knows Spy evs" | |
| 273 | apply (simp (no_asm_simp) add: Inputs_imp_knows_Spy_secureM) | |
| 274 | done | |
| 275 | ||
| 276 | lemma knows_Spy_Inputs_secureM_sr_Spy: | |
| 277 | "evs \<in>sr \<Longrightarrow> knows Spy (Inputs Spy C X # evs) = insert X (knows Spy evs)" | |
| 278 | apply (simp (no_asm_simp)) | |
| 279 | done | |
| 280 | ||
| 281 | lemma knows_Spy_Inputs_secureM_sr: | |
| 282 | "\<lbrakk> A \<noteq> Spy; evs \<in>sr \<rbrakk> \<Longrightarrow> knows Spy (Inputs A C X # evs) = knows Spy evs" | |
| 283 | apply (simp (no_asm_simp)) | |
| 284 | done | |
| 285 | ||
| 286 | lemma knows_Spy_Outpts_secureM_sr_Spy: | |
| 287 | "evs \<in>sr \<Longrightarrow> knows Spy (Outpts C Spy X # evs) = insert X (knows Spy evs)" | |
| 288 | apply (simp (no_asm_simp)) | |
| 289 | done | |
| 290 | ||
| 291 | lemma knows_Spy_Outpts_secureM_sr: | |
| 292 | "\<lbrakk> A \<noteq> Spy; evs \<in>sr \<rbrakk> \<Longrightarrow> knows Spy (Outpts C A X # evs) = knows Spy evs" | |
| 293 | apply (simp (no_asm_simp)) | |
| 294 | done | |
| 295 | ||
| 296 | (*End lemmas on secure means for shouprubin*) | |
| 297 | ||
| 298 | ||
| 299 | ||
| 300 | ||
| 301 | (*BEGIN technical lemmas - evolution of forwarding lemmas*) | |
| 302 | ||
| 303 | (*If an honest agent uses a smart card, then the card is his/her own, is | |
| 304 | not stolen, and the agent has received suitable data to feed the card. | |
| 305 | In other words, these are guarantees that an honest agent can only use | |
| 306 | his/her own card, and must use it correctly. | |
| 307 | On the contrary, the spy can "Inputs" any cloned cards also by the Fake rule. | |
| 308 | ||
| 309 | Instead of Auto_tac, proofs here used to asm-simplify and then force-tac. | |
| 310 | *) | |
| 311 | lemma Inputs_A_Card_3: | |
| 312 | "\<lbrakk> Inputs A C (Agent A) \<in> set evs; A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 313 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 314 | (\<exists> Pk Certificate. Gets A \<lbrace>Pk, Certificate\<rbrace> \<in> set evs)" | |
| 315 | apply (erule rev_mp, erule sr.induct) | |
| 316 | apply auto | |
| 317 | done | |
| 318 | ||
| 319 | lemma Inputs_B_Card_6: | |
| 320 | "\<lbrakk> Inputs B C \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs; B \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 321 | \<Longrightarrow> legalUse(C) \<and> C = (Card B) \<and> Gets B \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs" | |
| 322 | apply (erule rev_mp, erule sr.induct) | |
| 323 | apply auto | |
| 324 | done | |
| 325 | ||
| 326 | lemma Inputs_A_Card_9: | |
| 327 | "\<lbrakk> Inputs A C \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 328 | Cert1, Cert2, Cert3\<rbrace> \<in> set evs; | |
| 329 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 330 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 331 | Gets A \<lbrace>Nonce Pk, Cert1\<rbrace> \<in> set evs \<and> | |
| 332 | Outpts (Card A) A \<lbrace>Nonce Na, Cert3\<rbrace> \<in> set evs \<and> | |
| 333 | Gets A \<lbrace>Nonce Nb, Cert2\<rbrace> \<in> set evs" | |
| 334 | apply (erule rev_mp, erule sr.induct) | |
| 335 | apply auto | |
| 336 | done | |
| 337 | ||
| 338 | ||
| 339 | (*The two occurrences of A in the Outpts event don't match SR4Fake, where | |
| 340 | A cannot be the Spy. Hence the card is legally usable by rule SR4*) | |
| 341 | lemma Outpts_A_Card_4: | |
| 342 | "\<lbrakk> Outpts C A \<lbrace>Nonce Na, (Crypt (crdK (Card A)) (Nonce Na))\<rbrace> \<in> set evs; | |
| 343 | evs \<in> sr \<rbrakk> | |
| 344 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 345 | Inputs A (Card A) (Agent A) \<in> set evs" | |
| 346 | apply (erule rev_mp, erule sr.induct) | |
| 347 | apply auto | |
| 348 | done | |
| 349 | ||
| 350 | ||
| 351 | (*First certificate is made explicit so that a comment similar to the previous | |
| 352 | applies. This also provides Na to the Inputs event in the conclusion*) | |
| 353 | lemma Outpts_B_Card_7: | |
| 354 | "\<lbrakk> Outpts C B \<lbrace>Nonce Nb, Key K, | |
| 355 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 356 | Cert2\<rbrace> \<in> set evs; | |
| 357 | evs \<in> sr \<rbrakk> | |
| 358 | \<Longrightarrow> legalUse(C) \<and> C = (Card B) \<and> | |
| 359 | Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs" | |
| 360 | apply (erule rev_mp, erule sr.induct) | |
| 361 | apply auto | |
| 362 | done | |
| 363 | ||
| 364 | lemma Outpts_A_Card_10: | |
| 365 | "\<lbrakk> Outpts C A \<lbrace>Key K, (Crypt (pairK(A,B)) (Nonce Nb))\<rbrace> \<in> set evs; | |
| 366 | evs \<in> sr \<rbrakk> | |
| 367 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 368 | (\<exists> Na Ver1 Ver2 Ver3. | |
| 369 | Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)), | |
| 370 | Ver1, Ver2, Ver3\<rbrace> \<in> set evs)" | |
| 371 | apply (erule rev_mp, erule sr.induct) | |
| 372 | apply auto | |
| 373 | done | |
| 374 | ||
| 375 | ||
| 376 | ||
| 377 | (* | |
| 378 | A can't check the form of the certificate, and so cannot associate the sesion | |
| 379 | key to the other peer! This already shows that the protocol fails to satisfy | |
| 380 | the principle of goal availability for the goal of key association. | |
| 381 | Similar reasoning below for the goal of confidentiality will be even more | |
| 382 | accessible. | |
| 383 | *) | |
| 384 | lemma Outpts_A_Card_10_imp_Inputs: | |
| 385 | "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, Certificate\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 386 | \<Longrightarrow> (\<exists> B Na Nb Ver1 Ver2 Ver3. | |
| 387 | Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)), | |
| 388 | Ver1, Ver2, Ver3\<rbrace> \<in> set evs)" | |
| 389 | apply (erule rev_mp, erule sr.induct) | |
| 390 | apply simp_all | |
| 391 | apply blast+ | |
| 392 | done | |
| 393 | ||
| 394 | ||
| 395 | ||
| 396 | ||
| 397 | (*Weaker version: if the agent can't check the forms of the verifiers, then | |
| 398 | the agent must not be the spy so as to solve SR4Fake. The verifier must be | |
| 399 | recognised as some cyphertex in order to distinguish from case SR7, | |
| 400 | concerning B's output, which also begins with a nonce. | |
| 401 | *) | |
| 402 | lemma Outpts_honest_A_Card_4: | |
| 403 | "\<lbrakk> Outpts C A \<lbrace>Nonce Na, Crypt K X\<rbrace> \<in>set evs; | |
| 404 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 405 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 406 | Inputs A (Card A) (Agent A) \<in> set evs" | |
| 407 | apply (erule rev_mp, erule sr.induct) | |
| 408 | apply auto | |
| 409 | done | |
| 410 | ||
| 411 | (*alternative formulation of same theorem | |
| 412 | Goal "\<lbrakk> Outpts C A \<lbrace>Nonce Na, Certificate\<rbrace> \<in> set evs; | |
| 413 | \<forall> p q. Certificate \<noteq> \<lbrace>p, q\<rbrace>; | |
| 414 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 415 | \<Longrightarrow> legalUse(C) \<and> C = (Card A) \<and> | |
| 416 | Inputs A (Card A) (Agent A) \<in> set evs" | |
| 417 | same proof | |
| 418 | *) | |
| 419 | ||
| 420 | ||
| 421 | lemma Outpts_honest_B_Card_7: | |
| 422 | "\<lbrakk> Outpts C B \<lbrace>Nonce Nb, Key K, Cert1, Cert2\<rbrace> \<in> set evs; | |
| 423 | B \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 424 | \<Longrightarrow> legalUse(C) \<and> C = (Card B) \<and> | |
| 425 | (\<exists> A Na. Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs)" | |
| 426 | apply (erule rev_mp, erule sr.induct) | |
| 427 | apply auto | |
| 428 | done | |
| 429 | ||
| 430 | lemma Outpts_honest_A_Card_10: | |
| 431 | "\<lbrakk> Outpts C A \<lbrace>Key K, Certificate\<rbrace> \<in> set evs; | |
| 432 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 433 | \<Longrightarrow> legalUse (C) \<and> C = (Card A) \<and> | |
| 434 | (\<exists> B Na Nb Pk Ver1 Ver2 Ver3. | |
| 435 | Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Pk, | |
| 436 | Ver1, Ver2, Ver3\<rbrace> \<in> set evs)" | |
| 437 | apply (erule rev_mp, erule sr.induct) | |
| 438 | apply simp_all | |
| 439 | apply blast+ | |
| 440 | done | |
| 441 | (*-END-*) | |
| 442 | ||
| 443 | ||
| 444 | (*Even weaker versions: if the agent can't check the forms of the verifiers | |
| 445 | and the agent may be the spy, then we must know what card the agent | |
| 446 | is getting the output from. | |
| 447 | *) | |
| 448 | lemma Outpts_which_Card_4: | |
| 449 | "\<lbrakk> Outpts (Card A) A \<lbrace>Nonce Na, Crypt K X\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 450 | \<Longrightarrow> Inputs A (Card A) (Agent A) \<in> set evs" | |
| 451 | apply (erule rev_mp, erule sr.induct) | |
| 452 | apply (simp_all (no_asm_simp)) | |
| 453 | apply clarify | |
| 454 | done | |
| 455 | ||
| 456 | lemma Outpts_which_Card_7: | |
| 457 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Cert1, Cert2\<rbrace> \<in> set evs; | |
| 458 | evs \<in> sr \<rbrakk> | |
| 459 | \<Longrightarrow> \<exists> A Na. Inputs B (Card B) \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs" | |
| 460 | apply (erule rev_mp, erule sr.induct) | |
| 461 | apply auto | |
| 462 | done | |
| 463 | ||
| 464 | lemma Outpts_which_Card_10: | |
| 465 | "\<lbrakk> Outpts (Card A) A \<lbrace>Key (sesK(Nb,pairK(A,B))), | |
| 466 | Crypt (pairK(A,B)) (Nonce Nb) \<rbrace> \<in> set evs; | |
| 467 | evs \<in> sr \<rbrakk> | |
| 468 | \<Longrightarrow> \<exists> Na. Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)), | |
| 469 | Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), Agent B\<rbrace>, | |
| 470 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 471 | Crypt (crdK (Card A)) (Nonce Na) \<rbrace> \<in> set evs" | |
| 472 | apply (erule rev_mp, erule sr.induct) | |
| 473 | apply auto | |
| 474 | done | |
| 475 | ||
| 476 | ||
| 477 | (*Lemmas on the form of outputs*) | |
| 478 | ||
| 479 | ||
| 480 | (*A needs to check that the verifier is a cipher for it to come from SR4 | |
| 481 | otherwise it could come from SR7 *) | |
| 482 | lemma Outpts_A_Card_form_4: | |
| 483 | "\<lbrakk> Outpts (Card A) A \<lbrace>Nonce Na, Certificate\<rbrace> \<in> set evs; | |
| 484 | \<forall> p q. Certificate \<noteq> \<lbrace>p, q\<rbrace>; evs \<in> sr \<rbrakk> | |
| 485 | \<Longrightarrow> Certificate = (Crypt (crdK (Card A)) (Nonce Na))" | |
| 486 | apply (erule rev_mp, erule sr.induct) | |
| 487 | apply (simp_all (no_asm_simp)) | |
| 488 | done | |
| 489 | ||
| 490 | lemma Outpts_B_Card_form_7: | |
| 491 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Cert1, Cert2\<rbrace> \<in> set evs; | |
| 492 | evs \<in> sr \<rbrakk> | |
| 493 | \<Longrightarrow> \<exists> A Na. | |
| 494 | K = sesK(Nb,pairK(A,B)) \<and> | |
| 495 | Cert1 = (Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>) \<and> | |
| 496 | Cert2 = (Crypt (pairK(A,B)) (Nonce Nb))" | |
| 497 | apply (erule rev_mp, erule sr.induct) | |
| 498 | apply auto | |
| 499 | done | |
| 500 | ||
| 501 | lemma Outpts_A_Card_form_10: | |
| 502 | "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, Certificate\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 503 | \<Longrightarrow> \<exists> B Nb. | |
| 504 | K = sesK(Nb,pairK(A,B)) \<and> | |
| 505 | Certificate = (Crypt (pairK(A,B)) (Nonce Nb))" | |
| 506 | apply (erule rev_mp, erule sr.induct) | |
| 507 | apply (simp_all (no_asm_simp)) | |
| 508 | done | |
| 509 | ||
| 510 | lemma Outpts_A_Card_form_bis: | |
| 511 | "\<lbrakk> Outpts (Card A') A' \<lbrace>Key (sesK(Nb,pairK(A,B))), Certificate\<rbrace> \<in> set evs; | |
| 512 | evs \<in> sr \<rbrakk> | |
| 513 | \<Longrightarrow> A' = A \<and> | |
| 514 | Certificate = (Crypt (pairK(A,B)) (Nonce Nb))" | |
| 515 | apply (erule rev_mp, erule sr.induct) | |
| 516 | apply (simp_all (no_asm_simp)) | |
| 517 | done | |
| 518 | ||
| 519 | (*\<dots> and Inputs *) | |
| 520 | ||
| 521 | lemma Inputs_A_Card_form_9: | |
| 522 | "\<lbrakk> Inputs A (Card A) \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 523 | Cert1, Cert2, Cert3\<rbrace> \<in> set evs; | |
| 524 | evs \<in> sr \<rbrakk> | |
| 525 | \<Longrightarrow> Cert3 = Crypt (crdK (Card A)) (Nonce Na)" | |
| 526 | apply (erule rev_mp) | |
| 527 | apply (erule sr.induct) | |
| 528 | apply (simp_all (no_asm_simp)) | |
| 529 | (*Fake*) | |
| 530 | apply force | |
| 531 | (*SR9*) | |
| 532 | apply (blast dest!: Outpts_A_Card_form_4) | |
| 533 | done | |
| 534 | (* Pk, Cert1, Cert2 cannot be made explicit because they traversed the network in the clear *) | |
| 535 | ||
| 536 | (*General guarantees on Inputs and Outpts*) | |
| 537 | ||
| 538 | (*for any agents*) | |
| 539 | ||
| 540 | ||
| 541 | lemma Inputs_Card_legalUse: | |
| 542 | "\<lbrakk> Inputs A (Card A) X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> legalUse(Card A)" | |
| 543 | apply (erule rev_mp, erule sr.induct) | |
| 544 | apply auto | |
| 545 | done | |
| 546 | ||
| 547 | lemma Outpts_Card_legalUse: | |
| 548 | "\<lbrakk> Outpts (Card A) A X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> legalUse(Card A)" | |
| 549 | apply (erule rev_mp, erule sr.induct) | |
| 550 | apply auto | |
| 551 | done | |
| 552 | ||
| 553 | (*for honest agents*) | |
| 554 | ||
| 555 | lemma Inputs_Card: "\<lbrakk> Inputs A C X \<in> set evs; A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 556 | \<Longrightarrow> C = (Card A) \<and> legalUse(C)" | |
| 557 | apply (erule rev_mp, erule sr.induct) | |
| 558 | apply auto | |
| 559 | done | |
| 560 | ||
| 561 | lemma Outpts_Card: "\<lbrakk> Outpts C A X \<in> set evs; A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 562 | \<Longrightarrow> C = (Card A) \<and> legalUse(C)" | |
| 563 | apply (erule rev_mp, erule sr.induct) | |
| 564 | apply auto | |
| 565 | done | |
| 566 | ||
| 567 | lemma Inputs_Outpts_Card: | |
| 568 | "\<lbrakk> Inputs A C X \<in> set evs \<or> Outpts C A Y \<in> set evs; | |
| 569 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 570 | \<Longrightarrow> C = (Card A) \<and> legalUse(Card A)" | |
| 571 | apply (blast dest: Inputs_Card Outpts_Card) | |
| 572 | done | |
| 573 | ||
| 574 | ||
| 575 | (*for the spy - they stress that the model behaves as it is meant to*) | |
| 576 | ||
| 577 | (*The or version can be also proved directly. | |
| 578 | It stresses that the spy may use either her own legally usable card or | |
| 579 | all the illegally usable cards. | |
| 580 | *) | |
| 581 | lemma Inputs_Card_Spy: | |
| 582 | "\<lbrakk> Inputs Spy C X \<in> set evs \<or> Outpts C Spy X \<in> set evs; evs \<in> sr \<rbrakk> | |
| 583 | \<Longrightarrow> C = (Card Spy) \<and> legalUse(Card Spy) \<or> | |
| 584 | (\<exists> A. C = (Card A) \<and> illegalUse(Card A))" | |
| 585 | apply (erule rev_mp, erule sr.induct) | |
| 586 | apply auto | |
| 587 | done | |
| 588 | ||
| 589 | ||
| 590 | (*END technical lemmas*) | |
| 591 | ||
| 592 | ||
| 593 | ||
| 594 | ||
| 595 | ||
| 596 | ||
| 597 | (*BEGIN unicity theorems: certain items uniquely identify a smart card's | |
| 598 | output*) | |
| 599 | ||
| 600 | (*A's card's first output: the nonce uniquely identifies the rest*) | |
| 601 | lemma Outpts_A_Card_unique_nonce: | |
| 602 | "\<lbrakk> Outpts (Card A) A \<lbrace>Nonce Na, Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | |
| 603 | \<in> set evs; | |
| 604 | Outpts (Card A') A' \<lbrace>Nonce Na, Crypt (crdK (Card A')) (Nonce Na)\<rbrace> | |
| 605 | \<in> set evs; | |
| 606 | evs \<in> sr \<rbrakk> \<Longrightarrow> A=A'" | |
| 607 | apply (erule rev_mp, erule rev_mp, erule sr.induct, simp_all) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 608 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 609 | apply blast | 
| 610 | done | |
| 611 | ||
| 612 | (*B's card's output: the NONCE uniquely identifies the rest*) | |
| 613 | lemma Outpts_B_Card_unique_nonce: | |
| 614 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key SK, Cert1, Cert2\<rbrace> \<in> set evs; | |
| 615 | Outpts (Card B') B' \<lbrace>Nonce Nb, Key SK', Cert1', Cert2'\<rbrace> \<in> set evs; | |
| 616 | evs \<in> sr \<rbrakk> \<Longrightarrow> B=B' \<and> SK=SK' \<and> Cert1=Cert1' \<and> Cert2=Cert2'" | |
| 617 | apply (erule rev_mp, erule rev_mp, erule sr.induct, simp_all) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 618 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 619 | apply blast | 
| 620 | done | |
| 621 | ||
| 622 | ||
| 623 | (*B's card's output: the SESKEY uniquely identifies the rest*) | |
| 624 | lemma Outpts_B_Card_unique_key: | |
| 625 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key SK, Cert1, Cert2\<rbrace> \<in> set evs; | |
| 626 | Outpts (Card B') B' \<lbrace>Nonce Nb', Key SK, Cert1', Cert2'\<rbrace> \<in> set evs; | |
| 627 | evs \<in> sr \<rbrakk> \<Longrightarrow> B=B' \<and> Nb=Nb' \<and> Cert1=Cert1' \<and> Cert2=Cert2'" | |
| 628 | apply (erule rev_mp, erule rev_mp, erule sr.induct, simp_all) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 629 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 630 | apply blast | 
| 631 | done | |
| 632 | ||
| 633 | lemma Outpts_A_Card_unique_key: "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, V\<rbrace> \<in> set evs; | |
| 634 | Outpts (Card A') A' \<lbrace>Key K, V'\<rbrace> \<in> set evs; | |
| 635 | evs \<in> sr \<rbrakk> \<Longrightarrow> A=A' \<and> V=V'" | |
| 636 | apply (erule rev_mp, erule rev_mp, erule sr.induct, simp_all) | |
| 637 | apply (blast dest: Outpts_A_Card_form_bis) | |
| 638 | apply blast | |
| 639 | done | |
| 640 | ||
| 641 | ||
| 642 | (*Revised unicity theorems - applies to both steps 4 and 7*) | |
| 643 | lemma Outpts_A_Card_Unique: | |
| 644 | "\<lbrakk> Outpts (Card A) A \<lbrace>Nonce Na, rest\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 645 | \<Longrightarrow> Unique (Outpts (Card A) A \<lbrace>Nonce Na, rest\<rbrace>) on evs" | |
| 646 | apply (erule rev_mp, erule sr.induct, simp_all add: Unique_def) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 647 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 648 | apply blast | 
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 649 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 650 | apply blast | 
| 651 | done | |
| 652 | ||
| 653 | (*can't prove the same on evs10 for it doesn't have a freshness assumption!*) | |
| 654 | ||
| 655 | ||
| 656 | (*END unicity theorems*) | |
| 657 | ||
| 658 | ||
| 659 | (*BEGIN counterguarantees about spy's knowledge*) | |
| 660 | ||
| 661 | (*on nonces*) | |
| 662 | ||
| 663 | lemma Spy_knows_Na: | |
| 664 | "\<lbrakk> Says A B \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 665 | \<Longrightarrow> Nonce Na \<in> analz (knows Spy evs)" | |
| 666 | apply (blast dest!: Says_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd]) | |
| 667 | done | |
| 668 | ||
| 669 | lemma Spy_knows_Nb: | |
| 670 | "\<lbrakk> Says B A \<lbrace>Nonce Nb, Certificate\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 671 | \<Longrightarrow> Nonce Nb \<in> analz (knows Spy evs)" | |
| 672 | apply (blast dest!: Says_imp_knows_Spy [THEN analz.Inj, THEN analz.Fst]) | |
| 673 | done | |
| 674 | ||
| 675 | ||
| 676 | (*on Pairkey*) | |
| 677 | ||
| 678 | lemma Pairkey_Gets_analz_knows_Spy: | |
| 679 | "\<lbrakk> Gets A \<lbrace>Nonce (Pairkey(A,B)), Certificate\<rbrace> \<in> set evs; evs \<in> sr \<rbrakk> | |
| 680 | \<Longrightarrow> Nonce (Pairkey(A,B)) \<in> analz (knows Spy evs)" | |
| 681 | apply (blast dest!: Gets_imp_knows_Spy [THEN analz.Inj]) | |
| 682 | done | |
| 683 | ||
| 684 | lemma Pairkey_Inputs_imp_Gets: | |
| 685 | "\<lbrakk> Inputs A (Card A) | |
| 686 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)), | |
| 687 | Cert1, Cert3, Cert2\<rbrace> \<in> set evs; | |
| 688 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 689 | \<Longrightarrow> Gets A \<lbrace>Nonce (Pairkey(A,B)), Cert1\<rbrace> \<in> set evs" | |
| 690 | apply (erule rev_mp, erule sr.induct) | |
| 691 | apply (simp_all (no_asm_simp)) | |
| 692 | apply force | |
| 693 | done | |
| 694 | ||
| 695 | lemma Pairkey_Inputs_analz_knows_Spy: | |
| 696 | "\<lbrakk> Inputs A (Card A) | |
| 697 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce (Pairkey(A,B)), | |
| 698 | Cert1, Cert3, Cert2\<rbrace> \<in> set evs; | |
| 699 | evs \<in> sr \<rbrakk> | |
| 700 | \<Longrightarrow> Nonce (Pairkey(A,B)) \<in> analz (knows Spy evs)" | |
| 701 | apply (case_tac "A = Spy") | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 702 | apply (fastforce dest!: Inputs_imp_knows_Spy_secureM [THEN analz.Inj]) | 
| 18886 | 703 | apply (blast dest!: Pairkey_Inputs_imp_Gets [THEN Pairkey_Gets_analz_knows_Spy]) | 
| 704 | done | |
| 705 | ||
| 706 | (* This fails on base case because of XOR properties. | |
| 707 | lemma Pairkey_authentic: | |
| 708 | "\<lbrakk> Nonce (Pairkey(A,B)) \<in> parts (knows Spy evs); | |
| 709 | Card A \<notin> cloned; evs \<in> sr \<rbrakk> | |
| 710 | \<Longrightarrow> \<exists> cert. Says Server A \<lbrace>Nonce (Pairkey(A,B)), Cert\<rbrace> \<in> set evs" | |
| 711 | apply (erule rev_mp) | |
| 712 | apply (erule sr.induct, simp_all) | |
| 713 | apply clarify | |
| 714 | oops | |
| 715 | ||
| 716 | 1. \<And>x a b. | |
| 717 | \<lbrakk>Card A \<notin> cloned; Pairkey (A, B) = Pairkey (a, b); Card a \<in> cloned; | |
| 718 | Card b \<in> cloned\<rbrakk> | |
| 719 | \<Longrightarrow> False | |
| 720 | *) | |
| 721 | ||
| 722 | (*END counterguarantees on spy's knowledge*) | |
| 723 | ||
| 724 | ||
| 725 | (*BEGIN rewrite rules for parts operator*) | |
| 726 | ||
| 727 | ||
| 728 | declare shrK_disj_sesK [THEN not_sym, iff] | |
| 729 | declare pin_disj_sesK [THEN not_sym, iff] | |
| 730 | declare crdK_disj_sesK [THEN not_sym, iff] | |
| 731 | declare pairK_disj_sesK [THEN not_sym, iff] | |
| 732 | ||
| 733 | ||
| 734 | ML | |
| 735 | {*
 | |
| 24122 | 736 | structure ShoupRubin = | 
| 737 | struct | |
| 18886 | 738 | |
| 739 | val prepare_tac = | |
| 24122 | 740 |  (*SR8*)   forward_tac [@{thm Outpts_B_Card_form_7}] 14 THEN
 | 
| 18886 | 741 | eresolve_tac [exE] 15 THEN eresolve_tac [exE] 15 THEN | 
| 24122 | 742 |  (*SR9*)   forward_tac [@{thm Outpts_A_Card_form_4}] 16 THEN 
 | 
| 743 |  (*SR11*)  forward_tac [@{thm Outpts_A_Card_form_10}] 21 THEN
 | |
| 18886 | 744 | eresolve_tac [exE] 22 THEN eresolve_tac [exE] 22 | 
| 745 | ||
| 23894 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
23746diff
changeset | 746 | fun parts_prepare_tac ctxt = | 
| 18886 | 747 | prepare_tac THEN | 
| 24122 | 748 |  (*SR9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 18 THEN 
 | 
| 749 |  (*SR9*)   dresolve_tac [@{thm Gets_imp_knows_Spy_parts_Snd}] 19 THEN 
 | |
| 750 |  (*Oops1*) dresolve_tac [@{thm Outpts_B_Card_form_7}] 25    THEN               
 | |
| 751 |  (*Oops2*) dresolve_tac [@{thm Outpts_A_Card_form_10}] 27 THEN                
 | |
| 42793 | 752 | (*Base*) (force_tac ctxt) 1 | 
| 18886 | 753 | |
| 51798 | 754 | fun analz_prepare_tac ctxt = | 
| 18886 | 755 | prepare_tac THEN | 
| 24122 | 756 |          dtac @{thm Gets_imp_knows_Spy_analz_Snd} 18 THEN 
 | 
| 757 |  (*SR9*) dtac @{thm Gets_imp_knows_Spy_analz_Snd} 19 THEN 
 | |
| 51798 | 758 | REPEAT_FIRST (eresolve_tac [asm_rl, conjE] ORELSE' hyp_subst_tac ctxt) | 
| 18886 | 759 | |
| 24122 | 760 | end | 
| 18886 | 761 | *} | 
| 762 | ||
| 763 | method_setup prepare = {*
 | |
| 30549 | 764 | Scan.succeed (K (SIMPLE_METHOD ShoupRubin.prepare_tac)) *} | 
| 47432 | 765 | "to launch a few simple facts that will help the simplifier" | 
| 18886 | 766 | |
| 767 | method_setup parts_prepare = {*
 | |
| 30549 | 768 | Scan.succeed (fn ctxt => SIMPLE_METHOD (ShoupRubin.parts_prepare_tac ctxt)) *} | 
| 18886 | 769 | "additional facts to reason about parts" | 
| 770 | ||
| 771 | method_setup analz_prepare = {*
 | |
| 51798 | 772 | Scan.succeed (fn ctxt => SIMPLE_METHOD (ShoupRubin.analz_prepare_tac ctxt)) *} | 
| 18886 | 773 | "additional facts to reason about analz" | 
| 774 | ||
| 775 | ||
| 776 | (*Treatment of pins is here for completeness. This protocol doesn't use pins*) | |
| 777 | lemma Spy_parts_keys [simp]: "evs \<in> sr \<Longrightarrow> | |
| 778 | (Key (shrK P) \<in> parts (knows Spy evs)) = (Card P \<in> cloned) \<and> | |
| 779 | (Key (pin P) \<in> parts (knows Spy evs)) = (P \<in> bad \<or> Card P \<in> cloned) \<and> | |
| 780 | (Key (crdK C) \<in> parts (knows Spy evs)) = (C \<in> cloned) \<and> | |
| 781 | (Key (pairK(A,B)) \<in> parts (knows Spy evs)) = (Card B \<in> cloned)" | |
| 782 | apply (erule sr.induct) | |
| 783 | apply parts_prepare | |
| 784 | apply simp_all | |
| 785 | apply (blast intro: parts_insertI) | |
| 786 | done | |
| 787 | ||
| 788 | ||
| 789 | (*END rewrite rules for parts operator*) | |
| 790 | ||
| 791 | (*BEGIN rewrite rules for analz operator*) | |
| 792 | ||
| 793 | lemma Spy_analz_shrK[simp]: "evs \<in> sr \<Longrightarrow> | |
| 794 | (Key (shrK P) \<in> analz (knows Spy evs)) = (Card P \<in> cloned)" | |
| 795 | apply (auto dest!: Spy_knows_cloned) | |
| 796 | done | |
| 797 | ||
| 798 | lemma Spy_analz_crdK[simp]: "evs \<in> sr \<Longrightarrow> | |
| 799 | (Key (crdK C) \<in> analz (knows Spy evs)) = (C \<in> cloned)" | |
| 800 | apply (auto dest!: Spy_knows_cloned) | |
| 801 | done | |
| 802 | ||
| 803 | lemma Spy_analz_pairK[simp]: "evs \<in> sr \<Longrightarrow> | |
| 804 | (Key (pairK(A,B)) \<in> analz (knows Spy evs)) = (Card B \<in> cloned)" | |
| 805 | apply (auto dest!: Spy_knows_cloned) | |
| 806 | done | |
| 807 | ||
| 808 | ||
| 809 | ||
| 810 | (*Because initState contains a set of nonces, this is needed for base case of | |
| 811 | analz_image_freshK*) | |
| 812 | lemma analz_image_Key_Un_Nonce: "analz (Key`K \<union> Nonce`N) = Key`K \<union> Nonce`N" | |
| 813 | apply auto | |
| 814 | done | |
| 815 | ||
| 816 | method_setup sc_analz_freshK = {*
 | |
| 30549 | 817 | Scan.succeed (fn ctxt => | 
| 30510 
4120fc59dd85
unified type Proof.method and pervasive METHOD combinators;
 wenzelm parents: 
24122diff
changeset | 818 | (SIMPLE_METHOD | 
| 24122 | 819 | (EVERY [REPEAT_FIRST | 
| 820 | (resolve_tac [allI, ballI, impI]), | |
| 821 |         REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
 | |
| 51717 
9e7d1c139569
simplifier uses proper Proof.context instead of historic type simpset;
 wenzelm parents: 
47432diff
changeset | 822 | ALLGOALS (asm_simp_tac (put_simpset Smartcard.analz_image_freshK_ss ctxt | 
| 24122 | 823 |           addsimps [@{thm knows_Spy_Inputs_secureM_sr_Spy},
 | 
| 824 |                     @{thm knows_Spy_Outpts_secureM_sr_Spy},
 | |
| 825 |                     @{thm shouprubin_assumes_securemeans}, 
 | |
| 826 |                     @{thm analz_image_Key_Un_Nonce}]))]))) *}
 | |
| 18886 | 827 | "for proving the Session Key Compromise theorem for smartcard protocols" | 
| 828 | ||
| 829 | ||
| 830 | lemma analz_image_freshK [rule_format]: | |
| 831 | "evs \<in> sr \<Longrightarrow> \<forall> K KK. | |
| 832 | (Key K \<in> analz (Key`KK \<union> (knows Spy evs))) = | |
| 833 | (K \<in> KK \<or> Key K \<in> analz (knows Spy evs))" | |
| 834 | apply (erule sr.induct) | |
| 835 | apply analz_prepare | |
| 836 | apply sc_analz_freshK | |
| 837 | apply spy_analz | |
| 838 | done | |
| 839 | ||
| 840 | ||
| 841 | lemma analz_insert_freshK: "evs \<in> sr \<Longrightarrow> | |
| 842 | Key K \<in> analz (insert (Key K') (knows Spy evs)) = | |
| 843 | (K = K' \<or> Key K \<in> analz (knows Spy evs))" | |
| 844 | apply (simp only: analz_image_freshK_simps analz_image_freshK) | |
| 845 | done | |
| 846 | ||
| 847 | (*END rewrite rules for analz operator*) | |
| 848 | ||
| 849 | (*BEGIN authenticity theorems*) | |
| 850 | ||
| 851 | ||
| 852 | ||
| 853 | ||
| 854 | (*Card B \<notin> cloned needed for Fake | |
| 855 | B \<notin> bad needed for SR7Fake; equivalent to Card B \<notin> stolen | |
| 856 | *) | |
| 857 | ||
| 858 | lemma Na_Nb_certificate_authentic: | |
| 859 | "\<lbrakk> Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace> \<in> parts (knows Spy evs); | |
| 860 | \<not>illegalUse(Card B); | |
| 861 | evs \<in> sr \<rbrakk> | |
| 862 | \<Longrightarrow> Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb,pairK(A,B))), | |
| 863 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 864 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 865 | apply (erule rev_mp, erule sr.induct) | |
| 866 | apply parts_prepare | |
| 867 | apply simp_all | |
| 868 | (*Fake*) | |
| 869 | apply spy_analz | |
| 870 | (*SR7F*) | |
| 871 | apply clarify | |
| 872 | done | |
| 873 | ||
| 874 | (* Card B \<notin> cloned needed for Fake and SR7F | |
| 875 | B \<noteq> Spy needed for SR7 | |
| 876 | B \<notin> bad - or Card B \<notin> stolen - needed for SR7F | |
| 877 | Card A \<notin> cloned needed for SR10F | |
| 878 | A \<notin> bad - or Card A \<notin> stolen - needed for SR10F | |
| 879 | ||
| 880 | Non-trivial case done by the simplifier.*) | |
| 881 | lemma Nb_certificate_authentic: | |
| 882 | "\<lbrakk> Crypt (pairK(A,B)) (Nonce Nb) \<in> parts (knows Spy evs); | |
| 883 | B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 884 | evs \<in> sr \<rbrakk> | |
| 885 | \<Longrightarrow> Outpts (Card A) A \<lbrace>Key (sesK(Nb,pairK(A,B))), | |
| 886 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 887 | apply (erule rev_mp, erule sr.induct) | |
| 888 | apply parts_prepare | |
| 889 | apply (case_tac [17] "Aa = Spy") | |
| 890 | apply simp_all | |
| 891 | (*Fake*) | |
| 892 | apply spy_analz | |
| 893 | (*SR7F, SR10F*) | |
| 894 | apply clarify+ | |
| 895 | done | |
| 896 | ||
| 897 | ||
| 898 | ||
| 899 | (*Discovering the very origin of the Nb certificate... non needed!*) | |
| 900 | (*lemma*) | |
| 901 | lemma Outpts_A_Card_imp_pairK_parts: | |
| 902 | "\<lbrakk> Outpts (Card A) A | |
| 903 | \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs; | |
| 904 | evs \<in> sr \<rbrakk> | |
| 905 | \<Longrightarrow> \<exists> Na. Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace> \<in> parts (knows Spy evs)" | |
| 906 | apply (erule rev_mp, erule sr.induct) | |
| 907 | apply parts_prepare | |
| 908 | apply simp_all | |
| 909 | (*Fake*) | |
| 910 | apply (blast dest: parts_insertI) | |
| 911 | (*SR7*) | |
| 912 | apply force | |
| 913 | (*SR7F*) | |
| 914 | apply force | |
| 915 | (*SR8*) | |
| 916 | apply blast | |
| 917 | (*SR10*) | |
| 918 | apply (blast dest: Inputs_imp_knows_Spy_secureM_sr parts.Inj Inputs_A_Card_9 Gets_imp_knows_Spy elim: knows_Spy_partsEs) | |
| 919 | (*SR10F*) | |
| 920 | apply (blast dest: Inputs_imp_knows_Spy_secureM_sr [THEN parts.Inj] | |
| 921 | Inputs_A_Card_9 Gets_imp_knows_Spy | |
| 922 | elim: knows_Spy_partsEs) | |
| 923 | done | |
| 924 | ||
| 925 | ||
| 926 | ||
| 927 | lemma Nb_certificate_authentic_bis: | |
| 928 | "\<lbrakk> Crypt (pairK(A,B)) (Nonce Nb) \<in> parts (knows Spy evs); | |
| 929 | B \<noteq> Spy; \<not>illegalUse(Card B); | |
| 930 | evs \<in> sr \<rbrakk> | |
| 931 | \<Longrightarrow> \<exists> Na. Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb,pairK(A,B))), | |
| 932 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 933 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 934 | apply (erule rev_mp, erule sr.induct) | |
| 935 | apply parts_prepare | |
| 936 | apply (simp_all (no_asm_simp)) | |
| 937 | (*Fake*) | |
| 938 | apply spy_analz | |
| 939 | (*SR7*) | |
| 940 | apply blast | |
| 941 | (*SR7F*) | |
| 942 | apply blast | |
| 943 | (*SR10*) | |
| 944 | apply (blast dest: Na_Nb_certificate_authentic Inputs_imp_knows_Spy_secureM_sr [THEN parts.Inj] elim: knows_Spy_partsEs) | |
| 945 | (*SR10F*) | |
| 946 | apply (blast dest: Na_Nb_certificate_authentic Inputs_imp_knows_Spy_secureM_sr [THEN parts.Inj] elim: knows_Spy_partsEs) | |
| 947 | (*SR11*) | |
| 948 | apply (blast dest: Na_Nb_certificate_authentic Outpts_A_Card_imp_pairK_parts) | |
| 949 | done | |
| 950 | ||
| 951 | ||
| 952 | lemma Pairkey_certificate_authentic: | |
| 953 | "\<lbrakk> Crypt (shrK A) \<lbrace>Nonce Pk, Agent B\<rbrace> \<in> parts (knows Spy evs); | |
| 954 | Card A \<notin> cloned; evs \<in> sr \<rbrakk> | |
| 955 | \<Longrightarrow> Pk = Pairkey(A,B) \<and> | |
| 956 | Says Server A \<lbrace>Nonce Pk, | |
| 957 | Crypt (shrK A) \<lbrace>Nonce Pk, Agent B\<rbrace>\<rbrace> | |
| 958 | \<in> set evs" | |
| 959 | apply (erule rev_mp, erule sr.induct) | |
| 960 | apply parts_prepare | |
| 961 | apply (simp_all (no_asm_simp)) | |
| 962 | (*Fake*) | |
| 963 | apply spy_analz | |
| 964 | done | |
| 965 | ||
| 966 | ||
| 967 | (*Alternatively: A \<notin> bad; Card A \<notin> cloned; B \<notin> bad; Card B \<notin> cloned;*) | |
| 968 | lemma sesK_authentic: | |
| 969 | "\<lbrakk> Key (sesK(Nb,pairK(A,B))) \<in> parts (knows Spy evs); | |
| 970 | A \<noteq> Spy; B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 971 | evs \<in> sr \<rbrakk> | |
| 972 | \<Longrightarrow> Notes Spy \<lbrace>Key (sesK(Nb,pairK(A,B))), Nonce Nb, Agent A, Agent B\<rbrace> | |
| 973 | \<in> set evs" | |
| 974 | apply (erule rev_mp, erule sr.induct) | |
| 975 | apply parts_prepare | |
| 976 | apply (simp_all (no_asm_simp)) | |
| 977 | (*fake*) | |
| 978 | apply spy_analz | |
| 979 | (*forge*) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 980 | apply (fastforce dest: analz.Inj) | 
| 18886 | 981 | (*SR7: used B\<noteq>Spy*) | 
| 982 | (*SR7F*) | |
| 983 | apply clarify | |
| 984 | (*SR10: used A\<noteq>Spy*) | |
| 985 | (*SR10F*) | |
| 986 | apply clarify | |
| 987 | (*Oops*) | |
| 988 | apply simp_all | |
| 989 | done | |
| 990 | ||
| 991 | ||
| 992 | (*END authenticity theorems*) | |
| 993 | ||
| 994 | ||
| 995 | (*BEGIN confidentiality theorems*) | |
| 996 | ||
| 997 | (*If B were bad and his card stolen, they spy could use B's card but would | |
| 998 | not obtain this K because B's card only issues new session keys out | |
| 999 | of new nonces. | |
| 1000 | If A were bad, then her card could be stolen, hence the spy could feed it | |
| 1001 | with Nb and get this K. Thus, A\<notin>bad can be replaced by Card A \<notin> stolen | |
| 1002 | Hence these are the minimal assumptions: | |
| 1003 | A \<notin> bad; B \<noteq> Spy; Card A \<notin> cloned; Card B \<notin> cloned; | |
| 1004 | A \<noteq> Spy; B \<noteq> Spy; \<not>illegalUse(Card A); Card B \<notin> cloned; | |
| 1005 | *) | |
| 1006 | ||
| 1007 | lemma Confidentiality: | |
| 1008 | "\<lbrakk> Notes Spy \<lbrace>Key (sesK(Nb,pairK(A,B))), Nonce Nb, Agent A, Agent B\<rbrace> | |
| 1009 | \<notin> set evs; | |
| 1010 | A \<noteq> Spy; B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 1011 | evs \<in> sr \<rbrakk> | |
| 1012 | \<Longrightarrow> Key (sesK(Nb,pairK(A,B))) \<notin> analz (knows Spy evs)" | |
| 1013 | apply (blast intro: sesK_authentic) | |
| 1014 | done | |
| 1015 | ||
| 1016 | lemma Confidentiality_B: | |
| 1017 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Certificate, | |
| 1018 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs; | |
| 1019 | Notes Spy \<lbrace>Key K, Nonce Nb, Agent A, Agent B\<rbrace> \<notin> set evs; | |
| 1020 | A \<noteq> Spy; B \<noteq> Spy; \<not>illegalUse(Card A); Card B \<notin> cloned; | |
| 1021 | evs \<in> sr \<rbrakk> | |
| 1022 | \<Longrightarrow> Key K \<notin> analz (knows Spy evs)" | |
| 1023 | apply (erule rev_mp, erule rev_mp, erule sr.induct) | |
| 1024 | apply analz_prepare | |
| 1025 | apply (simp_all add: analz_insert_eq analz_insert_freshK pushes split_ifs) | |
| 1026 | (*Fake*) | |
| 1027 | apply spy_analz | |
| 1028 | (*Forge*) | |
| 1029 | apply (rotate_tac 7) | |
| 1030 | apply (drule parts.Inj) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 1031 | apply (fastforce dest: Outpts_B_Card_form_7) | 
| 18886 | 1032 | (*SR7*) | 
| 1033 | apply (blast dest!: Outpts_B_Card_form_7) | |
| 1034 | (*SR7F*) | |
| 1035 | apply clarify | |
| 1036 | apply (drule Outpts_parts_used) | |
| 1037 | apply simp | |
| 1038 | (*faster than | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 1039 | apply (fastforce dest: Outpts_parts_used) | 
| 18886 | 1040 | *) | 
| 1041 | (*SR10*) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 1042 | apply (fastforce dest: Outpts_B_Card_form_7) | 
| 18886 | 1043 | (*SR10F - uses assumption Card A not cloned*) | 
| 1044 | apply clarify | |
| 1045 | apply (drule Outpts_B_Card_form_7, assumption) | |
| 1046 | apply simp | |
| 1047 | (*Oops1*) | |
| 1048 | apply (blast dest!: Outpts_B_Card_form_7) | |
| 1049 | (*Oops2*) | |
| 1050 | apply (blast dest!: Outpts_B_Card_form_7 Outpts_A_Card_form_10) | |
| 1051 | done | |
| 1052 | ||
| 1053 | (*Confidentiality_A can be is faster to prove in forward style, using | |
| 1054 | the authentication theorems. So it is moved below*) | |
| 1055 | ||
| 1056 | ||
| 1057 | (*END confidentiality theorems*) | |
| 1058 | ||
| 1059 | ||
| 1060 | ||
| 1061 | (*BEGIN authentication theorems*) | |
| 1062 | ||
| 1063 | lemma A_authenticates_B: | |
| 1064 | "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs; | |
| 1065 | \<not>illegalUse(Card B); | |
| 1066 | evs \<in> sr \<rbrakk> | |
| 1067 | \<Longrightarrow> \<exists> Na. | |
| 1068 | Outpts (Card B) B \<lbrace>Nonce Nb, Key K, | |
| 1069 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1070 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 1071 | apply (blast dest: Na_Nb_certificate_authentic Outpts_A_Card_form_10 Outpts_A_Card_imp_pairK_parts) | |
| 1072 | done | |
| 1073 | ||
| 1074 | lemma A_authenticates_B_Gets: | |
| 1075 | "\<lbrakk> Gets A \<lbrace>Nonce Nb, Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>\<rbrace> | |
| 1076 | \<in> set evs; | |
| 1077 | \<not>illegalUse(Card B); | |
| 1078 | evs \<in> sr \<rbrakk> | |
| 1079 | \<Longrightarrow> Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb, pairK (A, B))), | |
| 1080 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1081 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 1082 | apply (blast dest: Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd, THEN Na_Nb_certificate_authentic]) | |
| 1083 | done | |
| 1084 | ||
| 1085 | ||
| 1086 | ||
| 1087 | ||
| 1088 | lemma B_authenticates_A: | |
| 1089 | "\<lbrakk> Gets B (Crypt (pairK(A,B)) (Nonce Nb)) \<in> set evs; | |
| 1090 | B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 1091 | evs \<in> sr \<rbrakk> | |
| 1092 | \<Longrightarrow> Outpts (Card A) A | |
| 1093 | \<lbrace>Key (sesK(Nb,pairK(A,B))), Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 1094 | apply (erule rev_mp) | |
| 1095 | apply (erule sr.induct) | |
| 1096 | apply (simp_all (no_asm_simp)) | |
| 1097 | apply (blast dest: Says_imp_knows_Spy [THEN parts.Inj] Nb_certificate_authentic) | |
| 1098 | done | |
| 1099 | ||
| 1100 | ||
| 1101 | (*END authentication theorems*) | |
| 1102 | ||
| 1103 | lemma Confidentiality_A: "\<lbrakk> Outpts (Card A) A | |
| 1104 | \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs; | |
| 1105 | Notes Spy \<lbrace>Key K, Nonce Nb, Agent A, Agent B\<rbrace> \<notin> set evs; | |
| 1106 | A \<noteq> Spy; B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 1107 | evs \<in> sr \<rbrakk> | |
| 1108 | \<Longrightarrow> Key K \<notin> analz (knows Spy evs)" | |
| 1109 | apply (drule A_authenticates_B) | |
| 1110 | prefer 3 | |
| 1111 | apply (erule exE) | |
| 1112 | apply (drule Confidentiality_B) | |
| 1113 | apply auto | |
| 1114 | done | |
| 1115 | ||
| 1116 | lemma Outpts_imp_knows_agents_secureM_sr: | |
| 1117 | "\<lbrakk> Outpts (Card A) A X \<in> set evs; evs \<in> sr \<rbrakk> \<Longrightarrow> X \<in> knows A evs" | |
| 1118 | apply (simp (no_asm_simp) add: Outpts_imp_knows_agents_secureM) | |
| 1119 | done | |
| 1120 | ||
| 1121 | ||
| 1122 | (*BEGIN key distribution theorems*) | |
| 1123 | ||
| 1124 | ||
| 1125 | (*Alternatively: B \<notin> bad; Card B \<notin> cloned;*) | |
| 1126 | lemma A_keydist_to_B: | |
| 1127 | "\<lbrakk> Outpts (Card A) A | |
| 1128 | \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs; | |
| 1129 | \<not>illegalUse(Card B); | |
| 1130 | evs \<in> sr \<rbrakk> | |
| 1131 | \<Longrightarrow> Key K \<in> analz (knows B evs)" | |
| 1132 | apply (drule A_authenticates_B) | |
| 1133 | prefer 3 | |
| 1134 | apply (erule exE) | |
| 1135 | apply (rule Outpts_imp_knows_agents_secureM_sr [THEN analz.Inj, THEN analz.Snd, THEN analz.Fst]) | |
| 1136 | apply assumption+ | |
| 1137 | done | |
| 1138 | ||
| 1139 | ||
| 1140 | (*Alternatively: A \<notin> bad; B \<notin> bad; Card A \<notin> cloned; Card B \<notin> cloned;*) | |
| 1141 | lemma B_keydist_to_A: | |
| 1142 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Certificate, | |
| 1143 | (Crypt (pairK(A,B)) (Nonce Nb))\<rbrace> \<in> set evs; | |
| 1144 | Gets B (Crypt (pairK(A,B)) (Nonce Nb)) \<in> set evs; | |
| 1145 | B \<noteq> Spy; \<not>illegalUse(Card A); \<not>illegalUse(Card B); | |
| 1146 | evs \<in> sr \<rbrakk> | |
| 1147 | \<Longrightarrow> Key K \<in> analz (knows A evs)" | |
| 1148 | apply (frule B_authenticates_A) | |
| 1149 | apply (drule_tac [5] Outpts_B_Card_form_7) | |
| 1150 | apply (rule_tac [6] Outpts_imp_knows_agents_secureM_sr [THEN analz.Inj, THEN analz.Fst]) | |
| 1151 | prefer 6 apply force | |
| 1152 | apply assumption+ | |
| 1153 | done | |
| 1154 | ||
| 1155 | (*END key distribution theorems*) | |
| 1156 | ||
| 1157 | ||
| 1158 | ||
| 1159 | ||
| 1160 | ||
| 1161 | ||
| 1162 | ||
| 1163 | ||
| 1164 | (*BEGIN further theorems about authenticity of verifiers | |
| 1165 | (useful to agents and cards). *) | |
| 1166 | ||
| 1167 | (*MSG11 | |
| 1168 | If B receives the verifier of msg11, then the verifier originated with msg7. | |
| 1169 | Alternatively: A \<notin> bad; B \<notin> bad; Card A \<notin> cloned; Card B \<notin> cloned; | |
| 1170 | *) | |
| 1171 | lemma Nb_certificate_authentic_B: | |
| 1172 | "\<lbrakk> Gets B (Crypt (pairK(A,B)) (Nonce Nb)) \<in> set evs; | |
| 1173 | B \<noteq> Spy; \<not>illegalUse(Card B); | |
| 1174 | evs \<in> sr \<rbrakk> | |
| 1175 | \<Longrightarrow> \<exists> Na. | |
| 1176 | Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb,pairK(A,B))), | |
| 1177 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1178 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> \<in> set evs" | |
| 1179 | apply (blast dest: Gets_imp_knows_Spy [THEN parts.Inj, THEN Nb_certificate_authentic_bis]) | |
| 1180 | done | |
| 1181 | (*Useless to B: B can't check the form of the verifier because he doesn't know | |
| 1182 | pairK(A,B) *) | |
| 1183 | ||
| 1184 | (*MSG10 | |
| 1185 | If A obtains the verifier of msg10, then the verifier originated with msg7: | |
| 1186 | A_authenticates_B. It is useful to A, who can check the form of the | |
| 1187 | verifier by application of Outpts_A_Card_form_10. | |
| 1188 | *) | |
| 1189 | ||
| 1190 | (*MSG9 | |
| 1191 | The first verifier verifies the Pairkey to the card: since it's encrypted | |
| 1192 | under Ka, it must come from the server (if A's card is not cloned). | |
| 1193 | The second verifier verifies both nonces, since it's encrypted under the | |
| 1194 | pairK, it must originate with B's card (if A and B's cards not cloned). | |
| 1195 | The third verifier verifies Na: since it's encrytped under the card's key, | |
| 1196 | it originated with the card; so the card does not need to save Na | |
| 1197 | in the first place and do a comparison now: it just verifies Na through the | |
| 1198 | verifier. Three theorems related to these three statements. | |
| 1199 | ||
| 1200 | Recall that a card can check the form of the verifiers (can decrypt them), | |
| 1201 | while an agent in general cannot, if not provided with a suitable theorem. | |
| 1202 | *) | |
| 1203 | ||
| 1204 | (*Card A can't reckon the pairkey - we need to guarantee its integrity!*) | |
| 1205 | lemma Pairkey_certificate_authentic_A_Card: | |
| 1206 | "\<lbrakk> Inputs A (Card A) | |
| 1207 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 1208 | Crypt (shrK A) \<lbrace>Nonce Pk, Agent B\<rbrace>, | |
| 1209 | Cert2, Cert3\<rbrace> \<in> set evs; | |
| 1210 | A \<noteq> Spy; Card A \<notin> cloned; evs \<in> sr \<rbrakk> | |
| 1211 | \<Longrightarrow> Pk = Pairkey(A,B) \<and> | |
| 1212 | Says Server A \<lbrace>Nonce (Pairkey(A,B)), | |
| 1213 | Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), Agent B\<rbrace>\<rbrace> | |
| 1214 | \<in> set evs " | |
| 1215 | apply (blast dest: Inputs_A_Card_9 Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd] Pairkey_certificate_authentic) | |
| 1216 | done | |
| 1217 | (*the second conjunct of the thesis might be regarded as a form of integrity | |
| 1218 | in the sense of Neuman-Ts'o*) | |
| 1219 | ||
| 1220 | lemma Na_Nb_certificate_authentic_A_Card: | |
| 1221 | "\<lbrakk> Inputs A (Card A) | |
| 1222 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 1223 | Cert1, | |
| 1224 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, Cert3\<rbrace> \<in> set evs; | |
| 1225 | A \<noteq> Spy; \<not>illegalUse(Card B); evs \<in> sr \<rbrakk> | |
| 1226 | \<Longrightarrow> Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb, pairK (A, B))), | |
| 1227 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1228 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 1229 | \<in> set evs " | |
| 1230 | apply (blast dest: Inputs_A_Card_9 Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd, THEN Na_Nb_certificate_authentic]) | |
| 1231 | done | |
| 1232 | ||
| 1233 | lemma Na_authentic_A_Card: | |
| 1234 | "\<lbrakk> Inputs A (Card A) | |
| 1235 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 1236 | Cert1, Cert2, Cert3\<rbrace> \<in> set evs; | |
| 1237 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1238 | \<Longrightarrow> Outpts (Card A) A \<lbrace>Nonce Na, Cert3\<rbrace> | |
| 1239 | \<in> set evs" | |
| 1240 | apply (blast dest: Inputs_A_Card_9) | |
| 1241 | done | |
| 1242 | ||
| 1243 | (* The last three theorems for Card A can be put togheter trivially. | |
| 1244 | They are separated to highlight the different requirements on agents | |
| 1245 | and their cards.*) | |
| 1246 | ||
| 1247 | ||
| 1248 | (*Alternatively: | |
| 1249 | A \<noteq> Spy; B \<notin> bad; Card A \<notin> cloned; Card B \<notin> cloned; evs \<in> sr \<rbrakk> *) | |
| 1250 | lemma Inputs_A_Card_9_authentic: | |
| 1251 | "\<lbrakk> Inputs A (Card A) | |
| 1252 | \<lbrace>Agent B, Nonce Na, Nonce Nb, Nonce Pk, | |
| 1253 | Crypt (shrK A) \<lbrace>Nonce Pk, Agent B\<rbrace>, | |
| 1254 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, Cert3\<rbrace> \<in> set evs; | |
| 1255 | A \<noteq> Spy; Card A \<notin> cloned;\<not>illegalUse(Card B); evs \<in> sr \<rbrakk> | |
| 1256 | \<Longrightarrow> Says Server A \<lbrace>Nonce Pk, Crypt (shrK A) \<lbrace>Nonce Pk, Agent B\<rbrace>\<rbrace> | |
| 1257 | \<in> set evs \<and> | |
| 1258 | Outpts (Card B) B \<lbrace>Nonce Nb, Key (sesK(Nb, pairK (A, B))), | |
| 1259 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1260 | Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 1261 | \<in> set evs \<and> | |
| 1262 | Outpts (Card A) A \<lbrace>Nonce Na, Cert3\<rbrace> | |
| 1263 | \<in> set evs" | |
| 1264 | apply (blast dest: Inputs_A_Card_9 Na_Nb_certificate_authentic Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd] Pairkey_certificate_authentic) | |
| 1265 | done | |
| 1266 | ||
| 1267 | (*MSG8 | |
| 1268 | Nothing to prove because the message is a cleartext that comes from the | |
| 1269 | network*) | |
| 1270 | ||
| 1271 | (*Other messages: nothing to prove because the verifiers involved are new*) | |
| 1272 | ||
| 1273 | ||
| 1274 | (*END further theorems about authenticity of verifiers*) | |
| 1275 | ||
| 1276 | ||
| 1277 | ||
| 1278 | (* BEGIN trivial guarantees on outputs for agents *) | |
| 1279 | ||
| 1280 | (*MSG4*) | |
| 1281 | lemma SR4_imp: | |
| 1282 | "\<lbrakk> Outpts (Card A) A \<lbrace>Nonce Na, Crypt (crdK (Card A)) (Nonce Na)\<rbrace> | |
| 1283 | \<in> set evs; | |
| 1284 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1285 | \<Longrightarrow> \<exists> Pk V. Gets A \<lbrace>Pk, V\<rbrace> \<in> set evs" | |
| 1286 | apply (blast dest: Outpts_A_Card_4 Inputs_A_Card_3) | |
| 1287 | done | |
| 1288 | (*weak: could strengthen the model adding verifier for the Pairkey to msg3*) | |
| 1289 | ||
| 1290 | ||
| 1291 | (*MSG7*) | |
| 1292 | lemma SR7_imp: | |
| 1293 | "\<lbrakk> Outpts (Card B) B \<lbrace>Nonce Nb, Key K, | |
| 1294 | Crypt (pairK(A,B)) \<lbrace>Nonce Na, Nonce Nb\<rbrace>, | |
| 1295 | Cert2\<rbrace> \<in> set evs; | |
| 1296 | B \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1297 | \<Longrightarrow> Gets B \<lbrace>Agent A, Nonce Na\<rbrace> \<in> set evs" | |
| 1298 | apply (blast dest: Outpts_B_Card_7 Inputs_B_Card_6) | |
| 1299 | done | |
| 1300 | ||
| 1301 | (*MSG10*) | |
| 1302 | lemma SR10_imp: | |
| 1303 | "\<lbrakk> Outpts (Card A) A \<lbrace>Key K, Crypt (pairK(A,B)) (Nonce Nb)\<rbrace> | |
| 1304 | \<in> set evs; | |
| 1305 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1306 | \<Longrightarrow> \<exists> Cert1 Cert2. | |
| 1307 | Gets A \<lbrace>Nonce (Pairkey (A, B)), Cert1\<rbrace> \<in> set evs \<and> | |
| 1308 | Gets A \<lbrace>Nonce Nb, Cert2\<rbrace> \<in> set evs" | |
| 1309 | apply (blast dest: Outpts_A_Card_10 Inputs_A_Card_9) | |
| 1310 | done | |
| 1311 | ||
| 1312 | ||
| 1313 | (*END trivial guarantees on outputs for agents*) | |
| 1314 | ||
| 1315 | ||
| 1316 | ||
| 1317 | (*INTEGRITY*) | |
| 1318 | lemma Outpts_Server_not_evs: "evs \<in> sr \<Longrightarrow> Outpts (Card Server) P X \<notin> set evs" | |
| 1319 | apply (erule sr.induct) | |
| 1320 | apply auto | |
| 1321 | done | |
| 1322 | ||
| 1323 | text{*@{term step2_integrity} also is a reliability theorem*}
 | |
| 1324 | lemma Says_Server_message_form: | |
| 1325 | "\<lbrakk> Says Server A \<lbrace>Pk, Certificate\<rbrace> \<in> set evs; | |
| 1326 | evs \<in> sr \<rbrakk> | |
| 1327 | \<Longrightarrow> \<exists> B. Pk = Nonce (Pairkey(A,B)) \<and> | |
| 1328 | Certificate = Crypt (shrK A) \<lbrace>Nonce (Pairkey(A,B)), Agent B\<rbrace>" | |
| 1329 | apply (erule rev_mp) | |
| 1330 | apply (erule sr.induct) | |
| 1331 | apply auto | |
| 1332 | apply (blast dest!: Outpts_Server_not_evs)+ | |
| 1333 | done | |
| 1334 | (*cannot be made useful to A in form of a Gets event*) | |
| 1335 | ||
| 1336 | text{*
 | |
| 1337 |   step4integrity is @{term Outpts_A_Card_form_4}
 | |
| 1338 | ||
| 1339 |   step7integrity is @{term Outpts_B_Card_form_7}
 | |
| 1340 | *} | |
| 1341 | ||
| 1342 | lemma step8_integrity: | |
| 1343 | "\<lbrakk> Says B A \<lbrace>Nonce Nb, Certificate\<rbrace> \<in> set evs; | |
| 1344 | B \<noteq> Server; B \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1345 | \<Longrightarrow> \<exists> Cert2 K. | |
| 1346 | Outpts (Card B) B \<lbrace>Nonce Nb, Key K, Certificate, Cert2\<rbrace> \<in> set evs" | |
| 1347 | apply (erule rev_mp) | |
| 1348 | apply (erule sr.induct) | |
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
42793diff
changeset | 1349 | prefer 18 apply (fastforce dest: Outpts_A_Card_form_10) | 
| 18886 | 1350 | apply auto | 
| 1351 | done | |
| 1352 | ||
| 1353 | ||
| 1354 | text{*  step9integrity is @{term Inputs_A_Card_form_9}
 | |
| 1355 | ||
| 1356 |         step10integrity is @{term Outpts_A_Card_form_10}.
 | |
| 1357 | *} | |
| 1358 | ||
| 1359 | lemma step11_integrity: | |
| 1360 | "\<lbrakk> Says A B (Certificate) \<in> set evs; | |
| 1361 | \<forall> p q. Certificate \<noteq> \<lbrace>p, q\<rbrace>; | |
| 1362 | A \<noteq> Spy; evs \<in> sr \<rbrakk> | |
| 1363 | \<Longrightarrow> \<exists> K. | |
| 1364 | Outpts (Card A) A \<lbrace>Key K, Certificate\<rbrace> \<in> set evs" | |
| 1365 | apply (erule rev_mp) | |
| 1366 | apply (erule sr.induct) | |
| 1367 | apply auto | |
| 1368 | done | |
| 1369 | ||
| 1370 | end |