| author | haftmann | 
| Tue, 07 Nov 2006 14:02:08 +0100 | |
| changeset 21213 | c81f016883df | 
| parent 18570 | ffce25f9aa7f | 
| child 23746 | a455e69c31cc | 
| permissions | -rw-r--r-- | 
| 1995 | 1 | (* Title: HOL/Auth/Yahalom | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 2 | ID: $Id$ | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 4 | Copyright 1996 University of Cambridge | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 5 | *) | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 6 | |
| 13956 | 7 | header{*The Yahalom Protocol*}
 | 
| 8 | ||
| 16417 | 9 | theory Yahalom imports Public begin | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 10 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 11 | text{*From page 257 of
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 12 | Burrows, Abadi and Needham (1989). A Logic of Authentication. | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 13 | Proc. Royal Soc. 426 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 14 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 15 | This theory has the prototypical example of a secrecy relation, KeyCryptNonce. | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 16 | *} | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 17 | |
| 11251 | 18 | consts yahalom :: "event list set" | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3481diff
changeset | 19 | inductive "yahalom" | 
| 11251 | 20 | intros | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 21 | (*Initial trace is empty*) | 
| 11251 | 22 | Nil: "[] \<in> yahalom" | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 23 | |
| 2032 | 24 | (*The spy MAY say anything he CAN say. We do not expect him to | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 25 | invent new nonces here, but he can also use NS1. Common to | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 26 | all similar protocols.*) | 
| 11251 | 27 | Fake: "[| evsf \<in> yahalom; X \<in> synth (analz (knows Spy evsf)) |] | 
| 28 | ==> Says Spy B X # evsf \<in> yahalom" | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 29 | |
| 6335 | 30 | (*A message that has been sent can be received by the | 
| 31 | intended recipient.*) | |
| 11251 | 32 | Reception: "[| evsr \<in> yahalom; Says A B X \<in> set evsr |] | 
| 33 | ==> Gets B X # evsr \<in> yahalom" | |
| 6335 | 34 | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 35 | (*Alice initiates a protocol run*) | 
| 11251 | 36 | YM1: "[| evs1 \<in> yahalom; Nonce NA \<notin> used evs1 |] | 
| 37 |           ==> Says A B {|Agent A, Nonce NA|} # evs1 \<in> yahalom"
 | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 38 | |
| 6335 | 39 | (*Bob's response to Alice's message.*) | 
| 11251 | 40 | YM2: "[| evs2 \<in> yahalom; Nonce NB \<notin> used evs2; | 
| 41 |              Gets B {|Agent A, Nonce NA|} \<in> set evs2 |]
 | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 42 | ==> Says B Server | 
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2451diff
changeset | 43 |                   {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | 
| 11251 | 44 | # evs2 \<in> yahalom" | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 45 | |
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 46 | (*The Server receives Bob's message. He responds by sending a | 
| 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 47 | new session key to Alice, with a packet for forwarding to Bob.*) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 48 | YM3: "[| evs3 \<in> yahalom; Key KAB \<notin> used evs3; KAB \<in> symKeys; | 
| 6335 | 49 | Gets Server | 
| 2284 
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
 paulson parents: 
2156diff
changeset | 50 |                   {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | 
| 11251 | 51 | \<in> set evs3 |] | 
| 1995 | 52 | ==> Says Server A | 
| 3447 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 53 |                    {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
 | 
| 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 54 |                      Crypt (shrK B) {|Agent A, Key KAB|}|}
 | 
| 11251 | 55 | # evs3 \<in> yahalom" | 
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 56 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 57 | YM4: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 58 |        --{*Alice receives the Server's (?) message, checks her Nonce, and
 | 
| 3961 | 59 | uses the new session key to send Bob his Nonce. The premise | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 60 |            @{term "A \<noteq> Server"} is needed for @{text Says_Server_not_range}.
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 61 | Alice can check that K is symmetric by its length.*} | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 62 | "[| evs4 \<in> yahalom; A \<noteq> Server; K \<in> symKeys; | 
| 6335 | 63 |              Gets A {|Crypt(shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|}, X|}
 | 
| 11251 | 64 | \<in> set evs4; | 
| 65 |              Says A B {|Agent A, Nonce NA|} \<in> set evs4 |]
 | |
| 66 |           ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 \<in> yahalom"
 | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 67 | |
| 2110 | 68 | (*This message models possible leaks of session keys. The Nonces | 
| 2156 | 69 | identify the protocol run. Quoting Server here ensures they are | 
| 70 | correct.*) | |
| 11251 | 71 | Oops: "[| evso \<in> yahalom; | 
| 2284 
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
 paulson parents: 
2156diff
changeset | 72 |              Says Server A {|Crypt (shrK A)
 | 
| 
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
 paulson parents: 
2156diff
changeset | 73 |                                    {|Agent B, Key K, Nonce NA, Nonce NB|},
 | 
| 11251 | 74 | X|} \<in> set evso |] | 
| 75 |           ==> Notes Spy {|Nonce NA, Nonce NB, Key K|} # evso \<in> yahalom"
 | |
