src/HOL/Auth/Recur.ML
author paulson
Thu Sep 23 13:06:31 1999 +0200 (1999-09-23)
changeset 7584 5be4bb8e4e3f
parent 7499 23e090051cb8
child 10833 c0844a30ea4e
permissions -rw-r--r--
tidied; added lemma restrict_to_left
paulson@2449
     1
(*  Title:      HOL/Auth/Recur
paulson@2449
     2
    ID:         $Id$
paulson@2449
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2449
     4
    Copyright   1996  University of Cambridge
paulson@2449
     5
paulson@2449
     6
Inductive relation "recur" for the Recursive Authentication protocol.
paulson@2449
     7
*)
paulson@2449
     8
paulson@2516
     9
Pretty.setdepth 30;
paulson@2449
    10
paulson@5359
    11
AddEs spies_partsEs;
paulson@5359
    12
AddDs [impOfSubs analz_subset_parts];
paulson@5359
    13
AddDs [impOfSubs Fake_parts_insert];
paulson@5359
    14
paulson@5359
    15
paulson@2449
    16
(** Possibility properties: traces that reach the end 
paulson@2516
    17
        ONE theorem would be more elegant and faster!
paulson@2516
    18
        By induction on a list of agents (no repetitions)
paulson@2449
    19
**)
paulson@2449
    20
paulson@2516
    21
paulson@2449
    22
(*Simplest case: Alice goes directly to the server*)
paulson@5434
    23
Goal "EX K NA. EX evs: recur.                                           \
paulson@5434
    24
\  Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|},   \
paulson@5434
    25
\                  END|}  : set evs";
paulson@2449
    26
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@5434
    27
by (rtac (recur.Nil RS recur.RA1 RS (respond.One RSN (3,recur.RA3))) 2);
paulson@2516
    28
by possibility_tac;
paulson@2449
    29
result();
paulson@2449
    30
paulson@2449
    31
paulson@2449
    32
(*Case two: Alice, Bob and the server*)
paulson@5434
    33
Goal "EX K. EX NA. EX evs: recur.                               \
paulson@5434
    34
\       Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \
paulson@5434
    35
\                  END|}  : set evs";
paulson@2516
    36
by (cut_facts_tac [Nonce_supply2, Key_supply2] 1);
paulson@2516
    37
by (REPEAT (eresolve_tac [exE, conjE] 1));
paulson@2449
    38
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2451
    39
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS 
paulson@5434
    40
          (respond.One RS respond.Cons RSN (3,recur.RA3)) RS
paulson@2516
    41
          recur.RA4) 2);
paulson@2516
    42
by basic_possibility_tac;
paulson@5351
    43
by (DEPTH_SOLVE (eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1));
paulson@2449
    44
result();
paulson@2449
    45
paulson@2449
    46
paulson@2516
    47
(*Case three: Alice, Bob, Charlie and the server
paulson@2533
    48
  TOO SLOW to run every time!
paulson@5434
    49
Goal "EX K. EX NA. EX evs: recur.                                      \
paulson@5434
    50
\       Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|},        \
paulson@5434
    51
\                  END|}  : set evs";
paulson@2516
    52
by (cut_facts_tac [Nonce_supply3, Key_supply3] 1);
paulson@2516
    53
by (REPEAT (eresolve_tac [exE, conjE] 1));
paulson@2449
    54
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2451
    55
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS recur.RA2 RS 
paulson@2516
    56
          (respond.One RS respond.Cons RS respond.Cons RSN
paulson@5434
    57
           (3,recur.RA3)) RS recur.RA4 RS recur.RA4) 2);
paulson@5434
    58
(*SLOW: 33 seconds*)
paulson@2516
    59
by basic_possibility_tac;
paulson@2516
    60
by (DEPTH_SOLVE (swap_res_tac [refl, conjI, disjCI] 1 
paulson@2516
    61
		 ORELSE
paulson@5351
    62
		 eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1));
paulson@2449
    63
result();
paulson@2516
    64
****************)
paulson@2449
    65
paulson@2449
    66
(**** Inductive proofs about recur ****)
paulson@2449
    67
paulson@2516
    68
paulson@5114
    69
Goal "(PA,RB,KAB) : respond evs ==> Key KAB : parts{RB}";
paulson@2516
    70
by (etac respond.induct 1);
paulson@2516
    71
