src/HOL/Auth/Yahalom.ML
author paulson
Fri Oct 18 11:42:41 1996 +0200 (1996-10-18)
changeset 2110 d01151e66cd4
parent 2060 275ef0f28e1f
child 2133 f00a688760b9
permissions -rw-r--r--
Addition of Reveal message
paulson@1995
     1
(*  Title:      HOL/Auth/Yahalom
paulson@1985
     2
    ID:         $Id$
paulson@1985
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1985
     4
    Copyright   1996  University of Cambridge
paulson@1985
     5
paulson@1985
     6
Inductive relation "otway" for the Yahalom protocol.
paulson@1985
     7
paulson@1985
     8
From page 257 of
paulson@1985
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@1985
    10
  Proc. Royal Soc. 426 (1989)
paulson@1985
    11
*)
paulson@1985
    12
paulson@1995
    13
open Yahalom;
paulson@1985
    14
paulson@1985
    15
proof_timing:=true;
paulson@1985
    16
HOL_quantifiers := false;
paulson@1985
    17
paulson@1995
    18
paulson@2013
    19
(*Weak liveness: there are traces that reach the end*)
paulson@1995
    20
paulson@1995
    21
goal thy 
paulson@1995
    22
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
paulson@2032
    23
\        ==> EX X NB K. EX evs: yahalom lost.          \
paulson@1995
    24
\               Says A B {|X, Crypt (Nonce NB) K|} : set_of_list evs";
paulson@1995
    25
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2032
    26
by (rtac (yahalom.Nil RS yahalom.YM1 RS yahalom.YM2 RS yahalom.YM3 RS yahalom.YM4) 2);
paulson@1995
    27
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
paulson@1995
    28
by (ALLGOALS Fast_tac);
paulson@2013
    29
result();
paulson@1995
    30
paulson@1995
    31
paulson@1985
    32
(**** Inductive proofs about yahalom ****)
paulson@1985
    33
paulson@2110
    34
(*Monotonicity*)
paulson@2045
    35
goal thy "!!evs. lost' <= lost ==> yahalom lost' <= yahalom lost";
paulson@2045
    36
by (rtac subsetI 1);
paulson@2045
    37
by (etac yahalom.induct 1);
paulson@2045
    38
by (REPEAT_FIRST
paulson@2045
    39
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
paulson@2045
    40
                              :: yahalom.intrs))));
paulson@2045
    41
qed "yahalom_mono";
paulson@2045
    42
paulson@1985
    43
paulson@1985
    44
(*Nobody sends themselves messages*)
paulson@2051
    45
goal thy "!!evs. evs: yahalom lost ==> ALL A X. Says A A X ~: set_of_list evs";
paulson@2032
    46
by (etac yahalom.induct 1);
paulson@1985
    47
by (Auto_tac());
paulson@1985
    48
qed_spec_mp "not_Says_to_self";
paulson@1985
    49
Addsimps [not_Says_to_self];
paulson@1985
    50
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
paulson@1985
    51
paulson@1985
    52
paulson@1985
    53
(** For reasoning about the encrypted portion of messages **)
paulson@1985
    54
paulson@1995
    55
(*Lets us treat YM4 using a similar argument as for the Fake case.*)
paulson@1995
    56
goal thy "!!evs. Says S A {|Crypt Y (shrK A), X|} : set_of_list evs ==> \
paulson@2032
    57
\                X : analz (sees lost Spy evs)";
paulson@2032
    58
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2032
    59
qed "YM4_analz_sees_Spy";
paulson@1985
    60
paulson@2110
    61