| 2110 | 76 | |
| 3447 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 77 | |
| 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 78 | constdefs | 
| 11251 | 79 | KeyWithNonce :: "[key, nat, event list] => bool" | 
| 3447 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 80 | "KeyWithNonce K NB evs == | 
| 11251 | 81 | \<exists>A B na X. | 
| 3447 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 82 |        Says Server A {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|} 
 | 
| 11251 | 83 | \<in> set evs" | 
| 84 | ||
| 85 | ||
| 18570 | 86 | declare Says_imp_analz_Spy [dest] | 
| 11251 | 87 | declare parts.Body [dest] | 
| 88 | declare Fake_parts_insert_in_Un [dest] | |
| 89 | declare analz_into_parts [dest] | |
| 90 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 91 | text{*A "possibility property": there are traces that reach the end*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 92 | lemma "[| A \<noteq> Server; K \<in> symKeys; Key K \<notin> used [] |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 93 | ==> \<exists>X NB. \<exists>evs \<in> yahalom. | 
| 11251 | 94 |              Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
 | 
| 95 | apply (intro exI bexI) | |
| 96 | apply (rule_tac [2] yahalom.Nil | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 97 | [THEN yahalom.YM1, THEN yahalom.Reception, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 98 | THEN yahalom.YM2, THEN yahalom.Reception, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 99 | THEN yahalom.YM3, THEN yahalom.Reception, | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
13956diff
changeset | 100 | THEN yahalom.YM4]) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 101 | apply (possibility, simp add: used_Cons) | 
| 11251 | 102 | done | 
| 103 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 104 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 105 | subsection{*Regularity Lemmas for Yahalom*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 106 | |
| 11251 | 107 | lemma Gets_imp_Says: | 
| 108 | "[| Gets B X \<in> set evs; evs \<in> yahalom |] ==> \<exists>A. Says A B X \<in> set evs" | |
| 109 | by (erule rev_mp, erule yahalom.induct, auto) | |
| 110 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 111 | text{*Must be proved separately for each protocol*}
 | 
| 11251 | 112 | lemma Gets_imp_knows_Spy: | 
| 113 | "[| Gets B X \<in> set evs; evs \<in> yahalom |] ==> X \<in> knows Spy evs" | |
| 114 | by (blast dest!: Gets_imp_Says Says_imp_knows_Spy) | |
| 115 | ||
| 18570 | 116 | lemmas Gets_imp_analz_Spy = Gets_imp_knows_Spy [THEN analz.Inj] | 
| 117 | declare Gets_imp_analz_Spy [dest] | |
| 11251 | 118 | |
| 119 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 120 | text{*Lets us treat YM4 using a similar argument as for the Fake case.*}
 | 
| 11251 | 121 | lemma YM4_analz_knows_Spy: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 122 |      "[| Gets A {|Crypt (shrK A) Y, X|} \<in> set evs;  evs \<in> yahalom |]
 | 
| 11251 | 123 | ==> X \<in> analz (knows Spy evs)" | 
| 124 | by blast | |
| 125 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 126 | lemmas YM4_parts_knows_Spy = | 
| 11251 | 127 | YM4_analz_knows_Spy [THEN analz_into_parts, standard] | 
| 128 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 129 | text{*For Oops*}
 | 
| 11251 | 130 | lemma YM4_Key_parts_knows_Spy: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 131 |      "Says Server A {|Crypt (shrK A) {|B,K,NA,NB|}, X|} \<in> set evs
 | 
| 11251 | 132 | ==> K \<in> parts (knows Spy evs)" | 
| 133 | by (blast dest!: parts.Body Says_imp_knows_Spy [THEN parts.Inj]) | |
| 134 | ||
| 135 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 136 | text{*Theorems of the form @{term "X \<notin> parts (knows Spy evs)"} imply 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 137 | that NOBODY sends messages containing X! *} | 
| 11251 | 138 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 139 | text{*Spy never sees a good agent's shared key!*}
 | 
| 11251 | 140 | lemma Spy_see_shrK [simp]: | 
| 141 | "evs \<in> yahalom ==> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)" | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 142 | by (erule yahalom.induct, force, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 143 | drule_tac [6] YM4_parts_knows_Spy, simp_all, blast+) | 
| 11251 | 144 | |
| 145 | lemma Spy_analz_shrK [simp]: | |
| 146 | "evs \<in> yahalom ==> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)" | |
| 147 | by auto | |
| 148 | ||
| 149 | lemma Spy_see_shrK_D [dest!]: | |
| 150 | "[|Key (shrK A) \<in> parts (knows Spy evs); evs \<in> yahalom|] ==> A \<in> bad" | |
| 151 | by (blast dest: Spy_see_shrK) | |
| 152 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 153 | text{*Nobody can have used non-existent keys!
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 154 |     Needed to apply @{text analz_insert_Key}*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 155 | lemma new_keys_not_used [simp]: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 156 | "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> yahalom|] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 157 | ==> K \<notin> keysFor (parts (spies evs))" | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 158 | apply (erule rev_mp) | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 159 | apply (erule yahalom.induct, force, | 
| 11251 | 160 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | 
| 13926 | 161 | txt{*Fake*}
 | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 162 | apply (force dest!: keysFor_parts_insert, auto) | 
| 11251 | 163 | done | 
| 164 | ||
| 165 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 166 | text{*Earlier, all protocol proofs declared this theorem.
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 167 | But only a few proofs need it, e.g. Yahalom and Kerberos IV.*} | 
| 11251 | 168 | lemma new_keys_not_analzd: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 169 | "[|K \<in> symKeys; evs \<in> yahalom; Key K \<notin> used evs|] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 170 | ==> K \<notin> keysFor (analz (knows Spy evs))" | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 171 | by (blast dest: new_keys_not_used intro: keysFor_mono [THEN subsetD]) | 
| 11251 | 172 | |
| 173 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 174 | text{*Describes the form of K when the Server sends this message.  Useful for
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 175 | Oops as well as main secrecy property.*} | 
| 11251 | 176 | lemma Says_Server_not_range [simp]: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 177 |      "[| Says Server A {|Crypt (shrK A) {|Agent B, Key K, na, nb|}, X|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 178 | \<in> set evs; evs \<in> yahalom |] | 
| 11251 | 179 | ==> K \<notin> range shrK" | 
| 17778 | 180 | by (erule rev_mp, erule yahalom.induct, simp_all) | 
| 11251 | 181 | |
| 182 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 183 | subsection{*Secrecy Theorems*}
 | 
| 11251 | 184 | |
| 185 | (**** | |
| 186 | The following is to prove theorems of the form | |
| 187 | ||
| 188 | Key K \<in> analz (insert (Key KAB) (knows Spy evs)) ==> | |
| 189 | Key K \<in> analz (knows Spy evs) | |
| 190 | ||
| 191 | A more general formula must be proved inductively. | |
| 192 | ****) | |
| 193 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 194 | text{* Session keys are not used to encrypt other session keys *}
 | 
| 11251 | 195 | |
| 196 | lemma analz_image_freshK [rule_format]: | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 197 | "evs \<in> yahalom ==> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 198 | \<forall>K KK. KK <= - (range shrK) --> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 199 | (Key K \<in> analz (Key`KK Un (knows Spy evs))) = | 
| 11251 | 200 | (K \<in> KK | Key K \<in> analz (knows Spy evs))" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 201 | apply (erule yahalom.induct, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 202 | drule_tac [7] YM4_analz_knows_Spy, analz_freshK, spy_analz, blast) | 
| 11251 | 203 | apply (simp only: Says_Server_not_range analz_image_freshK_simps) | 
| 204 | done | |
| 205 | ||
| 206 | lemma analz_insert_freshK: | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 207 | "[| evs \<in> yahalom; KAB \<notin> range shrK |] ==> | 
| 11655 | 208 | (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) = | 
| 11251 | 209 | (K = KAB | Key K \<in> analz (knows Spy evs))" | 
| 210 | by (simp only: analz_image_freshK analz_image_freshK_simps) | |
| 211 | ||
| 212 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 213 | text{*The Key K uniquely identifies the Server's  message.*}
 | 
| 11251 | 214 | lemma unique_session_keys: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 215 | "[| Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 216 |           {|Crypt (shrK A) {|Agent B, Key K, na, nb|}, X|} \<in> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 217 | Says Server A' | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 218 |           {|Crypt (shrK A') {|Agent B', Key K, na', nb'|}, X'|} \<in> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 219 | evs \<in> yahalom |] | 
| 11251 | 220 | ==> A=A' & B=B' & na=na' & nb=nb'" | 
| 221 | apply (erule rev_mp, erule rev_mp) | |
| 222 | apply (erule yahalom.induct, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 223 | txt{*YM3, by freshness, and YM4*}
 | 
| 11251 | 224 | apply blast+ | 
| 225 | done | |
| 226 | ||
| 227 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 228 | text{*Crucial secrecy property: Spy does not see the keys sent in msg YM3*}
 | 
| 11251 | 229 | lemma secrecy_lemma: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 230 | "[| A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 231 | ==> Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 232 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 233 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 234 | \<in> set evs --> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 235 |           Notes Spy {|na, nb, Key K|} \<notin> set evs -->
 | 
| 11251 | 236 | Key K \<notin> analz (knows Spy evs)" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 237 | apply (erule yahalom.induct, force, | 
| 11251 | 238 | drule_tac [6] YM4_analz_knows_Spy) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 239 | apply (simp_all add: pushes analz_insert_eq analz_insert_freshK, spy_analz)   --{*Fake*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 240 | apply (blast dest: unique_session_keys)+  --{*YM3, Oops*}
 | 
| 11251 | 241 | done | 
| 242 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 243 | text{*Final version*}
 | 
| 11251 | 244 | lemma Spy_not_see_encrypted_key: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 245 | "[| Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 246 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 247 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 248 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 249 |          Notes Spy {|na, nb, Key K|} \<notin> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 250 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 11251 | 251 | ==> Key K \<notin> analz (knows Spy evs)" | 
| 252 | by (blast dest: secrecy_lemma) | |
| 253 | ||
| 254 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 255 | subsubsection{* Security Guarantee for A upon receiving YM3 *}
 | 
| 11251 | 256 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 257 | text{*If the encrypted message appears then it originated with the Server*}
 | 
| 11251 | 258 | lemma A_trusts_YM3: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 259 |      "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 260 | A \<notin> bad; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 261 | ==> Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 262 |             {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 263 |               Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 11251 | 264 | \<in> set evs" | 
| 265 | apply (erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 266 | apply (erule yahalom.induct, force, | 
| 11251 | 267 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 268 | txt{*Fake, YM3*}
 | 
| 11251 | 269 | apply blast+ | 
| 270 | done | |
| 271 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 272 | text{*The obvious combination of @{text A_trusts_YM3} with
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 273 |   @{text Spy_not_see_encrypted_key}*}
 | 
| 11251 | 274 | lemma A_gets_good_key: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 275 |      "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 276 |          Notes Spy {|na, nb, Key K|} \<notin> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 277 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 11251 | 278 | ==> Key K \<notin> analz (knows Spy evs)" | 
| 279 | by (blast dest!: A_trusts_YM3 Spy_not_see_encrypted_key) | |
| 280 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 281 | |
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 282 | subsubsection{* Security Guarantees for B upon receiving YM4 *}
 | 
| 11251 | 283 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 284 | text{*B knows, by the first part of A's message, that the Server distributed
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 285 | the key for A and B. But this part says nothing about nonces.*} | 
| 11251 | 286 | lemma B_trusts_YM4_shrK: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 287 |      "[| Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs);
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 288 | B \<notin> bad; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 289 | ==> \<exists>NA NB. Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 290 |                       {|Crypt (shrK A) {|Agent B, Key K,
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 291 | Nonce NA, Nonce NB|}, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 292 |                         Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 11251 | 293 | \<in> set evs" | 
| 294 | apply (erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 295 | apply (erule yahalom.induct, force, | 
| 11251 | 296 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 297 | txt{*Fake, YM3*}
 | 
| 11251 | 298 | apply blast+ | 
| 299 | done | |
| 300 | ||
| 17411 | 301 | text{*B knows, by the second part of A's message, that the Server
 | 
| 302 | distributed the key quoting nonce NB. This part says nothing about | |
| 303 |   agent names.  Secrecy of NB is crucial.  Note that @{term "Nonce NB
 | |
| 304 | \<notin> analz(knows Spy evs)"} must be the FIRST antecedent of the | |
| 305 | induction formula.*} | |
| 306 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 307 | lemma B_trusts_YM4_newK [rule_format]: | 
| 11251 | 308 | "[|Crypt K (Nonce NB) \<in> parts (knows Spy evs); | 
| 309 | Nonce NB \<notin> analz (knows Spy evs); evs \<in> yahalom|] | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 310 | ==> \<exists>A B NA. Says Server A | 
| 11251 | 311 |                       {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|},
 | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 312 |                         Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 11251 | 313 | \<in> set evs" | 
| 314 | apply (erule rev_mp, erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 315 | apply (erule yahalom.induct, force, | 
| 11251 | 316 | frule_tac [6] YM4_parts_knows_Spy) | 
| 317 | apply (analz_mono_contra, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 318 | txt{*Fake, YM3*}
 | 
| 11251 | 319 | apply blast | 
| 320 | apply blast | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 321 | txt{*YM4.  A is uncompromised because NB is secure
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 322 | A's certificate guarantees the existence of the Server message*} | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 323 | apply (blast dest!: Gets_imp_Says Crypt_Spy_analz_bad | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 324 | dest: Says_imp_spies | 
| 11251 | 325 | parts.Inj [THEN parts.Fst, THEN A_trusts_YM3]) | 
| 326 | done | |
| 327 | ||
| 328 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 329 | subsubsection{* Towards proving secrecy of Nonce NB *}
 | 
| 11251 | 330 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 331 | text{*Lemmas about the predicate KeyWithNonce*}
 | 
| 11251 | 332 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 333 | lemma KeyWithNonceI: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 334 | "Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 335 |           {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|}
 | 
| 11251 | 336 | \<in> set evs ==> KeyWithNonce K NB evs" | 
| 337 | by (unfold KeyWithNonce_def, blast) | |
| 338 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 339 | lemma KeyWithNonce_Says [simp]: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 340 | "KeyWithNonce K NB (Says S A X # evs) = | 
| 11251 | 341 | (Server = S & | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 342 |        (\<exists>B n X'. X = {|Crypt (shrK A) {|Agent B, Key K, n, Nonce NB|}, X'|})
 | 
| 11251 | 343 | | KeyWithNonce K NB evs)" | 
| 344 | by (simp add: KeyWithNonce_def, blast) | |
| 345 | ||
| 346 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 347 | lemma KeyWithNonce_Notes [simp]: | 
| 11251 | 348 | "KeyWithNonce K NB (Notes A X # evs) = KeyWithNonce K NB evs" | 
| 349 | by (simp add: KeyWithNonce_def) | |
| 350 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 351 | lemma KeyWithNonce_Gets [simp]: | 
| 11251 | 352 | "KeyWithNonce K NB (Gets A X # evs) = KeyWithNonce K NB evs" | 
| 353 | by (simp add: KeyWithNonce_def) | |
| 354 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 355 | text{*A fresh key cannot be associated with any nonce
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 356 | (with respect to a given trace). *} | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 357 | lemma fresh_not_KeyWithNonce: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 358 | "Key K \<notin> used evs ==> ~ KeyWithNonce K NB evs" | 
| 11251 | 359 | by (unfold KeyWithNonce_def, blast) | 
| 360 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 361 | text{*The Server message associates K with NB' and therefore not with any
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 362 | other nonce NB.*} | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 363 | lemma Says_Server_KeyWithNonce: | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 364 |  "[| Says Server A {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB'|}, X|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 365 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 366 | NB \<noteq> NB'; evs \<in> yahalom |] | 
| 11251 | 367 | ==> ~ KeyWithNonce K NB evs" | 
| 368 | by (unfold KeyWithNonce_def, blast dest: unique_session_keys) | |
| 369 | ||
| 370 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 371 | text{*The only nonces that can be found with the help of session keys are
 | 
| 11251 | 372 | those distributed as nonce NB by the Server. The form of the theorem | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 373 |   recalls @{text analz_image_freshK}, but it is much more complicated.*}
 | 
| 11251 | 374 | |
| 375 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 376 | text{*As with @{text analz_image_freshK}, we take some pains to express the 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 377 | property as a logical equivalence so that the simplifier can apply it.*} | 
| 11251 | 378 | lemma Nonce_secrecy_lemma: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 379 | "P --> (X \<in> analz (G Un H)) --> (X \<in> analz H) ==> | 
| 11251 | 380 | P --> (X \<in> analz (G Un H)) = (X \<in> analz H)" | 
| 381 | by (blast intro: analz_mono [THEN subsetD]) | |
| 382 | ||
| 383 | lemma Nonce_secrecy: | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 384 | "evs \<in> yahalom ==> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 385 | (\<forall>KK. KK <= - (range shrK) --> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 386 | (\<forall>K \<in> KK. K \<in> symKeys --> ~ KeyWithNonce K NB evs) --> | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 387 | (Nonce NB \<in> analz (Key`KK Un (knows Spy evs))) = | 
| 11251 | 388 | (Nonce NB \<in> analz (knows Spy evs)))" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 389 | apply (erule yahalom.induct, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 390 | frule_tac [7] YM4_analz_knows_Spy) | 
| 11251 | 391 | apply (safe del: allI impI intro!: Nonce_secrecy_lemma [THEN impI, THEN allI]) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 392 | apply (simp_all del: image_insert image_Un | 
| 11251 | 393 | add: analz_image_freshK_simps split_ifs | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 394 | all_conj_distrib ball_conj_distrib | 
| 11251 | 395 | analz_image_freshK fresh_not_KeyWithNonce | 
| 396 | imp_disj_not1 (*Moves NBa\<noteq>NB to the front*) | |
| 397 | Says_Server_KeyWithNonce) | |
| 17411 | 398 | txt{*For Oops, simplification proves @{prop "NBa\<noteq>NB"}.  By
 | 
| 399 |   @{term Says_Server_KeyWithNonce}, we get @{prop "~ KeyWithNonce K NB
 | |
| 400 | evs"}; then simplification can apply the induction hypothesis with | |
| 401 |   @{term "KK = {K}"}.*}
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 402 | txt{*Fake*}
 | 
| 11251 | 403 | apply spy_analz | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 404 | txt{*YM2*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 405 | apply blast | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 406 | txt{*YM3*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 407 | apply blast | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 408 | txt{*YM4*}
 | 
| 13507 | 409 | apply (erule_tac V = "\<forall>KK. ?P KK" in thin_rl, clarify) | 
| 17411 | 410 | txt{*If @{prop "A \<in> bad"} then @{term NBa} is known, therefore
 | 
| 411 |   @{prop "NBa \<noteq> NB"}.  Previous two steps make the next step
 | |
| 412 | faster.*} | |
| 11251 | 413 | apply (blast dest!: Gets_imp_Says Says_imp_spies Crypt_Spy_analz_bad | 
| 414 | dest: analz.Inj | |
| 415 | parts.Inj [THEN parts.Fst, THEN A_trusts_YM3, THEN KeyWithNonceI]) | |
| 416 | done | |
| 417 | ||
| 418 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 419 | text{*Version required below: if NB can be decrypted using a session key then
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 420 | it was distributed with that key. The more general form above is required | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 421 | for the induction to carry through.*} | 
| 11251 | 422 | lemma single_Nonce_secrecy: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 423 | "[| Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 424 |           {|Crypt (shrK A) {|Agent B, Key KAB, na, Nonce NB'|}, X|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 425 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 426 | NB \<noteq> NB'; KAB \<notin> range shrK; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 427 | ==> (Nonce NB \<in> analz (insert (Key KAB) (knows Spy evs))) = | 
| 11251 | 428 | (Nonce NB \<in> analz (knows Spy evs))" | 
| 429 | by (simp_all del: image_insert image_Un imp_disjL | |
| 430 | add: analz_image_freshK_simps split_ifs | |
| 13507 | 431 | Nonce_secrecy Says_Server_KeyWithNonce) | 
| 11251 | 432 | |
| 433 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 434 | subsubsection{* The Nonce NB uniquely identifies B's message. *}
 | 
| 11251 | 435 | |
| 436 | lemma unique_NB: | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 437 |      "[| Crypt (shrK B) {|Agent A, Nonce NA, nb|} \<in> parts (knows Spy evs);
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 438 |          Crypt (shrK B') {|Agent A', Nonce NA', nb|} \<in> parts (knows Spy evs);
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 439 | evs \<in> yahalom; B \<notin> bad; B' \<notin> bad |] | 
| 11251 | 440 | ==> NA' = NA & A' = A & B' = B" | 
| 441 | apply (erule rev_mp, erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 442 | apply (erule yahalom.induct, force, | 
| 11251 | 443 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 444 | txt{*Fake, and YM2 by freshness*}
 | 
| 11251 | 445 | apply blast+ | 
| 446 | done | |
| 447 | ||
| 448 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 449 | text{*Variant useful for proving secrecy of NB.  Because nb is assumed to be
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 450 | secret, we no longer must assume B, B' not bad.*} | 
| 11251 | 451 | lemma Says_unique_NB: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 452 |      "[| Says C S   {|X,  Crypt (shrK B) {|Agent A, Nonce NA, nb|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 453 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 454 |          Gets S' {|X', Crypt (shrK B') {|Agent A', Nonce NA', nb|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 455 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 456 | nb \<notin> analz (knows Spy evs); evs \<in> yahalom |] | 
| 11251 | 457 | ==> NA' = NA & A' = A & B' = B" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 458 | by (blast dest!: Gets_imp_Says Crypt_Spy_analz_bad | 
| 11251 | 459 | dest: Says_imp_spies unique_NB parts.Inj analz.Inj) | 
| 460 | ||
| 461 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 462 | subsubsection{* A nonce value is never used both as NA and as NB *}
 | 
| 11251 | 463 | |
| 464 | lemma no_nonce_YM1_YM2: | |
| 465 |      "[|Crypt (shrK B') {|Agent A', Nonce NB, nb'|} \<in> parts(knows Spy evs);
 | |
| 466 | Nonce NB \<notin> analz (knows Spy evs); evs \<in> yahalom|] | |
| 467 |   ==> Crypt (shrK B)  {|Agent A, na, Nonce NB|} \<notin> parts(knows Spy evs)"
 | |
| 468 | apply (erule rev_mp, erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 469 | apply (erule yahalom.induct, force, | 
| 11251 | 470 | frule_tac [6] YM4_parts_knows_Spy) | 
| 471 | apply (analz_mono_contra, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 472 | txt{*Fake, YM2*}
 | 
| 11251 | 473 | apply blast+ | 
| 474 | done | |
| 475 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 476 | text{*The Server sends YM3 only in response to YM2.*}
 | 
| 11251 | 477 | lemma Says_Server_imp_YM2: | 
| 478 |      "[| Says Server A {|Crypt (shrK A) {|Agent B, k, na, nb|}, X|} \<in> set evs;
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 479 | evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 480 |       ==> Gets Server {| Agent B, Crypt (shrK B) {|Agent A, na, nb|} |}
 | 
| 11251 | 481 | \<in> set evs" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 482 | by (erule rev_mp, erule yahalom.induct, auto) | 
| 11251 | 483 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 484 | text{*A vital theorem for B, that nonce NB remains secure from the Spy.*}
 | 
| 11251 | 485 | lemma Spy_not_see_NB : | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 486 | "[| Says B Server | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 487 | 	        {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | 
| 11251 | 488 | \<in> set evs; | 
| 489 | 	 (\<forall>k. Notes Spy {|Nonce NA, Nonce NB, k|} \<notin> set evs);
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 490 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 11251 | 491 | ==> Nonce NB \<notin> analz (knows Spy evs)" | 
| 492 | apply (erule rev_mp, erule rev_mp) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 493 | apply (erule yahalom.induct, force, | 
| 11251 | 494 | frule_tac [6] YM4_analz_knows_Spy) | 
| 495 | apply (simp_all add: split_ifs pushes new_keys_not_analzd analz_insert_eq | |
| 496 | analz_insert_freshK) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 497 | txt{*Fake*}
 | 
| 11251 | 498 | apply spy_analz | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 499 | txt{*YM1: NB=NA is impossible anyway, but NA is secret because it is fresh!*}
 | 
| 11251 | 500 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 501 | txt{*YM2*}
 | 
| 11251 | 502 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 503 | txt{*Prove YM3 by showing that no NB can also be an NA*}
 | 
| 11251 | 504 | apply (blast dest!: no_nonce_YM1_YM2 dest: Gets_imp_Says Says_unique_NB) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 505 | txt{*LEVEL 7: YM4 and Oops remain*}
 | 
| 11251 | 506 | apply (clarify, simp add: all_conj_distrib) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 507 | txt{*YM4: key K is visible to Spy, contradicting session key secrecy theorem*}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 508 | txt{*Case analysis on Aa:bad; PROOF FAILED problems
 | 
| 17411 | 509 |   use @{text Says_unique_NB} to identify message components: @{term "Aa=A"}, @{term "Ba=B"}*}
 | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 510 | apply (blast dest!: Says_unique_NB analz_shrK_Decrypt | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 511 | parts.Inj [THEN parts.Fst, THEN A_trusts_YM3] | 
| 11251 | 512 | dest: Gets_imp_Says Says_imp_spies Says_Server_imp_YM2 | 
| 513 | Spy_not_see_encrypted_key) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 514 | txt{*Oops case: if the nonce is betrayed now, show that the Oops event is
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 515 | covered by the quantified Oops assumption.*} | 
| 11251 | 516 | apply (clarify, simp add: all_conj_distrib) | 
| 517 | apply (frule Says_Server_imp_YM2, assumption) | |
| 518 | apply (case_tac "NB = NBa") | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 519 | txt{*If NB=NBa then all other components of the Oops message agree*}
 | 
| 11251 | 520 | apply (blast dest: Says_unique_NB) | 
| 17411 | 521 | txt{*case @{prop "NB \<noteq> NBa"}*}
 | 
| 11251 | 522 | apply (simp add: single_Nonce_secrecy) | 
| 523 | apply (blast dest!: no_nonce_YM1_YM2 (*to prove NB\<noteq>NAa*)) | |
| 524 | done | |
| 525 | ||
| 526 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 527 | text{*B's session key guarantee from YM4.  The two certificates contribute to a
 | 
| 11251 | 528 | single conclusion about the Server's message. Note that the "Notes Spy" | 
| 17411 | 529 |   assumption must quantify over @{text \<forall>} POSSIBLE keys instead of our particular K.
 | 
| 11251 | 530 | If this run is broken and the spy substitutes a certificate containing an | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 531 | old key, B has no means of telling.*} | 
| 11251 | 532 | lemma B_trusts_YM4: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 533 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 534 | Crypt K (Nonce NB)|} \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 535 | Says B Server | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 536 |            {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 537 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 538 |          \<forall>k. Notes Spy {|Nonce NA, Nonce NB, k|} \<notin> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 539 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 540 | ==> Says Server A | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 541 |                    {|Crypt (shrK A) {|Agent B, Key K,
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 542 | Nonce NA, Nonce NB|}, | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 543 |                      Crypt (shrK B) {|Agent A, Key K|}|}
 | 
| 11251 | 544 | \<in> set evs" | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 545 | by (blast dest: Spy_not_see_NB Says_unique_NB | 
| 11251 | 546 | Says_Server_imp_YM2 B_trusts_YM4_newK) | 
| 547 | ||
| 548 | ||
| 549 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 550 | text{*The obvious combination of @{text B_trusts_YM4} with 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 551 |   @{text Spy_not_see_encrypted_key}*}
 | 
| 11251 | 552 | lemma B_gets_good_key: | 
| 553 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | |
| 554 | Crypt K (Nonce NB)|} \<in> set evs; | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 555 | Says B Server | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 556 |            {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 557 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 558 |          \<forall>k. Notes Spy {|Nonce NA, Nonce NB, k|} \<notin> set evs;
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 559 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 11251 | 560 | ==> Key K \<notin> analz (knows Spy evs)" | 
| 561 | by (blast dest!: B_trusts_YM4 Spy_not_see_encrypted_key) | |
| 562 | ||
| 563 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 564 | subsection{*Authenticating B to A*}
 | 
| 11251 | 565 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 566 | text{*The encryption in message YM2 tells us it cannot be faked.*}
 | 
| 11251 | 567 | lemma B_Said_YM2 [rule_format]: | 
| 568 |      "[|Crypt (shrK B) {|Agent A, Nonce NA, nb|} \<in> parts (knows Spy evs);
 | |
| 569 | evs \<in> yahalom|] | |
| 570 | ==> B \<notin> bad --> | |
| 571 |           Says B Server {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, nb|}|}
 | |
| 572 | \<in> set evs" | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 573 | apply (erule rev_mp, erule yahalom.induct, force, | 
| 11251 | 574 | frule_tac [6] YM4_parts_knows_Spy, simp_all) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 575 | txt{*Fake*}
 | 
| 11251 | 576 | apply blast | 
| 577 | done | |
| 578 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 579 | text{*If the server sends YM3 then B sent YM2*}
 | 
| 11251 | 580 | lemma YM3_auth_B_to_A_lemma: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 581 |      "[|Says Server A {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, nb|}, X|}
 | 
| 11251 | 582 | \<in> set evs; evs \<in> yahalom|] | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 583 | ==> B \<notin> bad --> | 
| 11251 | 584 |           Says B Server {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, nb|}|}
 | 
| 585 | \<in> set evs" | |
| 586 | apply (erule rev_mp, erule yahalom.induct, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 587 | txt{*YM3, YM4*}
 | 
| 11251 | 588 | apply (blast dest!: B_Said_YM2)+ | 
| 589 | done | |
| 590 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 591 | text{*If A receives YM3 then B has used nonce NA (and therefore is alive)*}
 | 
| 11251 | 592 | lemma YM3_auth_B_to_A: | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 593 |      "[| Gets A {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, nb|}, X|}
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 594 | \<in> set evs; | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 595 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 596 |       ==> Says B Server {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, nb|}|}
 | 
| 11251 | 597 | \<in> set evs" | 
| 598 | by (blast dest!: A_trusts_YM3 YM3_auth_B_to_A_lemma elim: knows_Spy_partsEs) | |
| 599 | ||
| 600 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 601 | subsection{*Authenticating A to B using the certificate 
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 602 |   @{term "Crypt K (Nonce NB)"}*}
 | 
| 11251 | 603 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 604 | text{*Assuming the session key is secure, if both certificates are present then
 | 
| 11251 | 605 | A has said NB. We can't be sure about the rest of A's message, but only | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 606 | NB matters for freshness.*} | 
| 11251 | 607 | lemma A_Said_YM3_lemma [rule_format]: | 
| 608 | "evs \<in> yahalom | |
| 609 | ==> Key K \<notin> analz (knows Spy evs) --> | |
| 610 | Crypt K (Nonce NB) \<in> parts (knows Spy evs) --> | |
| 611 |           Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs) -->
 | |
| 612 | B \<notin> bad --> | |
| 613 |           (\<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs)"
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 614 | apply (erule yahalom.induct, force, | 
| 11251 | 615 | frule_tac [6] YM4_parts_knows_Spy) | 
| 616 | apply (analz_mono_contra, simp_all) | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 617 | txt{*Fake*}
 | 
| 11251 | 618 | apply blast | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 619 | txt{*YM3: by @{text new_keys_not_used}, the message
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 620 |    @{term "Crypt K (Nonce NB)"} could not exist*}
 | 
| 11251 | 621 | apply (force dest!: Crypt_imp_keysFor) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 622 | txt{*YM4: was @{term "Crypt K (Nonce NB)"} the very last message?
 | 
| 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 623 | If not, use the induction hypothesis*} | 
| 11251 | 624 | apply (simp add: ex_disj_distrib) | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 625 | txt{*yes: apply unicity of session keys*}
 | 
| 11251 | 626 | apply (blast dest!: Gets_imp_Says A_trusts_YM3 B_trusts_YM4_shrK | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 627 | Crypt_Spy_analz_bad | 
| 11251 | 628 | dest: Says_imp_knows_Spy [THEN parts.Inj] unique_session_keys) | 
| 629 | done | |
| 630 | ||
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 631 | text{*If B receives YM4 then A has used nonce NB (and therefore is alive).
 | 
| 11251 | 632 | Moreover, A associates K with NB (thus is talking about the same run). | 
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 633 | Other premises guarantee secrecy of K.*} | 
| 11251 | 634 | lemma YM4_imp_A_Said_YM3 [rule_format]: | 
| 635 |      "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
 | |
| 636 | Crypt K (Nonce NB)|} \<in> set evs; | |
| 637 | Says B Server | |
| 638 |            {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}
 | |
| 639 | \<in> set evs; | |
| 640 |          (\<forall>NA k. Notes Spy {|Nonce NA, Nonce NB, k|} \<notin> set evs);
 | |
| 641 | A \<notin> bad; B \<notin> bad; evs \<in> yahalom |] | |
| 642 |       ==> \<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
 | |
| 14207 
f20fbb141673
Conversion of all main protocols from "Shared" to "Public".
 paulson parents: 
14200diff
changeset | 643 | by (blast intro!: A_Said_YM3_lemma | 
| 11251 | 644 | dest: Spy_not_see_encrypted_key B_trusts_YM4 Gets_imp_Says) | 
| 3447 
c7c8c0db05b9
Defines KeyWithNonce, which is used to prove the secrecy of NB
 paulson parents: 
2516diff
changeset | 645 | |
| 1985 
84cf16192e03
Tidied many proofs, using AddIffs to let equivalences take
 paulson parents: diff
changeset | 646 | end |