src/HOL/Auth/Yahalom_Bad.thy
author haftmann
Fri Apr 20 11:21:42 2007 +0200 (2007-04-20)
changeset 22744 5cbe966d67a2
parent 16417 9bc16273c2d4
child 23746 a455e69c31cc
permissions -rw-r--r--
Isar definitions are now added explicitly to code theorem table
paulson@6400
     1
(*  Title:      HOL/Auth/Yahalom
paulson@6400
     2
    ID:         $Id$
paulson@6400
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@6400
     4
    Copyright   1996  University of Cambridge
paulson@6400
     5
*)
paulson@6400
     6
paulson@13956
     7
header{*The Yahalom Protocol: A Flawed Version*}
paulson@13956
     8
haftmann@16417
     9
theory Yahalom_Bad imports Public begin
paulson@14207
    10
paulson@14207
    11
text{*
paulson@14207
    12
Demonstrates of why Oops is necessary.  This protocol can be attacked because
paulson@14207
    13
it doesn't keep NB secret, but without Oops it can be "verified" anyway.
paulson@14207
    14
The issues are discussed in lcp's LICS 2000 invited lecture.
paulson@14207
    15
*}
paulson@6400
    16
paulson@11251
    17
consts  yahalom   :: "event list set"
paulson@6400
    18
inductive "yahalom"
paulson@11251
    19
  intros
paulson@6400
    20
         (*Initial trace is empty*)
paulson@11251
    21
   Nil:  "[] \<in> yahalom"
paulson@6400
    22
paulson@6400
    23
         (*The spy MAY say anything he CAN say.  We do not expect him to
paulson@6400
    24
           invent new nonces here, but he can also use NS1.  Common to
paulson@6400
    25
           all similar protocols.*)
paulson@11251
    26
   Fake: "[| evsf \<in> yahalom;  X \<in> synth (analz (knows Spy evsf)) |]
paulson@11251
    27
          ==> Says Spy B X  # evsf \<in> yahalom"
paulson@6400
    28
paulson@6400
    29
         (*A message that has been sent can be received by the
paulson@6400
    30
           intended recipient.*)
paulson@11251
    31
   Reception: "[| evsr \<in> yahalom;  Says A B X \<in> set evsr |]
paulson@11251
    32
               ==> Gets B X # evsr \<in> yahalom"
paulson@6400
    33
paulson@6400
    34
         (*Alice initiates a protocol run*)
paulson@11251
    35
   YM1:  "[| evs1 \<in> yahalom;  Nonce NA \<notin> used evs1 |]
paulson@11251
    36
          ==> Says A B {|Agent A, Nonce NA|} # evs1 \<in> yahalom"
paulson@6400
    37
paulson@6400
    38
         (*Bob's response to Alice's message.*)
paulson@11251
    39
   YM2:  "[| evs2 \<in> yahalom;  Nonce NB \<notin> used evs2;
paulson@11251
    40
             Gets B {|Agent A, Nonce NA|} \<in> set evs2 |]
paulson@11251
    41
          ==> Says B Server
paulson@6400
    42
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@11251
    43
                # evs2 \<in> yahalom"
paulson@6400
    44
paulson@6400
    45
         (*The Server receives Bob's message.  He responds by sending a
paulson@6400
    46
            new session key to Alice, with a packet for forwarding to Bob.*)
paulson@14207
    47
   YM3:  "[| evs3 \<in> yahalom;  Key KAB \<notin> used evs3;  KAB \<in> symKeys;
paulson@11251
    48
             Gets Server
paulson@6400
    49
                  {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@11251
    50
               \<in> set evs3 |]
paulson@6400
    51
          ==> Says Server A
paulson@6400
    52
                   {|Crypt (shrK A) {|Agent B, Key KAB, Nonce NA, Nonce NB|},
paulson@6400
    53
                     Crypt (shrK B) {|Agent A, Key KAB|}|}
paulson@11251
    54
                # evs3 \<in> yahalom"
paulson@6400
    55