bind_thm ("YM4_parts_sees_Spy",
paulson@2110
    62
          YM4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2110
    63
paulson@2110
    64
(*Relates to both YM4 and Revl*)
paulson@1995
    65
goal thy "!!evs. Says S A {|Crypt {|B, K, NA, NB|} (shrK A), X|} \
paulson@1995
    66
\                  : set_of_list evs ==> \
paulson@2032
    67
\                K : parts (sees lost Spy evs)";
paulson@1985
    68
by (fast_tac (!claset addSEs partsEs
paulson@2032
    69
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2110
    70
qed "YM4_Key_parts_sees_Spy";
paulson@2110
    71
paulson@2110
    72
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
paulson@2110
    73
  harder: the simplifier does less.*)
paulson@2110
    74
val parts_Fake_tac = 
paulson@2110
    75
    forw_inst_tac [("lost","lost")] YM4_parts_sees_Spy 6 THEN
paulson@2110
    76
    forw_inst_tac [("lost","lost")] YM4_Key_parts_sees_Spy 7;
paulson@1985
    77
paulson@2110
    78
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
paulson@2110
    79
fun parts_induct_tac i = SELECT_GOAL
paulson@2110
    80
    (DETERM (etac yahalom.induct 1 THEN parts_Fake_tac THEN
paulson@2110
    81
	     (*Fake message*)
paulson@2110
    82
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2110
    83
					   impOfSubs Fake_parts_insert]
paulson@2110
    84
                                    addss (!simpset)) 2)) THEN
paulson@2110
    85
     (*Base case*)
paulson@2110
    86
     fast_tac (!claset addss (!simpset)) 1 THEN
paulson@2110
    87
     ALLGOALS Asm_simp_tac) i;
paulson@1985
    88
paulson@1985
    89
paulson@2032
    90
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
paulson@2013
    91
    sends messages containing X! **)
paulson@1985
    92
paulson@2110
    93
(*Spy never sees another agent's shared key! (unless it is leaked at start)*)
paulson@1985
    94
goal thy 
paulson@2032
    95
 "!!evs. [| evs : yahalom lost;  A ~: lost |]    \
paulson@2032
    96
\        ==> Key (shrK A) ~: parts (sees lost Spy evs)";
paulson@2110
    97
by (parts_induct_tac 1);
paulson@1985
    98
by (Auto_tac());
paulson@2032
    99
qed "Spy_not_see_shrK";
paulson@1985
   100
paulson@2032
   101
bind_thm ("Spy_not_analz_shrK",
paulson@2032
   102
          [analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
paulson@1985
   103
paulson@2032
   104
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
paulson@1985
   105
paulson@1985
   106
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
paulson@1985
   107
  As usual fast_tac cannot be used because it uses the equalities too soon*)
paulson@1985
   108
val major::prems = 
paulson@2032
   109
goal thy  "[| Key (shrK A) : parts (sees lost Spy evs);       \
paulson@2032
   110
\             evs : yahalom lost;                               \
paulson@2032
   111
\             A:lost ==> R                                  \
paulson@1985
   112
\           |] ==> R";
paulson@2032
   113
by (rtac ccontr 1);
paulson@2032
   114
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
paulson@1985
   115
by (swap_res_tac prems 2);
paulson@1985
   116
by (ALLGOALS (fast_tac (!claset addIs prems)));
paulson@2032
   117
qed "Spy_see_shrK_E";
paulson@1985
   118
paulson@2032
   119
bind_thm ("Spy_analz_shrK_E", 
paulson@2032
   120
          analz_subset_parts RS subsetD RS Spy_see_shrK_E);
paulson@1985
   121
paulson@2032
   122
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
paulson@1985
   123
paulson@1985
   124
paulson@1985
   125
(*** Future keys can't be seen or used! ***)
paulson@1985
   126
paulson@1985
   127
(*Nobody can have SEEN keys that will be generated in the future.
paulson@1985
   128
  This has to be proved anew for each protocol description,
paulson@1985
   129
  but should go by similar reasoning every time.  Hardest case is the
paulson@1985
   130
  standard Fake rule.  
paulson@2110
   131
      The Union over C is essential for the induction! *)
paulson@2032
   132
goal thy "!!evs. evs : yahalom lost ==> \
paulson@1985
   133
\                length evs <= length evs' --> \
paulson@2032
   134
\                          Key (newK evs') ~: (UN C. parts (sees lost C evs))";
paulson@2110
   135
by (parts_induct_tac 1);
paulson@1985
   136
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2032
   137
                                           impOfSubs parts_insert_subset_Un,
paulson@2032
   138
                                           Suc_leD]
paulson@2032
   139
                                    addss (!simpset))));