by (ALLGOALS Simp_tac);
paulson@2516
    72
qed "respond_Key_in_parts";
paulson@2516
    73
paulson@5114
    74
Goal "(PA,RB,KAB) : respond evs ==> Key KAB ~: used evs";
paulson@2516
    75
by (etac respond.induct 1);
paulson@2516
    76
by (REPEAT (assume_tac 1));
paulson@2516
    77
qed "respond_imp_not_used";
paulson@2516
    78
paulson@5114
    79
Goal "[| Key K : parts {RB};  (PB,RB,K') : respond evs |] \
paulson@5114
    80
\     ==> Key K ~: used evs";
paulson@2516
    81
by (etac rev_mp 1);
paulson@2516
    82
by (etac respond.induct 1);
wenzelm@4091
    83
by (auto_tac(claset() addDs [Key_not_used, respond_imp_not_used],
wenzelm@4091
    84
             simpset()));
paulson@2516
    85
qed_spec_mp "Key_in_parts_respond";
paulson@2516
    86
paulson@2449
    87
(*Simple inductive reasoning about responses*)
paulson@5114
    88
Goal "(PA,RB,KAB) : respond evs ==> RB : responses evs";
paulson@2449
    89
by (etac respond.induct 1);
paulson@2516
    90
by (REPEAT (ares_tac (respond_imp_not_used::responses.intrs) 1));
paulson@2449
    91
qed "respond_imp_responses";
paulson@2449
    92
paulson@2449
    93
paulson@2449
    94
(** For reasoning about the encrypted portion of messages **)
paulson@2449
    95
paulson@3683
    96
val RA2_analz_spies = Says_imp_spies RS analz.Inj |> standard;
paulson@2449
    97
paulson@5359
    98
Goal "Says C' B {|Crypt K X, X', RA|} : set evs ==> RA : analz (spies evs)";
wenzelm@4091
    99
by (blast_tac (claset() addSDs [Says_imp_spies RS analz.Inj]) 1);
paulson@3683
   100
qed "RA4_analz_spies";
paulson@2449
   101
paulson@2451
   102
(*RA2_analz... and RA4_analz... let us treat those cases using the same 
paulson@2449
   103
  argument as for the Fake case.  This is possible for most, but not all,
paulson@2451
   104
  proofs: Fake does not invent new nonces (as in RA2), and of course Fake
paulson@2449
   105
  messages originate from the Spy. *)
paulson@2449
   106
paulson@3683
   107
bind_thm ("RA2_parts_spies",
paulson@3683
   108
          RA2_analz_spies RS (impOfSubs analz_subset_parts));
paulson@3683
   109
bind_thm ("RA4_parts_spies",
paulson@3683
   110
          RA4_analz_spies RS (impOfSubs analz_subset_parts));
paulson@2449
   111
paulson@3683
   112
(*For proving the easier theorems about X ~: parts (spies evs).*)
paulson@3519
   113
fun parts_induct_tac i = 
paulson@5359
   114
  EVERY [etac recur.induct i,
wenzelm@7499
   115
	 ftac RA4_parts_spies (i+5),
wenzelm@7499
   116
	 ftac respond_imp_responses (i+4),
wenzelm@7499
   117
	 ftac RA2_parts_spies (i+3),
paulson@5359
   118
	 prove_simple_subgoals_tac i];
paulson@2449
   119
paulson@2449
   120
paulson@3683
   121
(** Theorems of the form X ~: parts (spies evs) imply that NOBODY
paulson@2449
   122
    sends messages containing X! **)
paulson@2449
   123
paulson@2449
   124
paulson@3683
   125
(** Spy never sees another agent's shared key! (unless it's bad at start) **)
paulson@2449
   126
paulson@5114
   127
Goal "evs : recur ==> (Key (shrK A) : parts (spies evs)) = (A : bad)";
paulson@3519
   128
by (parts_induct_tac 1);
paulson@5359
   129
by Auto_tac;
paulson@2550
   130
(*RA3*)
paulson@5359
   131
by (auto_tac (claset() addDs [Key_in_parts_respond],
paulson@5359
   132
	      simpset() addsimps [parts_insert_spies]));
paulson@2449
   133
qed "Spy_see_shrK";
paulson@2449
   134
Addsimps [Spy_see_shrK];
paulson@2449
   135
paulson@5114
   136
