src/HOL/Auth/OtwayRees_AN.ML
author paulson
Thu, 28 Nov 1996 10:41:14 +0100
changeset 2264 f298678bd54a
parent 2166 d276a806cc10
child 2284 80ebd1a213fd
permissions -rw-r--r--
Weaking of injectivity assumptions for newK and newN: they are no longer assumed injective over all traces, merely over the length of a trace
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/OtwayRees
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     2
    ID:         $Id$
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     5
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     6
Inductive relation "otway" for the Otway-Rees protocol.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     7
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     8
Simplified version with minimal encryption but explicit messages
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     9
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    10
From page 11 of
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    11
  Abadi and Needham.  Prudent Engineering Practice for Cryptographic Protocols.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    12
  IEEE Trans. SE 22 (1), 1996
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    13
*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    14
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    15
open OtwayRees_AN;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    16
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    17
proof_timing:=true;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    18
HOL_quantifiers := false;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    19
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    20
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    21
(*Weak liveness: there are traces that reach the end*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    22
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    24
\        ==> EX K. EX NA. EX evs: otway lost.          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    25
\             Says B A (Crypt {|Nonce NA, Agent A, Agent B, Key K|} (shrK A)) \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    26
\             : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    27
by (REPEAT (resolve_tac [exI,bexI] 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    28
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    29
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    30
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    31
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    32
result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    33
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    34
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    35
(**** Inductive proofs about otway ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    36
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
    37
(*Monotonicity*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    38
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    39
by (rtac subsetI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    40
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    41
by (REPEAT_FIRST
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    42
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    43
                              :: otway.intrs))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    44
qed "otway_mono";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    45
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    46
(*Nobody sends themselves messages*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    47
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    48
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    49
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    50
qed_spec_mp "not_Says_to_self";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    51
Addsimps [not_Says_to_self];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    52
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    53
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    54
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    55
(** For reasoning about the encrypted portion of messages **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    56
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    57
goal thy "!!evs. Says S B {|X, X'|} : set_of_list evs ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    58
\                X : analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    59
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    60
qed "OR4_analz_sees_Spy";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    61
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    62
goal thy "!!evs. Says Server B {|X, Crypt {|NB, a, Agent B, K|} K'|} \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    63
\                  : set_of_list evs ==> K : parts (sees lost Spy evs)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    64
by (fast_tac (!claset addSEs partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    65
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    66
qed "Oops_parts_sees_Spy";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    67
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    68
(*OR4_analz_sees_Spy lets us treat those cases using the same 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    69
  argument as for the Fake case.  This is possible for most, but not all,
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    70
  proofs, since Fake messages originate from the Spy. *)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    71
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    72
bind_thm ("OR4_parts_sees_Spy",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    73
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    74
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    75
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    76
  harder to complete, since simplification does less for us.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    77
val parts_Fake_tac = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    78
    forw_inst_tac [("lost","lost")] OR4_parts_sees_Spy 6 THEN
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    79
    forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 7;
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    80
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    81
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    82
fun parts_induct_tac i = SELECT_GOAL
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    83
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    84
	     (*Fake message*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    85
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    86
					   impOfSubs Fake_parts_insert]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    87
                                    addss (!simpset)) 2)) THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    88
     (*Base case*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    89
     fast_tac (!claset addss (!simpset)) 1 THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    90
     ALLGOALS Asm_simp_tac) i;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    91
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    92
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    93
    sends messages containing X! **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    94
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    95
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    96
goal thy 
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    97
 "!!evs. evs : otway lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    98
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    99
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   100
by (Auto_tac());
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   101
qed "Spy_see_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   102
Addsimps [Spy_see_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   103
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   104
goal thy 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   105
 "!!evs. evs : otway lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   106
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   107
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   108
qed "Spy_analz_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   109
Addsimps [Spy_analz_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   110
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   111
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   112
\                  evs : otway lost |] ==> A:lost";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   113
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   114
qed "Spy_see_shrK_D";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   115
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   116
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   117
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   118
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   119
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   120
(*** Future keys can't be seen or used! ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   121
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   122
(*Nobody can have SEEN keys that will be generated in the future. *)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   123
goal thy "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   124
\                length evs <= length evs' --> \
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   125
\                Key (newK evs') ~: parts (sees lost Spy evs)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   126
by (parts_induct_tac 1);
2264
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   127
by (REPEAT_FIRST (best_tac (!claset addEs [leD RS notE]
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   128
				    addDs [impOfSubs analz_subset_parts,
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   129
                                           impOfSubs parts_insert_subset_Un,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   130
                                           Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   131
                                    addss (!simpset))));
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   132
qed_spec_mp "new_keys_not_seen";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   133
Addsimps [new_keys_not_seen];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   134
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   135
(*Variant: old messages must contain old keys!*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   136
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   137
 "!!evs. [| Says A B X : set_of_list evs;  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   138
\           Key (newK evt) : parts {X};    \
2264
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   139
\           evs : otway lost               \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   140
\        |] ==> length evt < length evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   141
by (rtac ccontr 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   142
by (dtac leI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   143
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   144
                      addIs  [impOfSubs parts_mono]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   145
qed "Says_imp_old_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   146
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   147
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   148
(*Nobody can have USED keys that will be generated in the future.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   149
  ...very like new_keys_not_seen*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   150
goal thy "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   151
\                length evs <= length evs' --> \
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   152
\                newK evs' ~: keysFor (parts (sees lost Spy evs))";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   153
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   154
(*OR1 and OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   155
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   156
(*Fake, OR2, OR4: these messages send unknown (X) components*)
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   157
by (REPEAT
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   158
    (best_tac
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   159
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   160
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   161
                      Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   162
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   163
               addss (!simpset)) 1));
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   164
qed_spec_mp "new_keys_not_used";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   165
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   166
bind_thm ("new_keys_not_analzd",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   167
          [analz_subset_parts RS keysFor_mono,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   168
           new_keys_not_used] MRS contra_subsetD);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   169
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   170
Addsimps [new_keys_not_used, new_keys_not_analzd];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   171
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   172
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   173
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   174
(*** Proofs involving analz ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   175
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   176
(*Describes the form of K and NA when the Server sends this message.*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   177
goal thy 
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   178
 "!!evs. [| Says Server B \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   179
\           {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   180
\             Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   181
\           evs : otway lost |]                                        \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   182
\        ==> (EX evt: otway lost. K = Key(newK evt)) &                  \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   183
\            (EX i. NA = Nonce i) &                  \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   184
\            (EX j. NB = Nonce j)";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   185
by (etac rev_mp 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   186
by (etac otway.induct 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   187
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   188
qed "Says_Server_message_form";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   189
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   190
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   191
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   192
val analz_Fake_tac = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   193
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   194
    forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   195
    assume_tac 7 THEN Full_simp_tac 7 THEN
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   196
    REPEAT ((eresolve_tac [bexE, exE, conjE] ORELSE' hyp_subst_tac) 7);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   197
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   198
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   199
(****
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   200
 The following is to prove theorems of the form
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   201
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   202
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   203
          Key K : analz (sees lost Spy evs)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   204
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   205
 A more general formula must be proved inductively.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   206
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   207
****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   208
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   209
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   210
(** Session keys are not used to encrypt other session keys **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   211
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   212
(*The equality makes the induction hypothesis easier to apply*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   213
goal thy  
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   214
 "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   215
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   216
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   217
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   218
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   219
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   220
by (ALLGOALS (*Takes 28 secs*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   221
    (asm_simp_tac 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   222
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   223
                         @ pushes)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   224
               setloop split_tac [expand_if])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   225
(** LEVEL 5 **)
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   226
(*OR4, Fake*) 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   227
by (EVERY (map spy_analz_tac [4,2]));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   228
(*Oops, OR3, Base*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   229
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   230
qed_spec_mp "analz_image_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   231
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   232
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   233
goal thy
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   234
 "!!evs. evs : otway lost ==>                               \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   235
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   236
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   237
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   238
                                   insert_Key_singleton]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   239
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   240
qed "analz_insert_Key_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   241
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   242
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   243
(*** The Key K uniquely identifies the Server's  message. **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   244
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   245
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   246
 "!!evs. evs : otway lost ==>                      \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   247
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   248
\       Says Server B \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   249
\         {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   250
\           Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   251
\       --> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   252
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   253
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   254
by (Step_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   255
(*Remaining cases: OR3 and OR4*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   256
by (ex_strip_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   257
by (Fast_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   258
by (expand_case_tac "K = ?y" 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   259
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   260
(*...we assume X is a very new message, and handle this case by contradiction*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   261
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   262
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   263
                      addss (!simpset addsimps [parts_insertI])) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   264
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   265
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   266
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   267
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   268
"!!evs. [| Says Server B                                           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   269
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   270
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|}        \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   271
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   272
\          Says Server B'                                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   273
\            {|Crypt {|NA', Agent A', Agent B', K|} (shrK A'),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   274
\              Crypt {|NB', Agent A', Agent B', K|} (shrK B')|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   275
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   276
\          evs : otway lost |]                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   277
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   278
by (dtac lemma 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   279
by (REPEAT (etac exE 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   280
(*Duplicate the assumption*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   281
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   282
by (fast_tac (!claset addSDs [spec]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   283
qed "unique_session_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   284
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   285
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   286
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   287
(**** Authenticity properties relating to NA ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   288
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   289
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   290
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   291
 "!!evs. [| A ~: lost;  evs : otway lost |]                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   292
\ ==> Crypt {|NA, Agent A, Agent B, Key K|} (shrK A)        \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   293
\      : parts (sees lost Spy evs)                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   294
\     --> (EX NB. Says Server B                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   295
\                  {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   296
\                    Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   297
\                  : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   298
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   299
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   300
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   301
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   302
qed_spec_mp "NA_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   303
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   304
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   305
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   306
  then the key really did come from the Server!  CANNOT prove this of the
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   307
  bad form of this protocol, even though we can prove
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   308
  Spy_not_see_encrypted_key.  (We can implicitly infer freshness of
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   309
  the Server's message from its nonce NA.)*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   310
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   311
 "!!evs. [| Says B' A (Crypt {|NA, Agent A, Agent B, Key K|} (shrK A))  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   312
\            : set_of_list evs;                                         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   313
\           A ~: lost;  evs : otway lost |]                             \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   314
\        ==> EX NB. Says Server B                                       \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   315
\                    {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   316
\                      Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   317
\                   : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   318
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   319
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   320
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   321
qed "A_trust_OR4";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   322
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   323
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   324
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   325
    Does not in itself guarantee security: an attack could violate 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   326
    the premises, e.g. by having A=Spy **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   327
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   328
goal thy 
2166
d276a806cc10 Tidying up: removing redundant assumptions, etc.
paulson
parents: 2160
diff changeset
   329
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost |]                    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   330
\        ==> Says Server B                                                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   331
\             {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),            \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   332
\               Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   333
\            : set_of_list evs -->                                         \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   334
\            Says B Spy {|NA, NB, Key K|} ~: set_of_list evs -->           \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   335
\            Key K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   336
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   337
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   338
by (ALLGOALS
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   339
    (asm_full_simp_tac 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   340
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   341
                          analz_insert_Key_newK] @ pushes)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   342
               setloop split_tac [expand_if])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   343
(*OR3*)
2166
d276a806cc10 Tidying up: removing redundant assumptions, etc.
paulson
parents: 2160
diff changeset
   344
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   345
                      addss (!simpset addsimps [parts_insert2])) 2);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   346
(*OR4, Fake*) 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   347
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   348
(*Oops*) 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   349
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   350
val lemma = result() RS mp RS mp RSN(2,rev_notE);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   351
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   352
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   353
 "!!evs. [| Says Server B                                                     \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   354
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   355
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs;\
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   356
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                      \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   357
\           A ~: lost;  B ~: lost;  evs : otway lost |]                       \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   358
\        ==> K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   359
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   360
by (fast_tac (!claset addSEs [lemma]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   361
qed "Spy_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   362
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   363
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   364
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   365
 "!!evs. [| C ~: {A,B,Server};                                                \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   366
\           Says Server B                                                     \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   367
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   368
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs;\
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   369
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                 \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   370
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   371
\        ==> K ~: analz (sees lost C evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   372
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   373
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   374
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   375
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   376
qed "Agent_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   377
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   378
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   379
(**** Authenticity properties relating to NB ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   380
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   381
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   382
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   383
 "!!evs. [| B ~: lost;  evs : otway lost |]                                 \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   384
\    ==> Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)                     \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   385
\         : parts (sees lost Spy evs)                                       \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   386
\        --> (EX NA. Says Server B                                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   387
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   388
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   389
\                     : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   390
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   391
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   392
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   393
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   394
qed_spec_mp "NB_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   395
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   396
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   397
(*Guarantee for B: if it gets a message with matching NB then the Server
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   398
  has sent the correct message.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   399
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   400
 "!!evs. [| B ~: lost;  evs : otway lost;                                   \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   401
\           Says S B {|X, Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}  \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   402
\            : set_of_list evs |]                                           \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   403
\        ==> EX NA. Says Server B                                           \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   404
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   405
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   406
\                     : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   407
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   408
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   409
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   410
qed "B_trust_OR3";