paulson@1985
   140
val lemma = result();
paulson@1985
   141
paulson@1985
   142
(*Variant needed for the main theorem below*)
paulson@1985
   143
goal thy 
paulson@2032
   144
 "!!evs. [| evs : yahalom lost;  length evs <= length evs' |]    \
paulson@2032
   145
\        ==> Key (newK evs') ~: parts (sees lost C evs)";
paulson@1985
   146
by (fast_tac (!claset addDs [lemma]) 1);
paulson@1985
   147
qed "new_keys_not_seen";
paulson@1985
   148
Addsimps [new_keys_not_seen];
paulson@1985
   149
paulson@1985
   150
(*Another variant: old messages must contain old keys!*)
paulson@1985
   151
goal thy 
paulson@1985
   152
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@1985
   153
\           Key (newK evt) : parts {X};    \
paulson@2032
   154
\           evs : yahalom lost                 \
paulson@1985
   155
\        |] ==> length evt < length evs";
paulson@2032
   156
by (rtac ccontr 1);
paulson@2032
   157
by (dtac leI 1);
paulson@2032
   158
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
paulson@2013
   159
                      addIs  [impOfSubs parts_mono]) 1);
paulson@1985
   160
qed "Says_imp_old_keys";
paulson@1985
   161
paulson@1985
   162
paulson@1985
   163
(*Nobody can have USED keys that will be generated in the future.
paulson@1985
   164
  ...very like new_keys_not_seen*)
paulson@2032
   165
goal thy "!!evs. evs : yahalom lost ==> \
paulson@1985
   166
\                length evs <= length evs' --> \
paulson@2032
   167
\                newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
paulson@2110
   168
by (parts_induct_tac 1);
paulson@2110
   169
by (dresolve_tac [YM4_Key_parts_sees_Spy] 5);
paulson@2110
   170
paulson@1995
   171
(*YM1, YM2 and YM3*)
paulson@1995
   172
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,3,2]));
paulson@1995
   173
(*Fake and YM4: these messages send unknown (X) components*)
paulson@1995
   174
by (stac insert_commute 2);
paulson@1995
   175
by (Simp_tac 2);
paulson@1995
   176
(*YM4: the only way K could have been used is if it had been seen,
paulson@1995
   177
  contradicting new_keys_not_seen*)
paulson@2110
   178
by (REPEAT
paulson@1985
   179
     (best_tac
paulson@2026
   180
      (!claset addDs [impOfSubs analz_subset_parts,
paulson@2032
   181
                      impOfSubs (analz_subset_parts RS keysFor_mono),
paulson@2032
   182
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
paulson@2032
   183
                      Suc_leD]
paulson@2032
   184
               addEs [new_keys_not_seen RSN(2,rev_notE)]
paulson@2110
   185
               addss (!simpset)) 1));
paulson@1985
   186
val lemma = result();
paulson@1985
   187
paulson@1985
   188
goal thy 
paulson@2032
   189
 "!!evs. [| evs : yahalom lost;  length evs <= length evs' |]    \
paulson@2032
   190
\        ==> newK evs' ~: keysFor (parts (sees lost C evs))";
paulson@1985
   191
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
paulson@1985
   192
qed "new_keys_not_used";
paulson@1985
   193
paulson@1985
   194
bind_thm ("new_keys_not_analzd",
paulson@2032
   195
          [analz_subset_parts RS keysFor_mono,
paulson@2032
   196
           new_keys_not_used] MRS contra_subsetD);
paulson@1985
   197
paulson@1985
   198
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@1985
   199
paulson@1985
   200
paulson@2110
   201
(*Describes the form of Key K when the following message is sent.  The use of
paulson@2110
   202
  "parts" strengthens the induction hyp for proving the Fake case.  The
paulson@2110
   203
  assumption A ~: lost prevents its being a Faked message.  (Based
paulson@2110
   204
  on NS_Shared/Says_S_message_form) *)
