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