Goal "evs : recur ==> (Key (shrK A) : analz (spies evs)) = (A : bad)";
paulson@5359
   137
by Auto_tac;
paulson@2449
   138
qed "Spy_analz_shrK";
paulson@2449
   139
Addsimps [Spy_analz_shrK];
paulson@2449
   140
paulson@4471
   141
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
paulson@4471
   142
	Spy_analz_shrK RSN (2, rev_iffD1)];
paulson@2449
   143
paulson@2516
   144
paulson@2516
   145
(** Nobody can have used non-existent keys! **)
paulson@2449
   146
paulson@4509
   147
(*The special case of H={} has the same proof*)
paulson@5359
   148
Goal "[| K : keysFor (parts (insert RB H));  RB : responses evs |] \
paulson@5114
   149
\     ==> K : range shrK | K : keysFor (parts H)";
paulson@2516
   150
by (etac rev_mp 1);
paulson@5359
   151
by (etac responses.induct 1);
paulson@4477
   152
by Auto_tac;
paulson@2516
   153
qed_spec_mp "Key_in_keysFor_parts";
paulson@2449
   154
paulson@2449
   155
paulson@5359
   156
Goal "evs : recur ==> Key K ~: used evs --> K ~: keysFor (parts (spies evs))";
paulson@3519
   157
by (parts_induct_tac 1);
paulson@2451
   158
(*RA3*)
paulson@4509
   159
by (blast_tac (claset() addSDs [Key_in_keysFor_parts]) 2);
paulson@2516
   160
(*Fake*)
paulson@4509
   161
by (blast_tac (claset() addSDs [keysFor_parts_insert]) 1);
paulson@2449
   162
qed_spec_mp "new_keys_not_used";
paulson@2449
   163
paulson@2449
   164
paulson@2449
   165
bind_thm ("new_keys_not_analzd",
paulson@2449
   166
          [analz_subset_parts RS keysFor_mono,
paulson@2449
   167
           new_keys_not_used] MRS contra_subsetD);
paulson@2449
   168
paulson@2449
   169
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@2449
   170
paulson@2449
   171
paulson@2449
   172
paulson@2449
   173
(*** Proofs involving analz ***)
paulson@2449
   174
paulson@3519
   175
(*For proofs involving analz.*)
paulson@3683
   176
val analz_spies_tac = 
paulson@3683
   177
    dtac RA2_analz_spies 4 THEN 
wenzelm@7499
   178
    ftac respond_imp_responses 5                THEN
paulson@3683
   179
    dtac RA4_analz_spies 6;
paulson@2449
   180
paulson@2449
   181
paulson@2449
   182
(** Session keys are not used to encrypt other session keys **)
paulson@2449
   183
paulson@2451
   184
(*Version for "responses" relation.  Handles case RA3 in the theorem below.  
paulson@3683
   185
  Note that it holds for *any* set H (not just "spies evs")
paulson@2449
   186
  satisfying the inductive hypothesis.*)
paulson@5114
   187
Goal "[| RB : responses evs;                             \
paulson@5492
   188
\        ALL K KK. KK <= - (range shrK) -->              \
paulson@5114
   189
\                  (Key K : analz (Key``KK Un H)) =      \
paulson@5114
   190
\                  (K : KK | Key K : analz H) |]         \
paulson@5492
   191
\    ==> ALL K KK. KK <= - (range shrK) -->              \
paulson@5114
   192
\                  (Key K : analz (insert RB (Key``KK Un H))) = \
paulson@5114
   193
\                  (K : KK | Key K : analz (insert RB H))";
paulson@2516
   194
by (etac responses.induct 1);
paulson@2516
   195
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
paulson@2516
   196
qed "resp_analz_image_freshK_lemma";
paulson@2449
   197
paulson@2449
   198
(*Version for the protocol.  Proof is almost trivial, thanks to the lemma.*)
paulson@5114
   199
Goal "evs : recur ==>                                 \
paulson@5492
   200
\  ALL K KK. KK <= - (range shrK) -->                 \
paulson@5114
   201
\         (Key K : analz (Key``KK Un (spies evs))) =  \
paulson@5114
   202
\         (K : KK | Key K : analz (spies evs))";
paulson@2449
   203
by (etac recur.induct 1);
paulson@3683
   204
by analz_spies_tac;
paulson@2516
   205
by (REPEAT_FIRST (resolve_tac [allI, impI]));
paulson@4552
   206