paulson@2110
   205
goal thy
paulson@2110
   206
 "!!evs. evs: yahalom lost ==>                                           \
paulson@2110
   207
\        Crypt {|B, Key K, NA, NB|} (shrK A) : parts (sees lost Spy evs)  \
paulson@2110
   208
\        --> A ~: lost --> (EX evt: yahalom lost. K = newK evt)";
paulson@2110
   209
by (parts_induct_tac 1);
paulson@2110
   210
by (Auto_tac());
paulson@2110
   211
qed_spec_mp "Reveal_message_lemma";
paulson@2110
   212
paulson@2110
   213
(*EITHER describes the form of Key K when the following message is sent, 
paulson@2110
   214
  OR     reduces it to the Fake case.*)
paulson@2110
   215
paulson@2110
   216
goal thy 
paulson@2110
   217
 "!!evs. [| Says S A {|Crypt {|B, Key K, NA, NB|} (shrK A), X|} \
paulson@2110
   218
\           : set_of_list evs;                                    \
paulson@2110
   219
\           evs : yahalom lost |]                                 \
paulson@2110
   220
\        ==> (EX evt: yahalom lost. K = newK evt)                 \
paulson@2110
   221
\          | Key K : analz (sees lost Spy evs)";
paulson@2110
   222
br (Reveal_message_lemma RS disjCI) 1;
paulson@2110
   223
ba 1;
paulson@2110
   224
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
paulson@2110
   225
                      addDs [impOfSubs analz_subset_parts]) 1);
paulson@2110
   226
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
paulson@2110
   227
                      addss (!simpset)) 1);
paulson@2110
   228
qed "Reveal_message_form";
paulson@2110
   229
paulson@2110
   230
paulson@2110
   231
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
paulson@2110
   232
val analz_Fake_tac = 
paulson@2110
   233
    dres_inst_tac [("lost","lost")] YM4_analz_sees_Spy 6 THEN
paulson@2110
   234
    forw_inst_tac [("lost","lost")] Reveal_message_form 7;
paulson@1985
   235
paulson@1985
   236
paulson@1985
   237
(****
paulson@1985
   238
 The following is to prove theorems of the form
paulson@1985
   239
paulson@2032
   240
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
paulson@2032
   241
          Key K : analz (sees lost Spy evs)
paulson@1985
   242
paulson@1985
   243
 A more general formula must be proved inductively.
paulson@1985
   244
paulson@1985
   245
****)
paulson@1985
   246
paulson@1985
   247
paulson@1985
   248
(*NOT useful in this form, but it says that session keys are not used
paulson@1985
   249
  to encrypt messages containing other keys, in the actual protocol.
paulson@1985
   250
  We require that agents should behave like this subsequently also.*)
paulson@1985
   251
goal thy 
paulson@2032
   252
 "!!evs. evs : yahalom lost ==> \
paulson@2032
   253
\        (Crypt X (newK evt)) : parts (sees lost Spy evs) & \
paulson@2032
   254
\        Key K : parts {X} --> Key K : parts (sees lost Spy evs)";
paulson@2032
   255
by (etac yahalom.induct 1);
paulson@2110
   256
by parts_Fake_tac;
paulson@2060
   257
by (ALLGOALS Asm_simp_tac);
paulson@1985
   258
(*Deals with Faked messages*)
paulson@2110
   259
by (best_tac (!claset addSEs partsEs
paulson@2110
   260
                      addDs [impOfSubs parts_insert_subset_Un]
paulson@2110
   261
                      addss (!simpset)) 2);
paulson@1995
   262
(*Base case*)
paulson@1985
   263
by (Auto_tac());
paulson@1985
   264
result();
paulson@1985
   265
paulson@1985
   266
paulson@1985
   267
(** Session keys are not used to encrypt other session keys **)
paulson@1985
   268
paulson@1985
   269