paulson@6400
    56
         (*Alice receives the Server's (?) message, checks her Nonce, and
paulson@6400
    57
           uses the new session key to send Bob his Nonce.  The premise
paulson@11251
    58
           A \<noteq> Server is needed to prove Says_Server_not_range.*)
paulson@14207
    59
   YM4:  "[| evs4 \<in> yahalom;  A \<noteq> Server;  K \<in> symKeys;
paulson@6400
    60
             Gets A {|Crypt(shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|}, X|}
paulson@11251
    61
                \<in> set evs4;
paulson@11251
    62
             Says A B {|Agent A, Nonce NA|} \<in> set evs4 |]
paulson@11251
    63
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs4 \<in> yahalom"
paulson@11251
    64
paulson@11251
    65
paulson@11251
    66
declare Says_imp_knows_Spy [THEN analz.Inj, dest]
paulson@11251
    67
declare parts.Body  [dest]
paulson@11251
    68
declare Fake_parts_insert_in_Un  [dest]
paulson@11251
    69
declare analz_into_parts [dest]
paulson@11251
    70
paulson@11251
    71
paulson@14207
    72
text{*A "possibility property": there are traces that reach the end*}
paulson@14207
    73
lemma "[| A \<noteq> Server; Key K \<notin> used []; K \<in> symKeys |] 
paulson@14200
    74
       ==> \<exists>X NB. \<exists>evs \<in> yahalom.
paulson@14200
    75
              Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
paulson@11251
    76
apply (intro exI bexI)
paulson@11251
    77
apply (rule_tac [2] yahalom.Nil
paulson@11251
    78
                    [THEN yahalom.YM1, THEN yahalom.Reception,
paulson@11251
    79
                     THEN yahalom.YM2, THEN yahalom.Reception,
paulson@11251
    80
                     THEN yahalom.YM3, THEN yahalom.Reception,
paulson@14200
    81
                     THEN yahalom.YM4])
paulson@14200
    82
apply (possibility, simp add: used_Cons) 
paulson@11251
    83
done
paulson@11251
    84
paulson@14207
    85
subsection{*Regularity Lemmas for Yahalom*}
paulson@14207
    86
paulson@11251
    87
lemma Gets_imp_Says:
paulson@11251
    88
     "[| Gets B X \<in> set evs; evs \<in> yahalom |] ==> \<exists>A. Says A B X \<in> set evs"
paulson@11251
    89
by (erule rev_mp, erule yahalom.induct, auto)
paulson@11251
    90
paulson@11251
    91
(*Must be proved separately for each protocol*)
paulson@11251
    92
lemma Gets_imp_knows_Spy:
paulson@11251
    93
     "[| Gets B X \<in> set evs; evs \<in> yahalom |]  ==> X \<in> knows Spy evs"
paulson@11251
    94
