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