goal thy  
paulson@2032
   270
 "!!evs. evs : yahalom lost ==> \
paulson@2032
   271
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
paulson@2032
   272
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
paulson@2032
   273
by (etac yahalom.induct 1);
paulson@2110
   274
by analz_Fake_tac;
paulson@2045
   275
by (REPEAT_FIRST (resolve_tac [allI, analz_image_newK_lemma]));
paulson@2110
   276
by (REPEAT ((eresolve_tac [bexE, disjE] ORELSE' hyp_subst_tac) 8));
paulson@2110
   277
by (ALLGOALS  (*Takes 26 secs*)
paulson@1985
   278
    (asm_simp_tac 
paulson@1985
   279
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
paulson@2032
   280
                         @ pushes)
paulson@1985
   281
               setloop split_tac [expand_if])));
paulson@2110
   282
(** LEVEL 5 **)
paulson@2110
   283
(*Reveal case 2, YM4, Fake*) 
paulson@2110
   284
by (EVERY (map spy_analz_tac [6, 4, 2]));
paulson@2110
   285
(*Reveal case 1, YM3, Base*)
paulson@2110
   286
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
paulson@1985
   287
qed_spec_mp "analz_image_newK";
paulson@1985
   288
paulson@1985
   289
goal thy
paulson@2032
   290
 "!!evs. evs : yahalom lost ==>                               \
paulson@2032
   291
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
paulson@2032
   292
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
paulson@1985
   293
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
paulson@2032
   294
                                   insert_Key_singleton]) 1);
paulson@1985
   295
by (Fast_tac 1);
paulson@1985
   296
qed "analz_insert_Key_newK";
paulson@1985
   297
paulson@1985
   298
paulson@2110
   299
(*** The Key K uniquely identifies the Server's  message. **)
paulson@2110
   300
paulson@2110
   301
goal thy 
paulson@2110
   302
 "!!evs. evs : yahalom lost ==>                                     \
paulson@2110
   303
\      EX A' B' NA' NB'. ALL A B NA NB.                             \
paulson@2110
   304
\          Says Server A                                            \
paulson@2110
   305
\           {|Crypt {|Agent B, Key K, NA, NB|} (shrK A),            \
paulson@2110
   306
\             Crypt {|Agent A, Key K|} (shrK B)|}                   \
paulson@2110
   307
\          : set_of_list evs --> A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2110
   308
by (etac yahalom.induct 1);
paulson@2110
   309
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
paulson@2110
   310
by (Step_tac 1);
paulson@2110
   311
(*Remaining case: YM3*)
paulson@2110
   312
by (expand_case_tac "K = ?y" 1);
paulson@2110
   313
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
paulson@2110
   314
(*...we assume X is a very new message, and handle this case by contradiction*)
paulson@2110
   315
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2110
   316
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
paulson@2110
   317
                      addss (!simpset addsimps [parts_insertI])) 1);
paulson@2110
   318
val lemma = result();
paulson@2110
   319
paulson@2110
   320
goal thy 
paulson@2110
   321
"!!evs. [| Says Server A                                            \
paulson@2110
   322
\           {|Crypt {|Agent B, Key K, NA, NB|} (shrK A),            \
paulson@2110
   323
\             Crypt {|Agent A, Key K|} (shrK B)|}                   \
paulson@2110
   324
\           : set_of_list evs;                                      \
paulson@2110
   325
\          Says Server A'                                           \
paulson@2110
   326
\           {|Crypt {|Agent B', Key K, NA', NB'|} (shrK A'),        \
paulson@2110
   327
\             Crypt {|Agent A', Key K|} (shrK B')|}                 \
paulson@2110
   328
\           : set_of_list evs;                                      \
paulson@2110
   329
\          evs : yahalom lost |]                                    \
paulson@2110
   330
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2110
   331
by (dtac lemma 1);
paulson@2110
   332
by (REPEAT (etac exE 1));
paulson@2110
   333
(*Duplicate the assumption*)
paulson@2110
   334
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2110
   335
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2110
   336
qed "unique_session_keys";
paulson@2110
   337