by (REPEAT_FIRST (rtac analz_image_freshK_lemma));
paulson@2516
   207
by (ALLGOALS 
paulson@2516
   208
    (asm_simp_tac
paulson@2516
   209
     (analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma])));
paulson@3451
   210
(*Fake*) 
paulson@3451
   211
by (spy_analz_tac 1);
paulson@2516
   212
val raw_analz_image_freshK = result();
paulson@2516
   213
qed_spec_mp "analz_image_freshK";
paulson@2449
   214
paulson@2449
   215
paulson@3683
   216
(*Instance of the lemma with H replaced by (spies evs):
paulson@3519
   217
   [| RB : responses evs;  evs : recur; |]
paulson@5492
   218
   ==> KK <= - (range shrK) --> 
paulson@3683
   219
       Key K : analz (insert RB (Key``KK Un spies evs)) =
paulson@3683
   220
       (K : KK | Key K : analz (insert RB (spies evs))) 
paulson@2449
   221
*)
paulson@2516
   222
bind_thm ("resp_analz_image_freshK",
paulson@2516
   223
          raw_analz_image_freshK RSN
paulson@3961
   224
            (2, resp_analz_image_freshK_lemma) RS spec RS spec RS mp);
paulson@2449
   225
paulson@5114
   226
Goal "[| evs : recur;  KAB ~: range shrK |] ==>           \
paulson@5114
   227
\     Key K : analz (insert (Key KAB) (spies evs)) =      \
paulson@5114
   228
\     (K = KAB | Key K : analz (spies evs))";
paulson@2516
   229
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
paulson@2516
   230
qed "analz_insert_freshK";
paulson@2449
   231
paulson@2449
   232
paulson@2516
   233
(*Everything that's hashed is already in past traffic. *)
paulson@5114
   234
Goal "[| Hash {|Key(shrK A), X|} : parts (spies evs);  \
paulson@5359
   235
\        evs : recur;  A ~: bad |] ==> X : parts (spies evs)";
paulson@2550
   236
by (etac rev_mp 1);
paulson@3519
   237
by (parts_induct_tac 1);
paulson@2451
   238
(*RA3 requires a further induction*)
paulson@3121
   239
by (etac responses.induct 2);
paulson@2449
   240
by (ALLGOALS Asm_simp_tac);
paulson@2449
   241
(*Fake*)
paulson@5434
   242
by (blast_tac (claset() addIs [parts_insertI]) 1);
paulson@2550
   243
qed "Hash_imp_body";
paulson@2449
   244
paulson@2449
   245
paulson@2449
   246
(** The Nonce NA uniquely identifies A's message. 
paulson@2516
   247
    This theorem applies to steps RA1 and RA2!
paulson@2455
   248
paulson@2455
   249
  Unicity is not used in other proofs but is desirable in its own right.
paulson@2449
   250
**)
paulson@2449
   251
paulson@5114
   252
Goal "[| evs : recur; A ~: bad |]                   \
paulson@2560
   253
\ ==> EX B' P'. ALL B P.                                     \
paulson@5114
   254
\     Hash {|Key(shrK A), Agent A, B, NA, P|} : parts (spies evs) \
paulson@5114
   255
\       -->  B=B' & P=P'";
paulson@3519
   256
by (parts_induct_tac 1);
paulson@5359
   257
by (Blast_tac 1);
paulson@2516
   258
by (etac responses.induct 3);
wenzelm@4091
   259
by (ALLGOALS (simp_tac (simpset() addsimps [all_conj_distrib]))); 
wenzelm@4091
   260
by (clarify_tac (claset() addSEs partsEs) 1);
paulson@2516
   261
(*RA1,2: creation of new Nonce.  Move assertion into global context*)
paulson@2516
   262
by (ALLGOALS (expand_case_tac "NA = ?y"));
paulson@2516
   263
by (REPEAT_FIRST (ares_tac [exI]));
paulson@5359
   264
by (REPEAT (blast_tac (claset() addSDs [Hash_imp_body]) 1));
paulson@2449
   265
val lemma = result();
paulson@2449
   266
paulson@5076
   267
Goalw [HPair_def]
paulson@5114
   268
 "[| Hash[Key(shrK A)] {|Agent A, B,NA,P|}   : parts (spies evs); \
paulson@5114
   269
