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