paulson@2110
   338
paulson@2110
   339
(*If the encrypted message appears then it originated with the Server*)
paulson@2110
   340
goal thy
paulson@2110
   341
 "!!evs. [| Crypt {|Agent B, Key K, NA, NB|} (shrK A)                  \
paulson@2110
   342
\            : parts (sees lost Spy evs);                              \
paulson@2110
   343
\           A ~: lost;  evs : yahalom lost |]                          \
paulson@2110
   344
\         ==> Says Server A                                            \
paulson@2110
   345
\              {|Crypt {|Agent B, Key K, NA, NB|} (shrK A),            \
paulson@2110
   346
\                Crypt {|Agent A, Key K|} (shrK B)|}                   \
paulson@2110
   347
\             : set_of_list evs";
paulson@2110
   348
by (etac rev_mp 1);
paulson@2110
   349
by (parts_induct_tac 1);
paulson@2110
   350
qed "A_trust_YM3";
paulson@2110
   351
paulson@2110
   352
paulson@2013
   353
(*Describes the form of K when the Server sends this message.*)
paulson@1985
   354
goal thy 
paulson@1995
   355
 "!!evs. [| Says Server A                                           \
paulson@1995
   356
\            {|Crypt {|Agent B, K, NA, NB|} (shrK A),               \
paulson@1995
   357
\              Crypt {|Agent A, K|} (shrK B)|} : set_of_list evs;   \
paulson@2110
   358
\           evs : yahalom lost |]                                   \
paulson@2032
   359
\        ==> (EX evt: yahalom lost. K = Key(newK evt))";
paulson@2032
   360
by (etac rev_mp 1);
paulson@2032
   361
by (etac yahalom.induct 1);
paulson@2013
   362
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
paulson@1985
   363
qed "Says_Server_message_form";
paulson@1985
   364
paulson@1985
   365
paulson@2110
   366
(** Crucial secrecy property: Spy does not see the keys sent in msg YM3 **)
paulson@2013
   367
paulson@2013
   368
goal thy 
paulson@2051
   369
 "!!evs. [| A ~: lost;  B ~: lost;                                \
paulson@2051
   370
\           evs : yahalom lost;  evt : yahalom lost |]            \
paulson@2051
   371
\        ==> Says Server A                                        \
paulson@2051
   372
\              {|Crypt {|Agent B, Key K, NA, NB|} (shrK A),       \
paulson@2051
   373
\                Crypt {|Agent A, Key K|} (shrK B)|}              \
paulson@2110
   374
\             : set_of_list evs -->                               \
paulson@2110
   375
\            Says A Spy {|NA, NB, Key K|} ~: set_of_list evs -->  \
paulson@2051
   376
\            Key K ~: analz (sees lost Spy evs)";
paulson@2032
   377
by (etac yahalom.induct 1);
paulson@2110
   378
by analz_Fake_tac;
paulson@2110
   379
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
paulson@2013
   380
by (ALLGOALS
paulson@2013
   381
    (asm_simp_tac 
paulson@2013
   382
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
paulson@2032
   383
                          analz_insert_Key_newK] @ pushes)
paulson@2013
   384
               setloop split_tac [expand_if])));
paulson@2013
   385
(*YM3*)
paulson@2013
   386
by (fast_tac (!claset addIs [parts_insertI]
paulson@2032
   387
                      addEs [Says_imp_old_keys RS less_irrefl]
paulson@2032
   388
                      addss (!simpset)) 2);
paulson@2110
   389
(*Reveal case 2, OR4, Fake*) 
paulson@2110
   390
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
paulson@2110
   391
(*Reveal case 1*) (** LEVEL 6 **)
paulson@2110
   392
by (case_tac "Aa : lost" 1);
paulson@2110
   393
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
paulson@2110
   394
by (dtac (Says_imp_sees_Spy RS analz.Inj) 1);
paulson@2110
   395
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
paulson@2110
   396
(*So now we have  Aa ~: lost *)
paulson@2110
   397