\     Hash[Key(shrK A)] {|Agent A, B',NA,P'|} : parts (spies evs); \
paulson@5114
   270
\     evs : recur;  A ~: bad |]                                    \
paulson@5114
   271
\   ==> B=B' & P=P'";
paulson@2481
   272
by (REPEAT (eresolve_tac partsEs 1));
paulson@2449
   273
by (prove_unique_tac lemma 1);
paulson@2449
   274
qed "unique_NA";
paulson@2449
   275
paulson@2449
   276
paulson@2449
   277
(*** Lemmas concerning the Server's response
paulson@2449
   278
      (relations "respond" and "responses") 
paulson@2449
   279
***)
paulson@2449
   280
paulson@5114
   281
Goal "[| RB : responses evs;  evs : recur |] \
paulson@3683
   282
\ ==> (Key (shrK B) : analz (insert RB (spies evs))) = (B:bad)";
paulson@2516
   283
by (etac responses.induct 1);
paulson@2449
   284
by (ALLGOALS
paulson@2449
   285
    (asm_simp_tac 
paulson@2516
   286
     (analz_image_freshK_ss addsimps [Spy_analz_shrK,
paulson@2516
   287
                                      resp_analz_image_freshK])));
paulson@2449
   288
qed "shrK_in_analz_respond";
paulson@2449
   289
Addsimps [shrK_in_analz_respond];
paulson@2449
   290
paulson@2449
   291
paulson@5492
   292
Goal "[| RB : responses evs;                         \
paulson@5492
   293
\        ALL K KK. KK <= - (range shrK) -->          \
paulson@5492
   294
\                  (Key K : analz (Key``KK Un H)) =  \
paulson@5492
   295
\                  (K : KK | Key K : analz H) |]     \
paulson@5492
   296
\    ==> (Key K : analz (insert RB H)) -->           \
paulson@5114
   297
\        (Key K : parts{RB} | Key K : analz H)";
paulson@2516
   298
by (etac responses.induct 1);
paulson@2449
   299
by (ALLGOALS
paulson@2449
   300
    (asm_simp_tac 
paulson@2516
   301
     (analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma])));
paulson@2516
   302
(*Simplification using two distinct treatments of "image"*)
wenzelm@4091
   303
by (simp_tac (simpset() addsimps [parts_insert2]) 1);
wenzelm@4091
   304
by (blast_tac (claset() delrules [allE]) 1);
paulson@2449
   305
qed "resp_analz_insert_lemma";
paulson@2449
   306
paulson@2449
   307
bind_thm ("resp_analz_insert",
paulson@2516
   308
          raw_analz_image_freshK RSN
paulson@2516
   309
            (2, resp_analz_insert_lemma) RSN(2, rev_mp));
paulson@2449
   310
paulson@2449
   311
paulson@2516
   312
(*The last key returned by respond indeed appears in a certificate*)
paulson@5114
   313
Goal "(Hash[Key(shrK A)] {|Agent A, B, NA, P|}, RA, K) : respond evs \
paulson@5114
   314
\   ==> Crypt (shrK A) {|Key K, B, NA|} : parts {RA}";
paulson@2516
   315
by (etac respond.elim 1);
paulson@2516
   316
by (ALLGOALS Asm_full_simp_tac);
paulson@2516
   317
qed "respond_certificate";
paulson@2516
   318
paulson@2516
   319
paulson@5359
   320
Goal "(PB,RB,KXY) : respond evs                          \
paulson@5359
   321
\     ==> EX A' B'. ALL A B N.                                \
paulson@5359
   322
\         Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB} \
paulson@5359
   323
\         -->   (A'=A & B'=B) | (A'=B & B'=A)";
paulson@2516
   324
by (etac respond.induct 1);
wenzelm@4091
   325
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [all_conj_distrib]))); 
paulson@2449
   326
(*Base case*)
paulson@3121
   327
by (Blast_tac 1);
paulson@3730
   328
by Safe_tac;
paulson@2550
   329
by (expand_case_tac "K = KBC" 1);
paulson@2516
   330
by (dtac respond_Key_in_parts 1);
wenzelm@4091
   331
by (blast_tac (claset() addSIs [exI]
paulson@4598
   332
                        addDs [Key_in_parts_respond]) 1);
paulson@2550
   333
by (expand_case_tac "K = KAB" 1);
paulson@2449
   334