by (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
paulson@11251
    95
paulson@11251
    96
declare Gets_imp_knows_Spy [THEN analz.Inj, dest]
paulson@11251
    97
paulson@11251
    98
paulson@14207
    99
subsection{* For reasoning about the encrypted portion of messages *}
paulson@11251
   100
paulson@14207
   101
text{*Lets us treat YM4 using a similar argument as for the Fake case.*}
paulson@11251
   102
lemma YM4_analz_knows_Spy:
paulson@11251
   103
     "[| Gets A {|Crypt (shrK A) Y, X|} \<in> set evs;  evs \<in> yahalom |]
paulson@11251
   104
      ==> X \<in> analz (knows Spy evs)"
paulson@11251
   105
by blast
paulson@11251
   106
paulson@11251
   107
lemmas YM4_parts_knows_Spy =
paulson@11251
   108
       YM4_analz_knows_Spy [THEN analz_into_parts, standard]
paulson@11251
   109
paulson@11251
   110
paulson@14207
   111
text{*Theorems of the form @{term "X \<notin> parts (knows Spy evs)"} imply 
paulson@14207
   112
            that NOBODY sends messages containing X!*}
paulson@11251
   113
paulson@14207
   114
text{*Spy never sees a good agent's shared key!*}
paulson@11251
   115
lemma Spy_see_shrK [simp]:
paulson@11251
   116
     "evs \<in> yahalom ==> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)"
paulson@11251
   117
apply (erule yahalom.induct, force,
paulson@13507
   118
       drule_tac [6] YM4_parts_knows_Spy, simp_all, blast+)
paulson@11251
   119
done
paulson@11251
   120
paulson@11251
   121
lemma Spy_analz_shrK [simp]:
paulson@11251
   122
     "evs \<in> yahalom ==> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)"
paulson@11251
   123
by auto
paulson@11251
   124
paulson@11251
   125
lemma Spy_see_shrK_D [dest!]:
paulson@11251
   126
     "[|Key (shrK A) \<in> parts (knows Spy evs);  evs \<in> yahalom|] ==> A \<in> bad"
paulson@11251
   127
by (blast dest: Spy_see_shrK)
paulson@11251
   128
paulson@14207
   129
text{*Nobody can have used non-existent keys!
paulson@14207
   130
    Needed to apply @{text analz_insert_Key}*}
paulson@14207
   131
lemma new_keys_not_used [simp]:
paulson@14207
   132
    "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> yahalom|]
paulson@14207
   133
     ==> K \<notin> keysFor (parts (spies evs))"
paulson@14207
   134
apply (erule rev_mp)
paulson@11251
   135
apply (erule yahalom.induct, force,
paulson@11251
   136
       frule_tac [6] YM4_parts_knows_Spy, simp_all)
paulson@13926
   137
txt{*Fake*}
paulson@14207
   138
apply (force dest!: keysFor_parts_insert, auto)
paulson@11251
   139
done
paulson@11251
   140
paulson@11251
   141
paulson@14207
   142
subsection{*Secrecy Theorems*}
paulson@14207
   143
paulson@11251
   144
(****
paulson@11251
   145
 The following is to prove theorems of the form
paulson@11251
   146
paulson@11251
   147
  Key K \<in> analz (insert (Key KAB) (knows Spy evs)) ==>
paulson@11251
   148
  Key K \<in> analz (knows Spy evs)
paulson@11251
   149
paulson@11251
   150
 A more general formula must be proved inductively.
paulson@11251
   151
****)
paulson@11251
   152
paulson@14207
   153
subsection{* Session keys are not used to encrypt other session keys *}
paulson@11251
   154
paulson@11251
   155
lemma analz_image_freshK [rule_format]:
paulson@11251
   156
 "evs \<in> yahalom ==>
paulson@11251
   157
   \<forall>K KK. KK <= - (range shrK) -->
paulson@11251
   158
          (Key K \<in> analz (Key`KK Un (knows Spy evs))) =
paulson@11251
   159
          (K \<in> KK | Key K \<in> analz (knows Spy evs))"
paulson@14207
   160
by (erule yahalom.induct, 
paulson@14207
   161
    drule_tac [7] YM4_analz_knows_Spy, analz_freshK, spy_analz, blast) 
paulson@11251
   162
paulson@14207
   163
lemma analz_insert_freshK:
paulson@14207
   164
     "[| evs \<in> yahalom;  KAB \<notin> range shrK |] ==>
wenzelm@11655
   165
      (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) =
paulson@11251
   166
      (K = KAB | Key K \<in> analz (knows Spy evs))"
paulson@11251
   167
by (simp only: analz_image_freshK analz_image_freshK_simps)
paulson@11251
   168
paulson@11251
   169
paulson@14207
   170
text{*The Key K uniquely identifies the Server's  message.*}
paulson@11251
   171
lemma unique_session_keys:
paulson@11251
   172
     "[| Says Server A
paulson@11251
   173
          {|Crypt (shrK A) {|Agent B, Key K, na, nb|}, X|} \<in> set evs;
paulson@11251
   174
        Says Server A'
paulson@11251
   175
          {|Crypt (shrK A') {|Agent B', Key K, na', nb'|}, X'|} \<in> set evs;
paulson@11251
   176
        evs \<in> yahalom |]
paulson@11251
   177
     ==> A=A' & B=B' & na=na' & nb=nb'"
paulson@11251
   178
apply (erule rev_mp, erule rev_mp)
paulson@11251
   179
apply (erule yahalom.induct, simp_all)
paulson@14207
   180
txt{*YM3, by freshness, and YM4*}
paulson@11251
   181
apply blast+
paulson@11251
   182
done
paulson@11251
   183
paulson@11251
   184
paulson@14207
   185
text{* Crucial secrecy property: Spy does not see the keys sent in msg YM3 *}
paulson@11251
   186
lemma secrecy_lemma:
paulson@11251
   187
     "[| A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   188
      ==> Says Server A
paulson@11251
   189
            {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
paulson@11251
   190
              Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   191
           \<in> set evs -->
paulson@11251
   192
          Key K \<notin> analz (knows Spy evs)"
paulson@11251
   193
apply (erule yahalom.induct, force, drule_tac [6] YM4_analz_knows_Spy)
paulson@13507
   194
apply (simp_all add: pushes analz_insert_eq analz_insert_freshK, spy_analz)  (*Fake*)
paulson@11251
   195
apply (blast dest: unique_session_keys)  (*YM3*)
paulson@11251
   196
done
paulson@11251
   197
paulson@14207
   198
text{*Final version*}
paulson@11251
   199
lemma Spy_not_see_encrypted_key:
paulson@11251
   200
     "[| Says Server A
paulson@11251
   201
            {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
paulson@11251
   202
              Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   203
           \<in> set evs;
paulson@11251
   204
         A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   205
      ==> Key K \<notin> analz (knows Spy evs)"
paulson@11251
   206
by (blast dest: secrecy_lemma)
paulson@11251
   207
paulson@6400
   208
paulson@14207
   209
subsection{* Security Guarantee for A upon receiving YM3 *}
paulson@11251
   210
paulson@14207
   211
text{*If the encrypted message appears then it originated with the Server*}
paulson@11251
   212
lemma A_trusts_YM3:
paulson@11251
   213
     "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
paulson@11251
   214
         A \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   215
       ==> Says Server A
paulson@11251
   216
            {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
paulson@11251
   217
              Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   218
           \<in> set evs"
paulson@11251
   219
apply (erule rev_mp)
paulson@11251
   220
apply (erule yahalom.induct, force,
paulson@11251
   221
       frule_tac [6] YM4_parts_knows_Spy, simp_all)
paulson@14207
   222
txt{*Fake, YM3*}
paulson@11251
   223
apply blast+
paulson@11251
   224
done
paulson@11251
   225
paulson@14207
   226
text{*The obvious combination of @{text A_trusts_YM3} with
paulson@14207
   227
  @{text Spy_not_see_encrypted_key}*}
paulson@11251
   228
lemma A_gets_good_key:
paulson@11251
   229
     "[| Crypt (shrK A) {|Agent B, Key K, na, nb|} \<in> parts (knows Spy evs);
paulson@11251
   230
         A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   231
      ==> Key K \<notin> analz (knows Spy evs)"
paulson@11251
   232
by (blast dest!: A_trusts_YM3 Spy_not_see_encrypted_key)
paulson@11251
   233
paulson@14207
   234
subsection{* Security Guarantees for B upon receiving YM4 *}
paulson@11251
   235
paulson@14207
   236
text{*B knows, by the first part of A's message, that the Server distributed
paulson@14207
   237
  the key for A and B.  But this part says nothing about nonces.*}
paulson@11251
   238
lemma B_trusts_YM4_shrK:
paulson@11251
   239
     "[| Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs);
paulson@11251
   240
         B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   241
      ==> \<exists>NA NB. Says Server A
paulson@11251
   242
                      {|Crypt (shrK A) {|Agent B, Key K, Nonce NA, Nonce NB|},
paulson@11251
   243
                        Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   244
                     \<in> set evs"
paulson@11251
   245
apply (erule rev_mp)
paulson@11251
   246
apply (erule yahalom.induct, force,
paulson@11251
   247
       frule_tac [6] YM4_parts_knows_Spy, simp_all)
paulson@14207
   248
txt{*Fake, YM3*}
paulson@11251
   249
apply blast+
paulson@11251
   250
done
paulson@11251
   251
paulson@14207
   252
subsection{*The Flaw in the Model*}
paulson@14207
   253
paulson@14207
   254
text{* Up to now, the reasoning is similar to standard Yahalom.  Now the
paulson@11251
   255
    doubtful reasoning occurs.  We should not be assuming that an unknown
paulson@11251
   256
    key is secure, but the model allows us to: there is no Oops rule to
paulson@14207
   257
    let session keys become compromised.*}
paulson@11251
   258
paulson@14207
   259
text{*B knows, by the second part of A's message, that the Server distributed
paulson@11251
   260
  the key quoting nonce NB.  This part says nothing about agent names.
paulson@11251
   261
  Secrecy of K is assumed; the valid Yahalom proof uses (and later proves)
paulson@14207
   262
  the secrecy of NB.*}
paulson@11251
   263
lemma B_trusts_YM4_newK [rule_format]:
paulson@11251
   264
     "[|Key K \<notin> analz (knows Spy evs);  evs \<in> yahalom|]
paulson@11251
   265
      ==> Crypt K (Nonce NB) \<in> parts (knows Spy evs) -->
paulson@11251
   266
          (\<exists>A B NA. Says Server A
paulson@11251
   267
                      {|Crypt (shrK A) {|Agent B, Key K,
paulson@11251
   268
                                Nonce NA, Nonce NB|},
paulson@11251
   269
                        Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   270
                     \<in> set evs)"
paulson@11251
   271
apply (erule rev_mp)
paulson@11251
   272
apply (erule yahalom.induct, force,
paulson@11251
   273
       frule_tac [6] YM4_parts_knows_Spy)
paulson@11251
   274
apply (analz_mono_contra, simp_all)
paulson@14207
   275
txt{*Fake*}
paulson@11251
   276
apply blast
paulson@14207
   277
txt{*YM3*}
paulson@11251
   278
apply blast
paulson@14207
   279
txt{*A is uncompromised because NB is secure
paulson@14207
   280
  A's certificate guarantees the existence of the Server message*}
paulson@11251
   281
apply (blast dest!: Gets_imp_Says Crypt_Spy_analz_bad
paulson@11251
   282
             dest: Says_imp_spies
paulson@11251
   283
                   parts.Inj [THEN parts.Fst, THEN A_trusts_YM3])
paulson@11251
   284
done
paulson@11251
   285
paulson@11251
   286
paulson@14207
   287
text{*B's session key guarantee from YM4.  The two certificates contribute to a
paulson@14207
   288
  single conclusion about the Server's message. *}
paulson@11251
   289
lemma B_trusts_YM4:
paulson@11251
   290
     "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
paulson@11251
   291
                  Crypt K (Nonce NB)|} \<in> set evs;
paulson@11251
   292
         Says B Server
paulson@11251
   293
           {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@11251
   294
           \<in> set evs;
paulson@11251
   295
         A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   296
       ==> \<exists>na nb. Says Server A
paulson@11251
   297
                   {|Crypt (shrK A) {|Agent B, Key K, na, nb|},
paulson@11251
   298
                     Crypt (shrK B) {|Agent A, Key K|}|}
paulson@11251
   299
             \<in> set evs"
paulson@11251
   300
by (blast dest: B_trusts_YM4_newK B_trusts_YM4_shrK Spy_not_see_encrypted_key
paulson@11251
   301
                unique_session_keys)
paulson@11251
   302
paulson@11251
   303
paulson@14207
   304
text{*The obvious combination of @{text B_trusts_YM4} with 
paulson@14207
   305
  @{text Spy_not_see_encrypted_key}*}
paulson@11251
   306
lemma B_gets_good_key:
paulson@11251
   307
     "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
paulson@11251
   308
                  Crypt K (Nonce NB)|} \<in> set evs;
paulson@11251
   309
         Says B Server
paulson@11251
   310
           {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@11251
   311
           \<in> set evs;
paulson@11251
   312
         A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   313
      ==> Key K \<notin> analz (knows Spy evs)"
paulson@11251
   314
by (blast dest!: B_trusts_YM4 Spy_not_see_encrypted_key)
paulson@11251
   315
paulson@11251
   316
paulson@11251
   317
(*** Authenticating B to A: these proofs are not considered.
paulson@11251
   318
     They are irrelevant to showing the need for Oops. ***)
paulson@11251
   319
paulson@11251
   320
paulson@11251
   321
(*** Authenticating A to B using the certificate Crypt K (Nonce NB) ***)
paulson@11251
   322
paulson@14207
   323
text{*Assuming the session key is secure, if both certificates are present then
paulson@11251
   324
  A has said NB.  We can't be sure about the rest of A's message, but only
paulson@14207
   325
  NB matters for freshness.*}
paulson@11251
   326
lemma A_Said_YM3_lemma [rule_format]:
paulson@11251
   327
     "evs \<in> yahalom
paulson@11251
   328
      ==> Key K \<notin> analz (knows Spy evs) -->
paulson@11251
   329
          Crypt K (Nonce NB) \<in> parts (knows Spy evs) -->
paulson@11251
   330
          Crypt (shrK B) {|Agent A, Key K|} \<in> parts (knows Spy evs) -->
paulson@11251
   331
          B \<notin> bad -->
paulson@11251
   332
          (\<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs)"
paulson@11251
   333
apply (erule yahalom.induct, force,
paulson@11251
   334
       frule_tac [6] YM4_parts_knows_Spy)
paulson@11251
   335
apply (analz_mono_contra, simp_all)
paulson@14207
   336
txt{*Fake*}
paulson@11251
   337
apply blast
paulson@14207
   338
txt{*YM3: by @{text new_keys_not_used}, the message
paulson@14207
   339
   @{term "Crypt K (Nonce NB)"} could not exist*}
paulson@11251
   340
apply (force dest!: Crypt_imp_keysFor)
paulson@14207
   341
txt{*YM4: was @{term "Crypt K (Nonce NB)"} the very last message?
paulson@14207
   342
    If not, use the induction hypothesis*}
paulson@11251
   343
apply (simp add: ex_disj_distrib)
paulson@14207
   344
txt{*yes: apply unicity of session keys*}
paulson@11251
   345
apply (blast dest!: Gets_imp_Says A_trusts_YM3 B_trusts_YM4_shrK
paulson@11251
   346
                    Crypt_Spy_analz_bad
paulson@11251
   347
             dest: Says_imp_knows_Spy [THEN parts.Inj] unique_session_keys)
paulson@11251
   348
done
paulson@11251
   349
paulson@14207
   350
text{*If B receives YM4 then A has used nonce NB (and therefore is alive).
paulson@11251
   351
  Moreover, A associates K with NB (thus is talking about the same run).
paulson@14207
   352
  Other premises guarantee secrecy of K.*}
paulson@11251
   353
lemma YM4_imp_A_Said_YM3 [rule_format]:
paulson@11251
   354
     "[| Gets B {|Crypt (shrK B) {|Agent A, Key K|},
paulson@11251
   355
                  Crypt K (Nonce NB)|} \<in> set evs;
paulson@11251
   356
         Says B Server
paulson@11251
   357
           {|Agent B, Nonce NB, Crypt (shrK B) {|Agent A, Nonce NA|}|}
paulson@11251
   358
           \<in> set evs;
paulson@11251
   359
         A \<notin> bad;  B \<notin> bad;  evs \<in> yahalom |]
paulson@11251
   360
      ==> \<exists>X. Says A B {|X, Crypt K (Nonce NB)|} \<in> set evs"
paulson@14207
   361
by (blast intro!: A_Said_YM3_lemma
paulson@14207
   362
          dest: Spy_not_see_encrypted_key B_trusts_YM4 Gets_imp_Says)
paulson@6400
   363
paulson@6400
   364
end