bd (Says_imp_sees_Spy RS parts.Inj) 1;
paulson@2110
   398
by (fast_tac (!claset delrules [disjE] 
paulson@2110
   399
	              addSEs [MPair_parts]
paulson@2110
   400
		      addDs [A_trust_YM3, unique_session_keys]
paulson@2110
   401
	              addss (!simpset)) 1);
paulson@2110
   402
val lemma = result() RS mp RS mp RSN(2,rev_notE);
paulson@2013
   403
paulson@2013
   404
paulson@2013
   405
(*Final version: Server's message in the most abstract form*)
paulson@1985
   406
goal thy 
paulson@2110
   407
 "!!evs. [| Says Server A                                               \
paulson@1995
   408
\            {|Crypt {|Agent B, K, NA, NB|} (shrK A),                   \
paulson@1995
   409
\              Crypt {|Agent A, K|} (shrK B)|} : set_of_list evs;       \
paulson@2110
   410
\           Says A Spy {|NA, NB, K|} ~: set_of_list evs;                \
paulson@2110
   411
\           A ~: lost;  B ~: lost;  evs : yahalom lost |] ==>           \
paulson@2032
   412
\     K ~: analz (sees lost Spy evs)";
paulson@2013
   413
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
paulson@2013
   414
by (fast_tac (!claset addSEs [lemma]) 1);
paulson@2032
   415
qed "Spy_not_see_encrypted_key";
paulson@2001
   416
paulson@2001
   417
paulson@2045
   418
goal thy 
paulson@2045
   419
 "!!evs. [| C ~: {A,B,Server};                                          \
paulson@2045
   420
\           Says Server A                                               \
paulson@2045
   421
\            {|Crypt {|Agent B, K, NA, NB|} (shrK A),                   \
paulson@2045
   422
\              Crypt {|Agent A, K|} (shrK B)|} : set_of_list evs;       \
paulson@2110
   423
\           Says A Spy {|NA, NB, K|} ~: set_of_list evs;                \
paulson@2045
   424
\           A ~: lost;  B ~: lost;  evs : yahalom lost |] ==>           \
paulson@2045
   425
\     K ~: analz (sees lost C evs)";
paulson@2045
   426
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
paulson@2045
   427
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
paulson@2045
   428
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
paulson@2045
   429
by (REPEAT_FIRST (fast_tac (!claset addIs [yahalom_mono RS subsetD])));
paulson@2045
   430
qed "Agent_not_see_encrypted_key";
paulson@2045
   431
paulson@2045
   432
paulson@2110
   433
(*** Security Guarantee for B upon receiving YM4 ***)
paulson@2013
   434
paulson@2110
   435
(*B knows, by the first part of A's message, that the Server distributed 
paulson@2110
   436
  the key for A and B.  But this part says nothing about nonces.*)
paulson@2001
   437
goal thy 
paulson@2032
   438
 "!!evs. [| Crypt {|Agent A, Key K|} (shrK B) : parts (sees lost Spy evs); \
paulson@2051
   439
\           B ~: lost;  evs : yahalom lost |]                           \
paulson@2001
   440
\        ==> EX NA NB. Says Server A                                    \
paulson@2013
   441
\                        {|Crypt {|Agent B, Key K,                      \
paulson@2013
   442
\                                  Nonce NA, Nonce NB|} (shrK A),       \
paulson@2013
   443
\                          Crypt {|Agent A, Key K|} (shrK B)|}          \
paulson@2013
   444
\                       : set_of_list evs";
paulson@2032
   445
by (etac rev_mp 1);
paulson@2110
   446
by (parts_induct_tac 1);
paulson@2110
   447
(*YM3*)
paulson@2110
   448
by (Fast_tac 1);
paulson@2110
   449
qed "B_trusts_YM4_shrK";
paulson@2110
   450
paulson@2110
   451
(*B knows, by the second part of A's message, that the Server distributed 
paulson@2110
   452
  the key quoting nonce NB.  This part says nothing about agent names.*)
paulson@2110
   453
