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