by (REPEAT (ares_tac [exI] 2));
paulson@2449
   335
by (ex_strip_tac 1);
paulson@2516
   336
by (dtac respond_certificate 1);
paulson@5359
   337
by (Blast_tac 1);
paulson@2449
   338
val lemma = result();
paulson@2449
   339
paulson@5114
   340
Goal "[| Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB};      \
paulson@5359
   341
\        Crypt (shrK A') {|Key K, Agent B', N'|} : parts {RB};   \
paulson@5359
   342
\        (PB,RB,KXY) : respond evs |]                            \
paulson@5359
   343
\     ==> (A'=A & B'=B) | (A'=B & B'=A)";
paulson@2560
   344
by (prove_unique_tac lemma 1);
paulson@2449
   345
qed "unique_session_keys";
paulson@2449
   346
paulson@2449
   347
paulson@2451
   348
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3
paulson@2449
   349
    Does not in itself guarantee security: an attack could violate 
paulson@2449
   350
    the premises, e.g. by having A=Spy **)
paulson@2449
   351
paulson@5114
   352
Goal "[| (PB,RB,KAB) : respond evs;  evs : recur |]              \
paulson@5114
   353
\     ==> ALL A A' N. A ~: bad & A' ~: bad -->                   \
paulson@5114
   354
\         Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB} -->  \
paulson@5114
   355
\         Key K ~: analz (insert RB (spies evs))";
paulson@2516
   356
by (etac respond.induct 1);
wenzelm@7499
   357
by (ftac respond_imp_responses 2);
wenzelm@7499
   358
by (ftac respond_imp_not_used 2);
paulson@3961
   359
by (ALLGOALS (*6 seconds*)
paulson@2449
   360
    (asm_simp_tac 
paulson@3961
   361
     (analz_image_freshK_ss 
nipkow@4831
   362
        addsimps split_ifs
paulson@3961
   363
	addsimps 
paulson@3961
   364
          [shrK_in_analz_respond, resp_analz_image_freshK, parts_insert2])));
wenzelm@4091
   365
by (ALLGOALS (simp_tac (simpset() addsimps [ex_disj_distrib])));
paulson@3681
   366
(** LEVEL 5 **)
paulson@5359
   367
by (Blast_tac 1);
paulson@3961
   368
by (REPEAT_FIRST (resolve_tac [allI, conjI, impI]));
paulson@3961
   369
by (ALLGOALS Clarify_tac);
wenzelm@4091
   370
by (blast_tac (claset() addSDs  [resp_analz_insert]
paulson@7057
   371
 		        addIs  [impOfSubs analz_subset_parts]) 3);
paulson@7057
   372
by (blast_tac (claset() addSDs [respond_certificate]) 2);
paulson@3961
   373
by (Asm_full_simp_tac 1);
paulson@3961
   374
(*by unicity, either B=Aa or B=A', a contradiction if B: bad*)
paulson@3961
   375
by (blast_tac
wenzelm@4091
   376
    (claset() addSEs [MPair_parts]
paulson@3961
   377
	     addDs [parts.Body,
paulson@3961
   378
		    respond_certificate RSN (2, unique_session_keys)]) 1);
paulson@2533
   379
qed_spec_mp "respond_Spy_not_see_session_key";
paulson@2449
   380
paulson@2449
   381
paulson@5114
   382
Goal "[| Crypt (shrK A) {|Key K, Agent A', N|} : parts (spies evs); \
paulson@5114
   383
\        A ~: bad;  A' ~: bad;  evs : recur |]                      \
paulson@5114
   384
\     ==> Key K ~: analz (spies evs)";
paulson@2550
   385
by (etac rev_mp 1);
paulson@2449
   386
by (etac recur.induct 1);
paulson@3683
   387
by analz_spies_tac;
paulson@2449
   388
by (ALLGOALS
paulson@2449
   389
    (asm_simp_tac
paulson@5535
   390
     (simpset() addsimps split_ifs @ [analz_insert_eq, analz_insert_freshK])));
paulson@2451
   391
(*RA4*)
paulson@2533
   392
by (spy_analz_tac 5);
paulson@2533
   393
(*RA2*)
paulson@2533
   394
by (spy_analz_tac 3);
paulson@2449
   395
(*Fake*)
paulson@2533
   396
by (spy_analz_tac 2);
paulson@2533
   397
(*Base*)
paulson@7057
   398
by (Force_tac 1);
paulson@2533
   399
(*RA3 remains*)
paulson@4556
   400
by (simp_tac (simpset() addsimps [parts_insert_spies]) 1);
wenzelm@4091
   401
by (safe_tac (claset() delrules [impCE]));
paulson@2451
   402
(*RA3, case 2: K is an old key*)
wenzelm@4091
   403
by (blast_tac (claset() addSDs [resp_analz_insert]
paulson@4556
   404
                        addSEs partsEs
paulson@4556
   405
                        addDs  [Key_in_parts_respond]) 2);
paulson@2451
   406
(*RA3, case 1: use lemma previously proved by induction*)
wenzelm@4091
   407
by (blast_tac (claset() addSEs [respond_Spy_not_see_session_key RSN
paulson@3121
   408
			       (2,rev_notE)]) 1);
paulson@2550
   409
qed "Spy_not_see_session_key";
paulson@2449
   410
paulson@2449
   411
(**** Authenticity properties for Agents ****)
paulson@2449
   412
paulson@2481
   413
(*The response never contains Hashes*)
paulson@5114
   414
Goal "[| Hash {|Key (shrK B), M|} : parts (insert RB H); \
paulson@5114
   415
\        (PB,RB,K) : respond evs |]                      \
paulson@5114
   416