goal thy 
paulson@2110
   454
 "!!evs. evs : yahalom lost                                     \
paulson@2110
   455
\        ==> Key K ~: analz (sees lost Spy evs) -->             \
paulson@2110
   456
\            Crypt (Nonce NB) K : parts (sees lost Spy evs) --> \
paulson@2110
   457
\            (EX A B NA. Says Server A                                  \
paulson@2110
   458
\                        {|Crypt {|Agent B, Key K,                      \
paulson@2110
   459
\                                  Nonce NA, Nonce NB|} (shrK A),       \
paulson@2110
   460
\                          Crypt {|Agent A, Key K|} (shrK B)|}          \
paulson@2110
   461
\                       : set_of_list evs)";
paulson@2032
   462
by (etac yahalom.induct 1);
paulson@2110
   463
by parts_Fake_tac;
paulson@2001
   464
by (fast_tac (!claset addss (!simpset)) 1);
paulson@2110
   465
by (TRYALL (rtac impI));
paulson@2110
   466
by (REPEAT_FIRST
paulson@2110
   467
    (dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD)));
paulson@2110
   468
by (ALLGOALS Asm_simp_tac);
paulson@2110
   469
(*Fake, YM3, YM4*)
paulson@2110
   470
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert]
paulson@2110
   471
                      addDs [impOfSubs analz_subset_parts]) 1);
paulson@2110
   472
by (Fast_tac 1);
paulson@2110
   473
(*YM4*)
paulson@2110
   474
by (Step_tac 1);
paulson@2110
   475
by (case_tac "A : lost" 1);
paulson@2110
   476
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
paulson@2110
   477
by (dtac (Says_imp_sees_Spy RS analz.Inj) 1);
paulson@2110
   478
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1);
paulson@2110
   479
by (fast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj RS parts.Fst RS
paulson@2110
   480
			     A_trust_YM3]) 1);
paulson@2110
   481
val B_trusts_YM4_newK = result() RS mp RSN (2, rev_mp);
paulson@2001
   482
paulson@2110
   483
(*What can B deduce from receipt of YM4?  Note how the two components of
paulson@2110
   484
  the message contribute to a single conclusion about the Server's message.
paulson@2110
   485
  It's annoying that the "Says A Spy" assumption must quantify over 
paulson@2110
   486
  ALL POSSIBLE nonces instead of our particular NB.  Perhaps a different
paulson@2110
   487
  proof of B_trusts_YM4_newK could eliminate this problem.*)
paulson@2001
   488
goal thy 
paulson@2001
   489
 "!!evs. [| Says A' B {|Crypt {|Agent A, Key K|} (shrK B),              \
paulson@2001
   490
\                       Crypt (Nonce NB) K|} : set_of_list evs;         \
paulson@2110
   491
\           ALL N N'. Says A Spy {|N,N', Key K|} ~: set_of_list evs;    \
paulson@2110
   492
\           A ~: lost;  B ~: lost;  evs : yahalom lost |]               \
paulson@2110
   493
\        ==> EX NA. Says Server A                                       \
paulson@2001
   494
\                     {|Crypt {|Agent B, Key K,                         \
paulson@2001
   495
\                               Nonce NA, Nonce NB|} (shrK A),          \
paulson@2001
   496
\                       Crypt {|Agent A, Key K|} (shrK B)|}             \
paulson@2001
   497
\                   : set_of_list evs";
paulson@2110
   498
be (Says_imp_sees_Spy RS parts.Inj RS MPair_parts) 1;
paulson@2110
   499
bd B_trusts_YM4_shrK 1;
paulson@2110
   500
bd B_trusts_YM4_newK 3;
paulson@2110
   501
by (REPEAT_FIRST (eresolve_tac [asm_rl, exE]));
paulson@2110
   502
by (fast_tac (!claset addDs [unique_session_keys]) 2);
paulson@2110
   503
by (fast_tac (!claset addDs [Spy_not_see_encrypted_key]) 1);
paulson@2110
   504
qed "B_trust_YM4";