\     ==> Hash {|Key (shrK B), M|} : parts H";
paulson@2550
   417
by (etac rev_mp 1);
paulson@2516
   418
by (etac (respond_imp_responses RS responses.induct) 1);
paulson@4477
   419
by Auto_tac;
paulson@2550
   420
qed "Hash_in_parts_respond";
paulson@2481
   421
paulson@2533
   422
(*Only RA1 or RA2 can have caused such a part of a message to appear.
paulson@2533
   423
  This result is of no use to B, who cannot verify the Hash.  Moreover,
paulson@2533
   424
  it can say nothing about how recent A's message is.  It might later be
paulson@2533
   425
  used to prove B's presence to A at the run's conclusion.*)
paulson@5076
   426
Goalw [HPair_def]
paulson@5114
   427
 "[| Hash {|Key(shrK A), Agent A, Agent B, NA, P|} : parts(spies evs); \
paulson@5114
   428
\        A ~: bad;  evs : recur |]                      \
paulson@5114
   429
\  ==> Says A B (Hash[Key(shrK A)] {|Agent A, Agent B, NA, P|}) : set evs";
paulson@2516
   430
by (etac rev_mp 1);
paulson@3519
   431
by (parts_induct_tac 1);
paulson@5359
   432
by (Blast_tac 1);
paulson@2451
   433
(*RA3*)
wenzelm@4091
   434
by (blast_tac (claset() addSDs [Hash_in_parts_respond]) 1);
paulson@2449
   435
qed_spec_mp "Hash_auth_sender";
paulson@2449
   436
paulson@2516
   437
(** These two results subsume (for all agents) the guarantees proved
paulson@2449
   438
    separately for A and B in the Otway-Rees protocol.
paulson@2449
   439
**)
paulson@2449
   440
paulson@2449
   441
paulson@2533
   442
(*Certificates can only originate with the Server.*)
paulson@5114
   443
Goal "[| Crypt (shrK A) Y : parts (spies evs);    \
paulson@5114
   444
\        A ~: bad;  evs : recur |]                \
paulson@5114
   445
\     ==> EX C RC. Says Server C RC : set evs  &  \
paulson@5114
   446
\                  Crypt (shrK A) Y : parts {RC}";
paulson@2550
   447
by (etac rev_mp 1);
paulson@3519
   448
by (parts_induct_tac 1);
paulson@5359
   449
by (Blast_tac 1);
paulson@2451
   450
(*RA4*)
paulson@3121
   451
by (Blast_tac 4);
paulson@2455
   452
(*RA3*)
wenzelm@4091
   453
by (full_simp_tac (simpset() addsimps [parts_insert_spies]) 3
paulson@3121
   454
    THEN Blast_tac 3);
paulson@2455
   455
(*RA1*)
paulson@3121
   456
by (Blast_tac 1);
paulson@2451
   457
(*RA2: it cannot be a new Nonce, contradiction.*)
paulson@3121
   458
by (Blast_tac 1);
paulson@2550
   459
qed "Cert_imp_Server_msg";