src/HOL/Auth/KerberosIV_Gets.thy
author huffman
Sat Jun 06 09:11:12 2009 -0700 (2009-06-06)
changeset 31488 5691ccb8d6b5
parent 26301 28193aedc718
child 32960 69916a850301
permissions -rw-r--r--
generalize tendsto to class topological_space
paulson@18886
     1
(*  Title:      HOL/Auth/KerberosIV
paulson@18886
     2
    ID:         $Id$
paulson@18886
     3
    Author:     Giampaolo Bella, Cambridge University Computer Laboratory
paulson@18886
     4
    Copyright   1998  University of Cambridge
paulson@18886
     5
*)
paulson@18886
     6
paulson@18886
     7
header{*The Kerberos Protocol, Version IV*}
paulson@18886
     8
paulson@18886
     9
theory KerberosIV_Gets imports Public begin
paulson@18886
    10
paulson@18886
    11
text{*The "u" prefix indicates theorems referring to an updated version of the protocol. The "r" suffix indicates theorems where the confidentiality assumptions are relaxed by the corresponding arguments.*}
paulson@18886
    12
wenzelm@20768
    13
abbreviation
wenzelm@21404
    14
  Kas :: agent where "Kas == Server"
paulson@18886
    15
wenzelm@21404
    16
abbreviation
wenzelm@21404
    17
  Tgs :: agent where "Tgs == Friend 0"
paulson@18886
    18
paulson@18886
    19
paulson@18886
    20
axioms
paulson@18886
    21
  Tgs_not_bad [iff]: "Tgs \<notin> bad"
paulson@18886
    22
   --{*Tgs is secure --- we already know that Kas is secure*}
paulson@18886
    23
paulson@18886
    24
constdefs
paulson@18886
    25
 (* authKeys are those contained in an authTicket *)
paulson@18886
    26
    authKeys :: "event list => key set"
paulson@18886
    27
    "authKeys evs == {authK. \<exists>A Peer Ta. Says Kas A
paulson@18886
    28
                        (Crypt (shrK A) \<lbrace>Key authK, Agent Peer, Number Ta,
paulson@18886
    29
               (Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key authK, Number Ta\<rbrace>)
paulson@18886
    30
                  \<rbrace>) \<in> set evs}"
paulson@18886
    31
paulson@18886
    32
 (* States than an event really appears only once on a trace *)
paulson@18886
    33
  Unique :: "[event, event list] => bool" ("Unique _ on _")
paulson@18886
    34
   "Unique ev on evs == 
paulson@18886
    35
      ev \<notin> set (tl (dropWhile (% z. z \<noteq> ev) evs))"
paulson@18886
    36
paulson@18886
    37
paulson@18886
    38
consts
paulson@18886
    39
    (*Duration of the authentication key*)
paulson@18886
    40
    authKlife   :: nat
paulson@18886
    41
paulson@18886
    42
    (*Duration of the service key*)
paulson@18886
    43
    servKlife   :: nat
paulson@18886
    44
paulson@18886
    45
    (*Duration of an authenticator*)
paulson@18886
    46
    authlife   :: nat
paulson@18886
    47
paulson@18886
    48
    (*Upper bound on the time of reaction of a server*)
paulson@18886
    49
    replylife   :: nat
paulson@18886
    50
paulson@18886
    51
specification (authKlife)
paulson@18886
    52
  authKlife_LB [iff]: "2 \<le> authKlife"
paulson@18886
    53
    by blast
paulson@18886
    54
paulson@18886
    55
specification (servKlife)
paulson@18886
    56
  servKlife_LB [iff]: "2 + authKlife \<le> servKlife"
paulson@18886
    57
    by blast
paulson@18886
    58
paulson@18886
    59
specification (authlife)
paulson@18886
    60
  authlife_LB [iff]: "Suc 0 \<le> authlife"
paulson@18886
    61
    by blast
paulson@18886
    62
paulson@18886
    63
specification (replylife)
paulson@18886
    64
  replylife_LB [iff]: "Suc 0 \<le> replylife"
paulson@18886
    65
    by blast
paulson@18886
    66
wenzelm@20768
    67
abbreviation
wenzelm@20768
    68
  (*The current time is just the length of the trace!*)
wenzelm@21404
    69
  CT :: "event list=>nat" where
wenzelm@20768
    70
  "CT == length"
paulson@18886
    71
wenzelm@21404
    72
abbreviation
wenzelm@21404
    73
  expiredAK :: "[nat, event list] => bool" where
wenzelm@20768
    74
  "expiredAK Ta evs == authKlife + Ta < CT evs"
paulson@18886
    75
wenzelm@21404
    76
abbreviation
wenzelm@21404
    77
  expiredSK :: "[nat, event list] => bool" where
wenzelm@20768
    78
  "expiredSK Ts evs == servKlife + Ts < CT evs"
paulson@18886
    79
wenzelm@21404
    80
abbreviation
wenzelm@21404
    81
  expiredA :: "[nat, event list] => bool" where
wenzelm@20768
    82
  "expiredA T evs == authlife + T < CT evs"
paulson@18886
    83
wenzelm@21404
    84
abbreviation
wenzelm@21404
    85
  valid :: "[nat, nat] => bool" ("valid _ wrt _") where
wenzelm@20768
    86
  "valid T1 wrt T2 == T1 <= replylife + T2"
paulson@18886
    87
paulson@18886
    88
(*---------------------------------------------------------------------*)
paulson@18886
    89
paulson@18886
    90
paulson@18886
    91
(* Predicate formalising the association between authKeys and servKeys *)
paulson@18886
    92
constdefs
paulson@18886
    93
  AKcryptSK :: "[key, key, event list] => bool"
paulson@18886
    94
  "AKcryptSK authK servK evs ==
paulson@18886
    95
     \<exists>A B Ts.
paulson@18886
    96
       Says Tgs A (Crypt authK
paulson@18886
    97
                     \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
    98
                       Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> \<rbrace>)
paulson@18886
    99
         \<in> set evs"
paulson@18886
   100
berghofe@23746
   101
inductive_set "kerbIV_gets" :: "event list set"
berghofe@23746
   102
  where
paulson@18886
   103
paulson@18886
   104
   Nil:  "[] \<in> kerbIV_gets"
paulson@18886
   105
berghofe@23746
   106
 | Fake: "\<lbrakk> evsf \<in> kerbIV_gets;  X \<in> synth (analz (spies evsf)) \<rbrakk>
paulson@18886
   107
          \<Longrightarrow> Says Spy B X  # evsf \<in> kerbIV_gets"
paulson@18886
   108
berghofe@23746
   109
 | Reception: "\<lbrakk> evsr \<in> kerbIV_gets;  Says A B X \<in> set evsr \<rbrakk>
paulson@18886
   110
                \<Longrightarrow> Gets B X # evsr \<in> kerbIV_gets"
paulson@18886
   111
paulson@18886
   112
(* FROM the initiator *)
berghofe@23746
   113
 | K1:   "\<lbrakk> evs1 \<in> kerbIV_gets \<rbrakk>
paulson@18886
   114
          \<Longrightarrow> Says A Kas \<lbrace>Agent A, Agent Tgs, Number (CT evs1)\<rbrace> # evs1
paulson@18886
   115
          \<in> kerbIV_gets"
paulson@18886
   116
paulson@18886
   117
(* Adding the timestamp serves to A in K3 to check that
paulson@18886
   118
   she doesn't get a reply too late. This kind of timeouts are ordinary.
paulson@18886
   119
   If a server's reply is late, then it is likely to be fake. *)
paulson@18886
   120
paulson@18886
   121
(*---------------------------------------------------------------------*)
paulson@18886
   122
paulson@18886
   123
(*FROM Kas *)
berghofe@23746
   124
 | K2:  "\<lbrakk> evs2 \<in> kerbIV_gets; Key authK \<notin> used evs2; authK \<in> symKeys;
paulson@18886
   125
            Gets Kas \<lbrace>Agent A, Agent Tgs, Number T1\<rbrace> \<in> set evs2 \<rbrakk>
paulson@18886
   126
          \<Longrightarrow> Says Kas A
paulson@18886
   127
                (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number (CT evs2),
paulson@18886
   128
                      (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK,
paulson@18886
   129
                          Number (CT evs2)\<rbrace>)\<rbrace>) # evs2 \<in> kerbIV_gets"
paulson@18886
   130
(*
paulson@18886
   131
  The internal encryption builds the authTicket.
paulson@18886
   132
  The timestamp doesn't change inside the two encryptions: the external copy
paulson@18886
   133
  will be used by the initiator in K3; the one inside the
paulson@18886
   134
  authTicket by Tgs in K4.
paulson@18886
   135
*)
paulson@18886
   136
paulson@18886
   137
(*---------------------------------------------------------------------*)
paulson@18886
   138
paulson@18886
   139
(* FROM the initiator *)
berghofe@23746
   140
 | K3:  "\<lbrakk> evs3 \<in> kerbIV_gets;
paulson@18886
   141
            Says A Kas \<lbrace>Agent A, Agent Tgs, Number T1\<rbrace> \<in> set evs3;
paulson@18886
   142
            Gets A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   143
              authTicket\<rbrace>) \<in> set evs3;
paulson@18886
   144
            valid Ta wrt T1
paulson@18886
   145
         \<rbrakk>
paulson@18886
   146
          \<Longrightarrow> Says A Tgs \<lbrace>authTicket,
paulson@18886
   147
                           (Crypt authK \<lbrace>Agent A, Number (CT evs3)\<rbrace>),
paulson@18886
   148
                           Agent B\<rbrace> # evs3 \<in> kerbIV_gets"
paulson@18886
   149
(*The two events amongst the premises allow A to accept only those authKeys
paulson@18886
   150
  that are not issued late. *)
paulson@18886
   151
paulson@18886
   152
(*---------------------------------------------------------------------*)
paulson@18886
   153
paulson@18886
   154
(* FROM Tgs *)
paulson@18886
   155
(* Note that the last temporal check is not mentioned in the original MIT
paulson@18886
   156
   specification. Adding it makes many goals "available" to the peers. 
paulson@18886
   157
   Theorems that exploit it have the suffix `_u', which stands for updated 
paulson@18886
   158
   protocol.
paulson@18886
   159
*)
berghofe@23746
   160
 | K4:  "\<lbrakk> evs4 \<in> kerbIV_gets; Key servK \<notin> used evs4; servK \<in> symKeys;
paulson@18886
   161
            B \<noteq> Tgs;  authK \<in> symKeys;
paulson@18886
   162
            Gets Tgs \<lbrace>
paulson@18886
   163
             (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK,
paulson@18886
   164
				 Number Ta\<rbrace>),
paulson@18886
   165
             (Crypt authK \<lbrace>Agent A, Number T2\<rbrace>), Agent B\<rbrace>
paulson@18886
   166
	        \<in> set evs4;
paulson@18886
   167
            \<not> expiredAK Ta evs4;
paulson@18886
   168
            \<not> expiredA T2 evs4;
paulson@18886
   169
            servKlife + (CT evs4) <= authKlife + Ta
paulson@18886
   170
         \<rbrakk>
paulson@18886
   171
          \<Longrightarrow> Says Tgs A
paulson@18886
   172
                (Crypt authK \<lbrace>Key servK, Agent B, Number (CT evs4),
paulson@18886
   173
			       Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK,
paulson@18886
   174
		 			        Number (CT evs4)\<rbrace> \<rbrace>)
paulson@18886
   175
	        # evs4 \<in> kerbIV_gets"
paulson@18886
   176
(* Tgs creates a new session key per each request for a service, without
paulson@18886
   177
   checking if there is still a fresh one for that service.
paulson@18886
   178
   The cipher under Tgs' key is the authTicket, the cipher under B's key
paulson@18886
   179
   is the servTicket, which is built now.
paulson@18886
   180
   NOTE that the last temporal check is not present in the MIT specification.
paulson@18886
   181
paulson@18886
   182
*)
paulson@18886
   183
paulson@18886
   184
(*---------------------------------------------------------------------*)
paulson@18886
   185
paulson@18886
   186
(* FROM the initiator *)
berghofe@23746
   187
 | K5:  "\<lbrakk> evs5 \<in> kerbIV_gets; authK \<in> symKeys; servK \<in> symKeys;
paulson@18886
   188
            Says A Tgs
paulson@18886
   189
                \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>,
paulson@18886
   190
		  Agent B\<rbrace>
paulson@18886
   191
              \<in> set evs5;
paulson@18886
   192
            Gets A
paulson@18886
   193
             (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   194
                \<in> set evs5;
paulson@18886
   195
            valid Ts wrt T2 \<rbrakk>
paulson@18886
   196
          \<Longrightarrow> Says A B \<lbrace>servTicket,
paulson@18886
   197
			 Crypt servK \<lbrace>Agent A, Number (CT evs5)\<rbrace> \<rbrace>
paulson@18886
   198
               # evs5 \<in> kerbIV_gets"
paulson@18886
   199
(* Checks similar to those in K3. *)
paulson@18886
   200
paulson@18886
   201
(*---------------------------------------------------------------------*)
paulson@18886
   202
paulson@18886
   203
(* FROM the responder*)
berghofe@23746
   204
  | K6:  "\<lbrakk> evs6 \<in> kerbIV_gets;
paulson@18886
   205
            Gets B \<lbrace>
paulson@18886
   206
              (Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>),
paulson@18886
   207
              (Crypt servK \<lbrace>Agent A, Number T3\<rbrace>)\<rbrace>
paulson@18886
   208
            \<in> set evs6;
paulson@18886
   209
            \<not> expiredSK Ts evs6;
paulson@18886
   210
            \<not> expiredA T3 evs6
paulson@18886
   211
         \<rbrakk>
paulson@18886
   212
          \<Longrightarrow> Says B A (Crypt servK (Number T3))
paulson@18886
   213
               # evs6 \<in> kerbIV_gets"
paulson@18886
   214
(* Checks similar to those in K4. *)
paulson@18886
   215
paulson@18886
   216
(*---------------------------------------------------------------------*)
paulson@18886
   217
paulson@18886
   218
(* Leaking an authK... *)
berghofe@23746
   219
 | Oops1: "\<lbrakk> evsO1 \<in> kerbIV_gets;  A \<noteq> Spy;
paulson@18886
   220
              Says Kas A
paulson@18886
   221
                (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   222
                                  authTicket\<rbrace>)  \<in> set evsO1;
paulson@18886
   223
              expiredAK Ta evsO1 \<rbrakk>
paulson@18886
   224
          \<Longrightarrow> Says A Spy \<lbrace>Agent A, Agent Tgs, Number Ta, Key authK\<rbrace>
paulson@18886
   225
               # evsO1 \<in> kerbIV_gets"
paulson@18886
   226
paulson@18886
   227
(*---------------------------------------------------------------------*)
paulson@18886
   228
paulson@18886
   229
(*Leaking a servK... *)
berghofe@23746
   230
 | Oops2: "\<lbrakk> evsO2 \<in> kerbIV_gets;  A \<noteq> Spy;
paulson@18886
   231
              Says Tgs A
paulson@18886
   232
                (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   233
                   \<in> set evsO2;
paulson@18886
   234
              expiredSK Ts evsO2 \<rbrakk>
paulson@18886
   235
          \<Longrightarrow> Says A Spy \<lbrace>Agent A, Agent B, Number Ts, Key servK\<rbrace>
paulson@18886
   236
               # evsO2 \<in> kerbIV_gets"
paulson@18886
   237
paulson@18886
   238
(*---------------------------------------------------------------------*)
paulson@18886
   239
paulson@18886
   240
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
paulson@18886
   241
declare parts.Body [dest]
paulson@18886
   242
declare analz_into_parts [dest]
paulson@18886
   243
declare Fake_parts_insert_in_Un [dest]
paulson@18886
   244
paulson@18886
   245
subsection{*Lemmas about reception event*}
paulson@18886
   246
paulson@18886
   247
lemma Gets_imp_Says :
paulson@18886
   248
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs"
paulson@18886
   249
apply (erule rev_mp)
paulson@18886
   250
apply (erule kerbIV_gets.induct)
paulson@18886
   251
apply auto
paulson@18886
   252
done
paulson@18886
   253
paulson@18886
   254
lemma Gets_imp_knows_Spy: 
paulson@18886
   255
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> kerbIV_gets \<rbrakk>  \<Longrightarrow> X \<in> knows Spy evs"
paulson@18886
   256
apply (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
paulson@18886
   257
done
paulson@18886
   258
paulson@18886
   259
(*Needed for force to work for example in new_keys_not_used*)
paulson@18886
   260
declare Gets_imp_knows_Spy [THEN parts.Inj, dest]
paulson@18886
   261
paulson@18886
   262
lemma Gets_imp_knows:
paulson@18886
   263
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> kerbIV_gets \<rbrakk>  \<Longrightarrow> X \<in> knows B evs"
paulson@18886
   264
apply (case_tac "B = Spy")
paulson@18886
   265
apply (blast dest!: Gets_imp_knows_Spy)
paulson@18886
   266
apply (blast dest!: Gets_imp_knows_agents)
paulson@18886
   267
done
paulson@18886
   268
paulson@18886
   269
subsection{*Lemmas about @{term authKeys}*}
paulson@18886
   270
paulson@18886
   271
lemma authKeys_empty: "authKeys [] = {}"
paulson@18886
   272
apply (unfold authKeys_def)
paulson@18886
   273
apply (simp (no_asm))
paulson@18886
   274
done
paulson@18886
   275
paulson@18886
   276
lemma authKeys_not_insert:
paulson@18886
   277
 "(\<forall>A Ta akey Peer.
paulson@18886
   278
   ev \<noteq> Says Kas A (Crypt (shrK A) \<lbrace>akey, Agent Peer, Ta,
paulson@18886
   279
              (Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, akey, Ta\<rbrace>)\<rbrace>))
paulson@18886
   280
       \<Longrightarrow> authKeys (ev # evs) = authKeys evs"
paulson@18886
   281
by (unfold authKeys_def, auto)
paulson@18886
   282
paulson@18886
   283
lemma authKeys_insert:
paulson@18886
   284
  "authKeys
paulson@18886
   285
     (Says Kas A (Crypt (shrK A) \<lbrace>Key K, Agent Peer, Number Ta,
paulson@18886
   286
      (Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key K, Number Ta\<rbrace>)\<rbrace>) # evs)
paulson@18886
   287
       = insert K (authKeys evs)"
paulson@18886
   288
by (unfold authKeys_def, auto)
paulson@18886
   289
paulson@18886
   290
lemma authKeys_simp:
paulson@18886
   291
   "K \<in> authKeys
paulson@18886
   292
    (Says Kas A (Crypt (shrK A) \<lbrace>Key K', Agent Peer, Number Ta,
paulson@18886
   293
     (Crypt (shrK Peer) \<lbrace>Agent A, Agent Peer, Key K', Number Ta\<rbrace>)\<rbrace>) # evs)
paulson@18886
   294
        \<Longrightarrow> K = K' | K \<in> authKeys evs"
paulson@18886
   295
by (unfold authKeys_def, auto)
paulson@18886
   296
paulson@18886
   297
lemma authKeysI:
paulson@18886
   298
   "Says Kas A (Crypt (shrK A) \<lbrace>Key K, Agent Tgs, Number Ta,
paulson@18886
   299
     (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key K, Number Ta\<rbrace>)\<rbrace>) \<in> set evs
paulson@18886
   300
        \<Longrightarrow> K \<in> authKeys evs"
paulson@18886
   301
by (unfold authKeys_def, auto)
paulson@18886
   302
paulson@18886
   303
lemma authKeys_used: "K \<in> authKeys evs \<Longrightarrow> Key K \<in> used evs"
paulson@18886
   304
by (simp add: authKeys_def, blast)
paulson@18886
   305
paulson@18886
   306
paulson@18886
   307
subsection{*Forwarding Lemmas*}
paulson@18886
   308
paulson@18886
   309
lemma Says_ticket_parts:
paulson@18886
   310
     "Says S A (Crypt K \<lbrace>SesKey, B, TimeStamp, Ticket\<rbrace>) \<in> set evs
paulson@18886
   311
      \<Longrightarrow> Ticket \<in> parts (spies evs)"
paulson@18886
   312
apply blast
paulson@18886
   313
done
paulson@18886
   314
paulson@18886
   315
lemma Gets_ticket_parts:
paulson@18886
   316
     "\<lbrakk>Gets A (Crypt K \<lbrace>SesKey, Peer, Ta, Ticket\<rbrace>) \<in> set evs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   317
      \<Longrightarrow> Ticket \<in> parts (spies evs)"
paulson@18886
   318
apply (blast dest: Gets_imp_knows_Spy [THEN parts.Inj])
paulson@18886
   319
done
paulson@18886
   320
paulson@18886
   321
lemma Oops_range_spies1:
paulson@18886
   322
     "\<lbrakk> Says Kas A (Crypt KeyA \<lbrace>Key authK, Peer, Ta, authTicket\<rbrace>)
paulson@18886
   323
           \<in> set evs ;
paulson@18886
   324
         evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> authK \<notin> range shrK & authK \<in> symKeys"
paulson@18886
   325
apply (erule rev_mp)
paulson@18886
   326
apply (erule kerbIV_gets.induct, auto)
paulson@18886
   327
done
paulson@18886
   328
paulson@18886
   329
lemma Oops_range_spies2:
paulson@18886
   330
     "\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Ts, servTicket\<rbrace>)
paulson@18886
   331
           \<in> set evs ;
paulson@18886
   332
         evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> servK \<notin> range shrK & servK \<in> symKeys"
paulson@18886
   333
apply (erule rev_mp)
paulson@18886
   334
apply (erule kerbIV_gets.induct, auto)
paulson@18886
   335
done
paulson@18886
   336
paulson@18886
   337
paulson@18886
   338
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
paulson@18886
   339
lemma Spy_see_shrK [simp]:
paulson@18886
   340
     "evs \<in> kerbIV_gets \<Longrightarrow> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)"
paulson@18886
   341
apply (erule kerbIV_gets.induct)
paulson@18886
   342
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   343
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   344
apply (blast+)
paulson@18886
   345
done
paulson@18886
   346
paulson@18886
   347
lemma Spy_analz_shrK [simp]:
paulson@18886
   348
     "evs \<in> kerbIV_gets \<Longrightarrow> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)"
paulson@18886
   349
by auto
paulson@18886
   350
paulson@18886
   351
lemma Spy_see_shrK_D [dest!]:
paulson@18886
   352
     "\<lbrakk> Key (shrK A) \<in> parts (spies evs);  evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> A:bad"
paulson@18886
   353
by (blast dest: Spy_see_shrK)
paulson@18886
   354
lemmas Spy_analz_shrK_D = analz_subset_parts [THEN subsetD, THEN Spy_see_shrK_D, dest!]
paulson@18886
   355
paulson@18886
   356
text{*Nobody can have used non-existent keys!*}
paulson@18886
   357
lemma new_keys_not_used [simp]:
paulson@18886
   358
    "\<lbrakk>Key K \<notin> used evs; K \<in> symKeys; evs \<in> kerbIV_gets\<rbrakk>
paulson@18886
   359
     \<Longrightarrow> K \<notin> keysFor (parts (spies evs))"
paulson@18886
   360
apply (erule rev_mp)
paulson@18886
   361
apply (erule kerbIV_gets.induct)
paulson@18886
   362
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   363
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   364
txt{*Fake*}
paulson@18886
   365
apply (force dest!: keysFor_parts_insert)
paulson@18886
   366
txt{*Others*}
paulson@18886
   367
apply (force dest!: analz_shrK_Decrypt)+
paulson@18886
   368
done
paulson@18886
   369
paulson@18886
   370
(*Earlier, all protocol proofs declared this theorem.
paulson@18886
   371
  But few of them actually need it! (Another is Yahalom) *)
paulson@18886
   372
lemma new_keys_not_analzd:
paulson@18886
   373
 "\<lbrakk>evs \<in> kerbIV_gets; K \<in> symKeys; Key K \<notin> used evs\<rbrakk>
paulson@18886
   374
  \<Longrightarrow> K \<notin> keysFor (analz (spies evs))"
paulson@18886
   375
by (blast dest: new_keys_not_used intro: keysFor_mono [THEN subsetD])
paulson@18886
   376
paulson@18886
   377
paulson@18886
   378
subsection{*Regularity Lemmas*}
paulson@18886
   379
text{*These concern the form of items passed in messages*}
paulson@18886
   380
paulson@18886
   381
text{*Describes the form of all components sent by Kas*}
paulson@18886
   382
paulson@18886
   383
lemma Says_Kas_message_form:
paulson@18886
   384
     "\<lbrakk> Says Kas A (Crypt K \<lbrace>Key authK, Agent Peer, Number Ta, authTicket\<rbrace>)
paulson@18886
   385
           \<in> set evs;
paulson@18886
   386
         evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow>  
paulson@18886
   387
  K = shrK A  & Peer = Tgs &
paulson@18886
   388
  authK \<notin> range shrK & authK \<in> authKeys evs & authK \<in> symKeys & 
paulson@18886
   389
  authTicket = (Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>)"
paulson@18886
   390
apply (erule rev_mp)
paulson@18886
   391
apply (erule kerbIV_gets.induct)
paulson@18886
   392
apply (simp_all (no_asm) add: authKeys_def authKeys_insert)
paulson@18886
   393
apply blast+
paulson@18886
   394
done
paulson@18886
   395
paulson@18886
   396
paulson@18886
   397
lemma SesKey_is_session_key:
paulson@18886
   398
     "\<lbrakk> Crypt (shrK Tgs_B) \<lbrace>Agent A, Agent Tgs_B, Key SesKey, Number T\<rbrace>
paulson@18886
   399
            \<in> parts (spies evs); Tgs_B \<notin> bad;
paulson@18886
   400
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   401
      \<Longrightarrow> SesKey \<notin> range shrK"
paulson@18886
   402
apply (erule rev_mp)
paulson@18886
   403
apply (erule kerbIV_gets.induct)
paulson@18886
   404
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   405
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast)
paulson@18886
   406
done
paulson@18886
   407
paulson@18886
   408
lemma authTicket_authentic:
paulson@18886
   409
     "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>
paulson@18886
   410
           \<in> parts (spies evs);
paulson@18886
   411
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   412
      \<Longrightarrow> Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   413
                 Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   414
            \<in> set evs"
paulson@18886
   415
apply (erule rev_mp)
paulson@18886
   416
apply (erule kerbIV_gets.induct)
paulson@18886
   417
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   418
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   419
txt{*Fake, K4*}
paulson@18886
   420
apply (blast+)
paulson@18886
   421
done
paulson@18886
   422
paulson@18886
   423
lemma authTicket_crypt_authK:
paulson@18886
   424
     "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>
paulson@18886
   425
           \<in> parts (spies evs);
paulson@18886
   426
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   427
      \<Longrightarrow> authK \<in> authKeys evs"
paulson@18886
   428
apply (frule authTicket_authentic, assumption)
paulson@18886
   429
apply (simp (no_asm) add: authKeys_def)
paulson@18886
   430
apply blast
paulson@18886
   431
done
paulson@18886
   432
paulson@18886
   433
lemma Says_Tgs_message_form:
paulson@18886
   434
     "\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   435
           \<in> set evs;
paulson@18886
   436
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   437
  \<Longrightarrow> B \<noteq> Tgs & 
paulson@18886
   438
      authK \<notin> range shrK & authK \<in> authKeys evs & authK \<in> symKeys &
paulson@18886
   439
      servK \<notin> range shrK & servK \<notin> authKeys evs & servK \<in> symKeys &
paulson@18886
   440
      servTicket = (Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>)"
paulson@18886
   441
apply (erule rev_mp)
paulson@18886
   442
apply (erule kerbIV_gets.induct)
paulson@18886
   443
apply (simp_all add: authKeys_insert authKeys_not_insert authKeys_empty authKeys_simp, blast, auto)
paulson@18886
   444
txt{*Three subcases of Message 4*}
paulson@18886
   445
apply (blast dest!: SesKey_is_session_key)
paulson@18886
   446
apply (blast dest: authTicket_crypt_authK)
paulson@18886
   447
apply (blast dest!: authKeys_used Says_Kas_message_form)
paulson@18886
   448
done
paulson@18886
   449
paulson@18886
   450
paulson@18886
   451
lemma authTicket_form:
paulson@18886
   452
     "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Ta, authTicket\<rbrace>
paulson@18886
   453
           \<in> parts (spies evs);
paulson@18886
   454
         A \<notin> bad;
paulson@18886
   455
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   456
    \<Longrightarrow> authK \<notin> range shrK & authK \<in> symKeys & 
paulson@18886
   457
        authTicket = Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Ta\<rbrace>"
paulson@18886
   458
apply (erule rev_mp)
paulson@18886
   459
apply (erule kerbIV_gets.induct)
paulson@18886
   460
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   461
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   462
apply blast+
paulson@18886
   463
done
paulson@18886
   464
paulson@18886
   465
text{* This form holds also over an authTicket, but is not needed below.*}
paulson@18886
   466
lemma servTicket_form:
paulson@18886
   467
     "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Ts, servTicket\<rbrace>
paulson@18886
   468
              \<in> parts (spies evs);
paulson@18886
   469
            Key authK \<notin> analz (spies evs);
paulson@18886
   470
            evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   471
         \<Longrightarrow> servK \<notin> range shrK & servK \<in> symKeys & 
paulson@18886
   472
    (\<exists>A. servTicket = Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace>)"
paulson@18886
   473
apply (erule rev_mp)
paulson@18886
   474
apply (erule rev_mp)
paulson@18886
   475
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   476
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   477
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast)
paulson@18886
   478
done
paulson@18886
   479
paulson@18886
   480
text{* Essentially the same as @{text authTicket_form} *}
paulson@18886
   481
lemma Says_kas_message_form:
paulson@18886
   482
     "\<lbrakk> Gets A (Crypt (shrK A)
paulson@18886
   483
              \<lbrace>Key authK, Agent Tgs, Ta, authTicket\<rbrace>) \<in> set evs;
paulson@18886
   484
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   485
      \<Longrightarrow> authK \<notin> range shrK & authK \<in> symKeys & 
paulson@18886
   486
          authTicket =
paulson@18886
   487
                  Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Ta\<rbrace>
paulson@18886
   488
          | authTicket \<in> analz (spies evs)"
paulson@18886
   489
by (blast dest: analz_shrK_Decrypt authTicket_form
paulson@18886
   490
                Gets_imp_knows_Spy [THEN analz.Inj])
paulson@18886
   491
paulson@18886
   492
lemma Says_tgs_message_form:
paulson@18886
   493
 "\<lbrakk> Gets A (Crypt authK \<lbrace>Key servK, Agent B, Ts, servTicket\<rbrace>)
paulson@18886
   494
       \<in> set evs;  authK \<in> symKeys;
paulson@18886
   495
     evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   496
  \<Longrightarrow> servK \<notin> range shrK &
paulson@18886
   497
      (\<exists>A. servTicket =
paulson@18886
   498
	      Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace>)
paulson@18886
   499
       | servTicket \<in> analz (spies evs)"
paulson@18886
   500
apply (frule Gets_imp_knows_Spy [THEN analz.Inj], auto)
paulson@18886
   501
 apply (force dest!: servTicket_form)
paulson@18886
   502
apply (frule analz_into_parts)
paulson@18886
   503
apply (frule servTicket_form, auto)
paulson@18886
   504
done
paulson@18886
   505
paulson@18886
   506
paulson@18886
   507
subsection{*Authenticity theorems: confirm origin of sensitive messages*}
paulson@18886
   508
paulson@18886
   509
lemma authK_authentic:
paulson@18886
   510
     "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Peer, Ta, authTicket\<rbrace>
paulson@18886
   511
           \<in> parts (spies evs);
paulson@18886
   512
         A \<notin> bad;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   513
      \<Longrightarrow> Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Peer, Ta, authTicket\<rbrace>)
paulson@18886
   514
            \<in> set evs"
paulson@18886
   515
apply (erule rev_mp)
paulson@18886
   516
apply (erule kerbIV_gets.induct)
paulson@18886
   517
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   518
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   519
txt{*Fake*}
paulson@18886
   520
apply blast
paulson@18886
   521
txt{*K4*}
paulson@18886
   522
apply (blast dest!: authTicket_authentic [THEN Says_Kas_message_form])
paulson@18886
   523
done
paulson@18886
   524
paulson@18886
   525
text{*If a certain encrypted message appears then it originated with Tgs*}
paulson@18886
   526
lemma servK_authentic:
paulson@18886
   527
     "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
   528
           \<in> parts (spies evs);
paulson@18886
   529
         Key authK \<notin> analz (spies evs);
paulson@18886
   530
         authK \<notin> range shrK;
paulson@18886
   531
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   532
 \<Longrightarrow> \<exists>A. Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   533
       \<in> set evs"
paulson@18886
   534
apply (erule rev_mp)
paulson@18886
   535
apply (erule rev_mp)
paulson@18886
   536
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   537
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   538
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   539
txt{*Fake*}
paulson@18886
   540
apply blast
paulson@18886
   541
txt{*K2*}
paulson@18886
   542
apply blast
paulson@18886
   543
txt{*K4*}
paulson@18886
   544
apply auto
paulson@18886
   545
done
paulson@18886
   546
paulson@18886
   547
lemma servK_authentic_bis:
paulson@18886
   548
     "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
   549
           \<in> parts (spies evs);
paulson@18886
   550
         Key authK \<notin> analz (spies evs);
paulson@18886
   551
         B \<noteq> Tgs;
paulson@18886
   552
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   553
 \<Longrightarrow> \<exists>A. Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   554
       \<in> set evs"
paulson@18886
   555
apply (erule rev_mp)
paulson@18886
   556
apply (erule rev_mp)
paulson@18886
   557
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   558
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   559
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   560
txt{*Fake*}
paulson@18886
   561
apply blast
paulson@18886
   562
txt{*K4*}
paulson@18886
   563
apply blast
paulson@18886
   564
done
paulson@18886
   565
paulson@18886
   566
text{*Authenticity of servK for B*}
paulson@18886
   567
lemma servTicket_authentic_Tgs:
paulson@18886
   568
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
   569
           \<in> parts (spies evs); B \<noteq> Tgs;  B \<notin> bad;
paulson@18886
   570
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   571
 \<Longrightarrow> \<exists>authK.
paulson@18886
   572
       Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   573
                   Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace>)
paulson@18886
   574
       \<in> set evs"
paulson@18886
   575
apply (erule rev_mp)
paulson@18886
   576
apply (erule rev_mp)
paulson@18886
   577
apply (erule kerbIV_gets.induct)
paulson@18886
   578
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   579
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   580
apply blast+
paulson@18886
   581
done
paulson@18886
   582
paulson@18886
   583
text{*Anticipated here from next subsection*}
paulson@18886
   584
lemma K4_imp_K2:
paulson@18886
   585
"\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   586
      \<in> set evs;  evs \<in> kerbIV_gets\<rbrakk>
paulson@18886
   587
   \<Longrightarrow> \<exists>Ta. Says Kas A
paulson@18886
   588
        (Crypt (shrK A)
paulson@18886
   589
         \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   590
           Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   591
        \<in> set evs"
paulson@18886
   592
apply (erule rev_mp)
paulson@18886
   593
apply (erule kerbIV_gets.induct)
paulson@18886
   594
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   595
apply (frule_tac [6] Gets_ticket_parts, simp_all, auto)
paulson@18886
   596
apply (blast dest!: Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst, THEN authTicket_authentic])
paulson@18886
   597
done
paulson@18886
   598
paulson@18886
   599
text{*Anticipated here from next subsection*}
paulson@18886
   600
lemma u_K4_imp_K2:
paulson@18886
   601
"\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   602
      \<in> set evs; evs \<in> kerbIV_gets\<rbrakk>
paulson@18886
   603
   \<Longrightarrow> \<exists>Ta. (Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   604
           Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   605
             \<in> set evs
paulson@18886
   606
          & servKlife + Ts <= authKlife + Ta)"
paulson@18886
   607
apply (erule rev_mp)
paulson@18886
   608
apply (erule kerbIV_gets.induct)
paulson@18886
   609
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   610
apply (frule_tac [6] Gets_ticket_parts, simp_all, auto)
paulson@18886
   611
apply (blast dest!: Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst, THEN authTicket_authentic])
paulson@18886
   612
done
paulson@18886
   613
paulson@18886
   614
lemma servTicket_authentic_Kas:
paulson@18886
   615
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
   616
           \<in> parts (spies evs);  B \<noteq> Tgs;  B \<notin> bad;
paulson@18886
   617
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   618
  \<Longrightarrow> \<exists>authK Ta.
paulson@18886
   619
       Says Kas A
paulson@18886
   620
         (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   621
            Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   622
        \<in> set evs"
paulson@18886
   623
apply (blast dest!: servTicket_authentic_Tgs K4_imp_K2)
paulson@18886
   624
done
paulson@18886
   625
paulson@18886
   626
lemma u_servTicket_authentic_Kas:
paulson@18886
   627
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
   628
           \<in> parts (spies evs);  B \<noteq> Tgs;  B \<notin> bad;
paulson@18886
   629
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   630
  \<Longrightarrow> \<exists>authK Ta. Says Kas A (Crypt(shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   631
           Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   632
             \<in> set evs
paulson@18886
   633
           & servKlife + Ts <= authKlife + Ta"
paulson@18886
   634
apply (blast dest!: servTicket_authentic_Tgs u_K4_imp_K2)
paulson@18886
   635
done
paulson@18886
   636
paulson@18886
   637
lemma servTicket_authentic:
paulson@18886
   638
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
   639
           \<in> parts (spies evs);  B \<noteq> Tgs;  B \<notin> bad;
paulson@18886
   640
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   641
 \<Longrightarrow> \<exists>Ta authK.
paulson@18886
   642
     Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   643
                   Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   644
       \<in> set evs
paulson@18886
   645
     & Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   646
                   Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace>)
paulson@18886
   647
       \<in> set evs"
paulson@18886
   648
apply (blast dest: servTicket_authentic_Tgs K4_imp_K2)
paulson@18886
   649
done
paulson@18886
   650
paulson@18886
   651
lemma u_servTicket_authentic:
paulson@18886
   652
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
   653
           \<in> parts (spies evs);  B \<noteq> Tgs;  B \<notin> bad;
paulson@18886
   654
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   655
 \<Longrightarrow> \<exists>Ta authK.
paulson@18886
   656
     (Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
   657
                   Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
   658
       \<in> set evs
paulson@18886
   659
     & Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   660
                   Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace>)
paulson@18886
   661
       \<in> set evs
paulson@18886
   662
     & servKlife + Ts <= authKlife + Ta)"
paulson@18886
   663
apply (blast dest: servTicket_authentic_Tgs u_K4_imp_K2)
paulson@18886
   664
done
paulson@18886
   665
paulson@18886
   666
lemma u_NotexpiredSK_NotexpiredAK:
paulson@18886
   667
     "\<lbrakk> \<not> expiredSK Ts evs; servKlife + Ts <= authKlife + Ta \<rbrakk>
paulson@18886
   668
      \<Longrightarrow> \<not> expiredAK Ta evs"
paulson@18886
   669
apply (blast dest: leI le_trans dest: leD)
paulson@18886
   670
done
paulson@18886
   671
paulson@18886
   672
paulson@18886
   673
subsection{* Reliability: friendly agents send something if something else happened*}
paulson@18886
   674
paulson@18886
   675
lemma K3_imp_K2:
paulson@18886
   676
     "\<lbrakk> Says A Tgs
paulson@18886
   677
             \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace>
paulson@18886
   678
           \<in> set evs;
paulson@18886
   679
         A \<notin> bad;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   680
      \<Longrightarrow> \<exists>Ta. Says Kas A (Crypt (shrK A)
paulson@18886
   681
                      \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>)
paulson@18886
   682
                   \<in> set evs"
paulson@18886
   683
apply (erule rev_mp)
paulson@18886
   684
apply (erule kerbIV_gets.induct)
paulson@18886
   685
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   686
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast, blast)
paulson@18886
   687
apply (blast dest: Gets_imp_knows_Spy [THEN parts.Inj, THEN authK_authentic])
paulson@18886
   688
done
paulson@18886
   689
paulson@18886
   690
text{*Anticipated here from next subsection. An authK is encrypted by one and only one Shared key. A servK is encrypted by one and only one authK.*}
paulson@18886
   691
lemma Key_unique_SesKey:
paulson@18886
   692
     "\<lbrakk> Crypt K  \<lbrace>Key SesKey,  Agent B, T, Ticket\<rbrace>
paulson@18886
   693
           \<in> parts (spies evs);
paulson@18886
   694
         Crypt K' \<lbrace>Key SesKey,  Agent B', T', Ticket'\<rbrace>
paulson@18886
   695
           \<in> parts (spies evs);  Key SesKey \<notin> analz (spies evs);
paulson@18886
   696
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   697
      \<Longrightarrow> K=K' & B=B' & T=T' & Ticket=Ticket'"
paulson@18886
   698
apply (erule rev_mp)
paulson@18886
   699
apply (erule rev_mp)
paulson@18886
   700
apply (erule rev_mp)
paulson@18886
   701
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   702
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   703
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   704
txt{*Fake, K2, K4*}
paulson@18886
   705
apply (blast+)
paulson@18886
   706
done
paulson@18886
   707
paulson@18886
   708
lemma Tgs_authenticates_A:
paulson@18886
   709
  "\<lbrakk>  Crypt authK \<lbrace>Agent A, Number T2\<rbrace> \<in> parts (spies evs); 
paulson@18886
   710
      Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>
paulson@18886
   711
           \<in> parts (spies evs);
paulson@18886
   712
      Key authK \<notin> analz (spies evs); A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   713
 \<Longrightarrow> \<exists> B. Says A Tgs \<lbrace>
paulson@18886
   714
          Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>,
paulson@18886
   715
          Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B \<rbrace> \<in> set evs"  
paulson@18886
   716
apply (drule authTicket_authentic, assumption, rotate_tac 4)
paulson@18886
   717
apply (erule rev_mp, erule rev_mp, erule rev_mp)
paulson@18886
   718
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   719
apply (frule_tac [6] Gets_ticket_parts)
paulson@18886
   720
apply (frule_tac [9] Gets_ticket_parts)
paulson@18886
   721
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   722
txt{*Fake*}
paulson@18886
   723
apply blast
paulson@18886
   724
txt{*K2*}
paulson@18886
   725
apply (force dest!: Crypt_imp_keysFor)
paulson@18886
   726
txt{*K3*}
paulson@18886
   727
apply (blast dest: Key_unique_SesKey)
paulson@18886
   728
txt{*K5*}
paulson@18886
   729
txt{*If authKa were compromised, so would be authK*}
paulson@18886
   730
apply (case_tac "Key authKa \<in> analz (spies evs5)")
paulson@18886
   731
apply (force dest!: Gets_imp_knows_Spy [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
   732
txt{*Besides, since authKa originated with Kas anyway...*}
paulson@18886
   733
apply (clarify, drule K3_imp_K2, assumption, assumption)
paulson@18886
   734
apply (clarify, drule Says_Kas_message_form, assumption)
paulson@18886
   735
txt{*...it cannot be a shared key*. Therefore @{term servK_authentic} applies. 
paulson@18886
   736
     Contradition: Tgs used authK as a servkey, 
paulson@18886
   737
     while Kas used it as an authkey*}
paulson@18886
   738
apply (blast dest: servK_authentic Says_Tgs_message_form)
paulson@18886
   739
done
paulson@18886
   740
paulson@18886
   741
lemma Says_K5:
paulson@18886
   742
     "\<lbrakk> Crypt servK \<lbrace>Agent A, Number T3\<rbrace> \<in> parts (spies evs);
paulson@18886
   743
         Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   744
                                     servTicket\<rbrace>) \<in> set evs;
paulson@18886
   745
         Key servK \<notin> analz (spies evs);
paulson@18886
   746
         A \<notin> bad; B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   747
 \<Longrightarrow> Says A B \<lbrace>servTicket, Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   748
apply (erule rev_mp)
paulson@18886
   749
apply (erule rev_mp)
paulson@18886
   750
apply (erule rev_mp)
paulson@18886
   751
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   752
apply (frule_tac [6] Gets_ticket_parts)
paulson@18886
   753
apply (frule_tac [9] Gets_ticket_parts)
paulson@18886
   754
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   755
apply blast
paulson@18886
   756
txt{*K3*}
paulson@18886
   757
apply (blast dest: authK_authentic Says_Kas_message_form Says_Tgs_message_form)
paulson@18886
   758
txt{*K4*}
paulson@18886
   759
apply (force dest!: Crypt_imp_keysFor)
paulson@18886
   760
txt{*K5*}
paulson@18886
   761
apply (blast dest: Key_unique_SesKey)
paulson@18886
   762
done
paulson@18886
   763
paulson@18886
   764
text{*Anticipated here from next subsection*}
paulson@18886
   765
lemma unique_CryptKey:
paulson@18886
   766
     "\<lbrakk> Crypt (shrK B)  \<lbrace>Agent A,  Agent B,  Key SesKey, T\<rbrace>
paulson@18886
   767
           \<in> parts (spies evs);
paulson@18886
   768
         Crypt (shrK B') \<lbrace>Agent A', Agent B', Key SesKey, T'\<rbrace>
paulson@18886
   769
           \<in> parts (spies evs);  Key SesKey \<notin> analz (spies evs);
paulson@18886
   770
         evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   771
      \<Longrightarrow> A=A' & B=B' & T=T'"
paulson@18886
   772
apply (erule rev_mp)
paulson@18886
   773
apply (erule rev_mp)
paulson@18886
   774
apply (erule rev_mp)
paulson@18886
   775
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   776
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   777
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   778
txt{*Fake, K2, K4*}
paulson@18886
   779
apply (blast+)
paulson@18886
   780
done
paulson@18886
   781
paulson@18886
   782
lemma Says_K6:
paulson@18886
   783
     "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs);
paulson@18886
   784
         Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   785
                                     servTicket\<rbrace>) \<in> set evs;
paulson@18886
   786
         Key servK \<notin> analz (spies evs);
paulson@18886
   787
         A \<notin> bad; B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   788
      \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs"
paulson@18886
   789
apply (erule rev_mp)
paulson@18886
   790
apply (erule rev_mp)
paulson@18886
   791
apply (erule rev_mp)
paulson@18886
   792
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   793
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   794
apply (frule_tac [6] Gets_ticket_parts)
paulson@18886
   795
apply (simp_all (no_asm_simp))
paulson@18886
   796
apply blast
paulson@18886
   797
apply (force dest!: Crypt_imp_keysFor, clarify)
paulson@18886
   798
apply (frule Says_Tgs_message_form, assumption, clarify) (*PROOF FAILED if omitted*)
paulson@18886
   799
apply (blast dest: unique_CryptKey)
paulson@18886
   800
done
paulson@18886
   801
paulson@18886
   802
text{*Needs a unicity theorem, hence moved here*}
paulson@18886
   803
lemma servK_authentic_ter:
paulson@18886
   804
 "\<lbrakk> Says Kas A
paulson@18886
   805
    (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>) \<in> set evs;
paulson@18886
   806
     Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
   807
       \<in> parts (spies evs);
paulson@18886
   808
     Key authK \<notin> analz (spies evs);
paulson@18886
   809
     evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   810
 \<Longrightarrow> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
   811
       \<in> set evs"
paulson@18886
   812
apply (frule Says_Kas_message_form, assumption)
paulson@18886
   813
apply (erule rev_mp)
paulson@18886
   814
apply (erule rev_mp)
paulson@18886
   815
apply (erule rev_mp)
paulson@18886
   816
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   817
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   818
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast)
paulson@18886
   819
txt{*K2 and K4 remain*}
paulson@18886
   820
prefer 2 apply (blast dest!: unique_CryptKey)
paulson@18886
   821
apply (blast dest!: servK_authentic Says_Tgs_message_form authKeys_used)
paulson@18886
   822
done
paulson@18886
   823
paulson@18886
   824
paulson@18886
   825
subsection{*Unicity Theorems*}
paulson@18886
   826
paulson@18886
   827
text{* The session key, if secure, uniquely identifies the Ticket
paulson@18886
   828
   whether authTicket or servTicket. As a matter of fact, one can read
paulson@18886
   829
   also Tgs in the place of B.                                     *}
paulson@18886
   830
paulson@18886
   831
paulson@18886
   832
lemma unique_authKeys:
paulson@18886
   833
     "\<lbrakk> Says Kas A
paulson@18886
   834
              (Crypt Ka \<lbrace>Key authK, Agent Tgs, Ta, X\<rbrace>) \<in> set evs;
paulson@18886
   835
         Says Kas A'
paulson@18886
   836
              (Crypt Ka' \<lbrace>Key authK, Agent Tgs, Ta', X'\<rbrace>) \<in> set evs;
paulson@18886
   837
         evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> A=A' & Ka=Ka' & Ta=Ta' & X=X'"
paulson@18886
   838
apply (erule rev_mp)
paulson@18886
   839
apply (erule rev_mp)
paulson@18886
   840
apply (erule kerbIV_gets.induct)
paulson@18886
   841
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   842
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   843
txt{*K2*}
paulson@18886
   844
apply blast
paulson@18886
   845
done
paulson@18886
   846
paulson@18886
   847
text{* servK uniquely identifies the message from Tgs *}
paulson@18886
   848
lemma unique_servKeys:
paulson@18886
   849
     "\<lbrakk> Says Tgs A
paulson@18886
   850
              (Crypt K \<lbrace>Key servK, Agent B, Ts, X\<rbrace>) \<in> set evs;
paulson@18886
   851
         Says Tgs A'
paulson@18886
   852
              (Crypt K' \<lbrace>Key servK, Agent B', Ts', X'\<rbrace>) \<in> set evs;
paulson@18886
   853
         evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> A=A' & B=B' & K=K' & Ts=Ts' & X=X'"
paulson@18886
   854
apply (erule rev_mp)
paulson@18886
   855
apply (erule rev_mp)
paulson@18886
   856
apply (erule kerbIV_gets.induct)
paulson@18886
   857
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   858
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   859
txt{*K4*}
paulson@18886
   860
apply blast
paulson@18886
   861
done
paulson@18886
   862
paulson@18886
   863
text{* Revised unicity theorems *}
paulson@18886
   864
paulson@18886
   865
lemma Kas_Unique:
paulson@18886
   866
     "\<lbrakk> Says Kas A
paulson@18886
   867
              (Crypt Ka \<lbrace>Key authK, Agent Tgs, Ta, authTicket\<rbrace>) \<in> set evs;
paulson@18886
   868
        evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> 
paulson@18886
   869
   Unique (Says Kas A (Crypt Ka \<lbrace>Key authK, Agent Tgs, Ta, authTicket\<rbrace>)) 
paulson@18886
   870
   on evs"
paulson@18886
   871
apply (erule rev_mp, erule kerbIV_gets.induct, simp_all add: Unique_def)
paulson@18886
   872
apply blast
paulson@18886
   873
done
paulson@18886
   874
paulson@18886
   875
lemma Tgs_Unique:
paulson@18886
   876
     "\<lbrakk> Says Tgs A
paulson@18886
   877
              (Crypt authK \<lbrace>Key servK, Agent B, Ts, servTicket\<rbrace>) \<in> set evs;
paulson@18886
   878
        evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> 
paulson@18886
   879
  Unique (Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Ts, servTicket\<rbrace>)) 
paulson@18886
   880
  on evs"
paulson@18886
   881
apply (erule rev_mp, erule kerbIV_gets.induct, simp_all add: Unique_def)
paulson@18886
   882
apply blast
paulson@18886
   883
done
paulson@18886
   884
paulson@18886
   885
paulson@18886
   886
subsection{*Lemmas About the Predicate @{term AKcryptSK}*}
paulson@18886
   887
paulson@18886
   888
lemma not_AKcryptSK_Nil [iff]: "\<not> AKcryptSK authK servK []"
paulson@18886
   889
by (simp add: AKcryptSK_def)
paulson@18886
   890
paulson@18886
   891
lemma AKcryptSKI:
paulson@18886
   892
 "\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, X \<rbrace>) \<in> set evs;
paulson@18886
   893
     evs \<in> kerbIV_gets \<rbrakk> \<Longrightarrow> AKcryptSK authK servK evs"
paulson@18886
   894
apply (unfold AKcryptSK_def)
paulson@18886
   895
apply (blast dest: Says_Tgs_message_form)
paulson@18886
   896
done
paulson@18886
   897
paulson@18886
   898
lemma AKcryptSK_Says [simp]:
paulson@18886
   899
   "AKcryptSK authK servK (Says S A X # evs) =
paulson@18886
   900
     (Tgs = S &
paulson@18886
   901
      (\<exists>B Ts. X = Crypt authK
paulson@18886
   902
                \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
   903
                  Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace> \<rbrace>)
paulson@18886
   904
     | AKcryptSK authK servK evs)"
paulson@18886
   905
apply (unfold AKcryptSK_def)
paulson@18886
   906
apply (simp (no_asm))
paulson@18886
   907
apply blast
paulson@18886
   908
done
paulson@18886
   909
paulson@18886
   910
(*A fresh authK cannot be associated with any other
paulson@18886
   911
  (with respect to a given trace). *)
paulson@18886
   912
lemma Auth_fresh_not_AKcryptSK:
paulson@18886
   913
     "\<lbrakk> Key authK \<notin> used evs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   914
      \<Longrightarrow> \<not> AKcryptSK authK servK evs"
paulson@18886
   915
apply (unfold AKcryptSK_def)
paulson@18886
   916
apply (erule rev_mp)
paulson@18886
   917
apply (erule kerbIV_gets.induct)
paulson@18886
   918
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   919
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast)
paulson@18886
   920
done
paulson@18886
   921
paulson@18886
   922
(*A fresh servK cannot be associated with any other
paulson@18886
   923
  (with respect to a given trace). *)
paulson@18886
   924
lemma Serv_fresh_not_AKcryptSK:
paulson@18886
   925
 "Key servK \<notin> used evs \<Longrightarrow> \<not> AKcryptSK authK servK evs"
paulson@18886
   926
apply (unfold AKcryptSK_def, blast)
paulson@18886
   927
done
paulson@18886
   928
paulson@18886
   929
lemma authK_not_AKcryptSK:
paulson@18886
   930
     "\<lbrakk> Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, tk\<rbrace>
paulson@18886
   931
           \<in> parts (spies evs);  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   932
      \<Longrightarrow> \<not> AKcryptSK K authK evs"
paulson@18886
   933
apply (erule rev_mp)
paulson@18886
   934
apply (erule kerbIV_gets.induct)
paulson@18886
   935
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   936
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
   937
txt{*Fake*}
paulson@18886
   938
apply blast
paulson@18886
   939
txt{*Reception*}
paulson@18886
   940
apply (simp add: AKcryptSK_def)
paulson@18886
   941
txt{*K2: by freshness*}
paulson@18886
   942
apply (simp add: AKcryptSK_def)
paulson@18886
   943
txt{*K4*}
paulson@18886
   944
apply (blast+)
paulson@18886
   945
done
paulson@18886
   946
paulson@18886
   947
text{*A secure serverkey cannot have been used to encrypt others*}
paulson@18886
   948
lemma servK_not_AKcryptSK:
paulson@18886
   949
 "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key SK, Number Ts\<rbrace> \<in> parts (spies evs);
paulson@18886
   950
     Key SK \<notin> analz (spies evs);  SK \<in> symKeys;
paulson@18886
   951
     B \<noteq> Tgs;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   952
  \<Longrightarrow> \<not> AKcryptSK SK K evs"
paulson@18886
   953
apply (erule rev_mp)
paulson@18886
   954
apply (erule rev_mp)
paulson@18886
   955
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
   956
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   957
apply (frule_tac [6] Gets_ticket_parts, simp_all, blast)
paulson@18886
   958
txt{*Reception*}
paulson@18886
   959
apply (simp add: AKcryptSK_def)
paulson@18886
   960
txt{*K4 splits into distinct subcases*}
paulson@18886
   961
apply auto
paulson@18886
   962
txt{*servK can't have been enclosed in two certificates*}
paulson@18886
   963
 prefer 2 apply (blast dest: unique_CryptKey)
paulson@18886
   964
txt{*servK is fresh and so could not have been used, by
paulson@18886
   965
   @{text new_keys_not_used}*}
paulson@18886
   966
apply (force dest!: Crypt_imp_invKey_keysFor simp add: AKcryptSK_def)
paulson@18886
   967
done
paulson@18886
   968
paulson@18886
   969
text{*Long term keys are not issued as servKeys*}
paulson@18886
   970
lemma shrK_not_AKcryptSK:
paulson@18886
   971
     "evs \<in> kerbIV_gets \<Longrightarrow> \<not> AKcryptSK K (shrK A) evs"
paulson@18886
   972
apply (unfold AKcryptSK_def)
paulson@18886
   973
apply (erule kerbIV_gets.induct)
paulson@18886
   974
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
   975
apply (frule_tac [6] Gets_ticket_parts, auto)
paulson@18886
   976
done
paulson@18886
   977
paulson@18886
   978
text{*The Tgs message associates servK with authK and therefore not with any
paulson@18886
   979
  other key authK.*}
paulson@18886
   980
lemma Says_Tgs_AKcryptSK:
paulson@18886
   981
     "\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, X \<rbrace>)
paulson@18886
   982
           \<in> set evs;
paulson@18886
   983
         authK' \<noteq> authK;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   984
      \<Longrightarrow> \<not> AKcryptSK authK' servK evs"
paulson@18886
   985
apply (unfold AKcryptSK_def)
paulson@18886
   986
apply (blast dest: unique_servKeys)
paulson@18886
   987
done
paulson@18886
   988
paulson@18886
   989
text{*Equivalently*}
paulson@18886
   990
lemma not_different_AKcryptSK:
paulson@18886
   991
     "\<lbrakk> AKcryptSK authK servK evs;
paulson@18886
   992
        authK' \<noteq> authK;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
   993
      \<Longrightarrow> \<not> AKcryptSK authK' servK evs  \<and> servK \<in> symKeys"
paulson@18886
   994
apply (simp add: AKcryptSK_def)
paulson@18886
   995
apply (blast dest: unique_servKeys Says_Tgs_message_form)
paulson@18886
   996
done
paulson@18886
   997
paulson@18886
   998
lemma AKcryptSK_not_AKcryptSK:
paulson@18886
   999
     "\<lbrakk> AKcryptSK authK servK evs;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1000
      \<Longrightarrow> \<not> AKcryptSK servK K evs"
paulson@18886
  1001
apply (erule rev_mp)
paulson@18886
  1002
apply (erule kerbIV_gets.induct)
paulson@18886
  1003
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
  1004
apply (frule_tac [6] Gets_ticket_parts)
paulson@18886
  1005
txt{*Reception*}
paulson@18886
  1006
prefer 3 apply (simp add: AKcryptSK_def)
paulson@18886
  1007
apply (simp_all, safe)
paulson@18886
  1008
txt{*K4 splits into subcases*}
paulson@18886
  1009
prefer 4 apply (blast dest!: authK_not_AKcryptSK)
paulson@18886
  1010
txt{*servK is fresh and so could not have been used, by
paulson@18886
  1011
   @{text new_keys_not_used}*}
paulson@18886
  1012
 prefer 2 
paulson@18886
  1013
 apply (force dest!: Crypt_imp_invKey_keysFor simp add: AKcryptSK_def)
paulson@18886
  1014
txt{*Others by freshness*}
paulson@18886
  1015
apply (blast+)
paulson@18886
  1016
done
paulson@18886
  1017
paulson@18886
  1018
text{*The only session keys that can be found with the help of session keys are
paulson@18886
  1019
  those sent by Tgs in step K4.  *}
paulson@18886
  1020
paulson@18886
  1021
text{*We take some pains to express the property
paulson@18886
  1022
  as a logical equivalence so that the simplifier can apply it.*}
paulson@18886
  1023
lemma Key_analz_image_Key_lemma:
paulson@18886
  1024
     "P \<longrightarrow> (Key K \<in> analz (Key`KK Un H)) \<longrightarrow> (K:KK | Key K \<in> analz H)
paulson@18886
  1025
      \<Longrightarrow>
paulson@18886
  1026
      P \<longrightarrow> (Key K \<in> analz (Key`KK Un H)) = (K:KK | Key K \<in> analz H)"
paulson@18886
  1027
by (blast intro: analz_mono [THEN subsetD])
paulson@18886
  1028
paulson@18886
  1029
paulson@18886
  1030
lemma AKcryptSK_analz_insert:
paulson@18886
  1031
     "\<lbrakk> AKcryptSK K K' evs; K \<in> symKeys; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1032
      \<Longrightarrow> Key K' \<in> analz (insert (Key K) (spies evs))"
paulson@18886
  1033
apply (simp add: AKcryptSK_def, clarify)
paulson@18886
  1034
apply (drule Says_imp_spies [THEN analz.Inj, THEN analz_insertI], auto)
paulson@18886
  1035
done
paulson@18886
  1036
paulson@18886
  1037
lemma authKeys_are_not_AKcryptSK:
paulson@18886
  1038
     "\<lbrakk> K \<in> authKeys evs Un range shrK;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1039
      \<Longrightarrow> \<forall>SK. \<not> AKcryptSK SK K evs \<and> K \<in> symKeys"
paulson@18886
  1040
apply (simp add: authKeys_def AKcryptSK_def)
paulson@18886
  1041
apply (blast dest: Says_Kas_message_form Says_Tgs_message_form)
paulson@18886
  1042
done
paulson@18886
  1043
paulson@18886
  1044
lemma not_authKeys_not_AKcryptSK:
paulson@18886
  1045
     "\<lbrakk> K \<notin> authKeys evs;
paulson@18886
  1046
         K \<notin> range shrK; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1047
      \<Longrightarrow> \<forall>SK. \<not> AKcryptSK K SK evs"
paulson@18886
  1048
apply (simp add: AKcryptSK_def)
paulson@18886
  1049
apply (blast dest: Says_Tgs_message_form)
paulson@18886
  1050
done
paulson@18886
  1051
paulson@18886
  1052
paulson@18886
  1053
subsection{*Secrecy Theorems*}
paulson@18886
  1054
paulson@18886
  1055
text{*For the Oops2 case of the next theorem*}
paulson@18886
  1056
lemma Oops2_not_AKcryptSK:
paulson@18886
  1057
     "\<lbrakk> evs \<in> kerbIV_gets;
paulson@18886
  1058
         Says Tgs A (Crypt authK
paulson@18886
  1059
                     \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1060
           \<in> set evs \<rbrakk>
paulson@18886
  1061
      \<Longrightarrow> \<not> AKcryptSK servK SK evs"
paulson@18886
  1062
apply (blast dest: AKcryptSKI AKcryptSK_not_AKcryptSK)
paulson@18886
  1063
done
paulson@18886
  1064
   
paulson@18886
  1065
text{* Big simplification law for keys SK that are not crypted by keys in KK
paulson@18886
  1066
 It helps prove three, otherwise hard, facts about keys. These facts are
paulson@18886
  1067
 exploited as simplification laws for analz, and also "limit the damage"
paulson@18886
  1068
 in case of loss of a key to the spy. See ESORICS98. *}
paulson@18886
  1069
lemma Key_analz_image_Key [rule_format (no_asm)]:
paulson@18886
  1070
     "evs \<in> kerbIV_gets \<Longrightarrow>
paulson@18886
  1071
      (\<forall>SK KK. SK \<in> symKeys & KK <= -(range shrK) \<longrightarrow>
paulson@18886
  1072
       (\<forall>K \<in> KK. \<not> AKcryptSK K SK evs)   \<longrightarrow>
paulson@18886
  1073
       (Key SK \<in> analz (Key`KK Un (spies evs))) =
paulson@18886
  1074
       (SK \<in> KK | Key SK \<in> analz (spies evs)))"
paulson@18886
  1075
apply (erule kerbIV_gets.induct)
paulson@18886
  1076
apply (frule_tac [11] Oops_range_spies2)
paulson@18886
  1077
apply (frule_tac [10] Oops_range_spies1)
paulson@18886
  1078
apply (frule_tac [8] Says_tgs_message_form)
paulson@18886
  1079
apply (frule_tac [6] Says_kas_message_form)
paulson@18886
  1080
apply (safe del: impI intro!: Key_analz_image_Key_lemma [THEN impI])
paulson@18886
  1081
txt{*Case-splits for Oops1 and message 5: the negated case simplifies using
paulson@18886
  1082
 the induction hypothesis*}
paulson@18886
  1083
apply (case_tac [12] "AKcryptSK authK SK evsO1")
paulson@18886
  1084
apply (case_tac [9] "AKcryptSK servK SK evs5")
paulson@18886
  1085
apply (simp_all del: image_insert
paulson@18886
  1086
        add: analz_image_freshK_simps AKcryptSK_Says shrK_not_AKcryptSK
paulson@18886
  1087
             Oops2_not_AKcryptSK Auth_fresh_not_AKcryptSK
paulson@18886
  1088
       Serv_fresh_not_AKcryptSK Says_Tgs_AKcryptSK Spy_analz_shrK)
paulson@18886
  1089
  --{*18 seconds on a 1.8GHz machine??*}
paulson@18886
  1090
txt{*Fake*} 
paulson@18886
  1091
apply spy_analz
paulson@18886
  1092
txt{*Reception*}
paulson@18886
  1093
apply (simp add: AKcryptSK_def)
paulson@18886
  1094
txt{*K2*}
paulson@18886
  1095
apply blast 
paulson@18886
  1096
txt{*K3*}
paulson@18886
  1097
apply blast 
paulson@18886
  1098
txt{*K4*}
paulson@18886
  1099
apply (blast dest!: authK_not_AKcryptSK)
paulson@18886
  1100
txt{*K5*}
paulson@18886
  1101
apply (case_tac "Key servK \<in> analz (spies evs5) ")
paulson@18886
  1102
txt{*If servK is compromised then the result follows directly...*}
paulson@18886
  1103
apply (simp (no_asm_simp) add: analz_insert_eq Un_upper2 [THEN analz_mono, THEN subsetD])
paulson@18886
  1104
txt{*...therefore servK is uncompromised.*}
paulson@18886
  1105
txt{*The AKcryptSK servK SK evs5 case leads to a contradiction.*}
paulson@18886
  1106
apply (blast elim!: servK_not_AKcryptSK [THEN [2] rev_notE] del: allE ballE)
paulson@18886
  1107
txt{*Another K5 case*}
paulson@18886
  1108
apply blast 
paulson@18886
  1109
txt{*Oops1*}
paulson@18886
  1110
apply simp 
paulson@18886
  1111
apply (blast dest!: AKcryptSK_analz_insert)
paulson@18886
  1112
done
paulson@18886
  1113
paulson@18886
  1114
text{* First simplification law for analz: no session keys encrypt
paulson@18886
  1115
authentication keys or shared keys. *}
paulson@18886
  1116
lemma analz_insert_freshK1:
paulson@18886
  1117
     "\<lbrakk> evs \<in> kerbIV_gets;  K \<in> authKeys evs Un range shrK;
paulson@18886
  1118
        SesKey \<notin> range shrK \<rbrakk>
paulson@18886
  1119
      \<Longrightarrow> (Key K \<in> analz (insert (Key SesKey) (spies evs))) =
paulson@18886
  1120
          (K = SesKey | Key K \<in> analz (spies evs))"
paulson@18886
  1121
apply (frule authKeys_are_not_AKcryptSK, assumption)
paulson@18886
  1122
apply (simp del: image_insert
paulson@18886
  1123
            add: analz_image_freshK_simps add: Key_analz_image_Key)
paulson@18886
  1124
done
paulson@18886
  1125
paulson@18886
  1126
paulson@18886
  1127
text{* Second simplification law for analz: no service keys encrypt any other keys.*}
paulson@18886
  1128
lemma analz_insert_freshK2:
paulson@18886
  1129
     "\<lbrakk> evs \<in> kerbIV_gets;  servK \<notin> (authKeys evs); servK \<notin> range shrK;
paulson@18886
  1130
        K \<in> symKeys \<rbrakk>
paulson@18886
  1131
      \<Longrightarrow> (Key K \<in> analz (insert (Key servK) (spies evs))) =
paulson@18886
  1132
          (K = servK | Key K \<in> analz (spies evs))"
paulson@18886
  1133
apply (frule not_authKeys_not_AKcryptSK, assumption, assumption)
paulson@18886
  1134
apply (simp del: image_insert
paulson@18886
  1135
            add: analz_image_freshK_simps add: Key_analz_image_Key)
paulson@18886
  1136
done
paulson@18886
  1137
paulson@18886
  1138
paulson@18886
  1139
text{* Third simplification law for analz: only one authentication key encrypts a certain service key.*}
paulson@18886
  1140
paulson@18886
  1141
lemma analz_insert_freshK3:
paulson@18886
  1142
 "\<lbrakk> AKcryptSK authK servK evs;
paulson@18886
  1143
    authK' \<noteq> authK; authK' \<notin> range shrK; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1144
        \<Longrightarrow> (Key servK \<in> analz (insert (Key authK') (spies evs))) =
paulson@18886
  1145
                (servK = authK' | Key servK \<in> analz (spies evs))"
paulson@18886
  1146
apply (drule_tac authK' = authK' in not_different_AKcryptSK, blast, assumption)
paulson@18886
  1147
apply (simp del: image_insert
paulson@18886
  1148
            add: analz_image_freshK_simps add: Key_analz_image_Key)
paulson@18886
  1149
done
paulson@18886
  1150
paulson@18886
  1151
lemma analz_insert_freshK3_bis:
paulson@18886
  1152
 "\<lbrakk> Says Tgs A
paulson@18886
  1153
            (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1154
        \<in> set evs; 
paulson@18886
  1155
     authK \<noteq> authK'; authK' \<notin> range shrK; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1156
        \<Longrightarrow> (Key servK \<in> analz (insert (Key authK') (spies evs))) =
paulson@18886
  1157
                (servK = authK' | Key servK \<in> analz (spies evs))"
paulson@18886
  1158
apply (frule AKcryptSKI, assumption)
paulson@18886
  1159
apply (simp add: analz_insert_freshK3)
paulson@18886
  1160
done
paulson@18886
  1161
paulson@18886
  1162
text{*a weakness of the protocol*}
paulson@18886
  1163
lemma authK_compromises_servK:
paulson@18886
  1164
     "\<lbrakk> Says Tgs A
paulson@18886
  1165
              (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1166
           \<in> set evs;  authK \<in> symKeys;
paulson@18886
  1167
         Key authK \<in> analz (spies evs); evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1168
      \<Longrightarrow> Key servK \<in> analz (spies evs)"
paulson@18886
  1169
by (force dest: Says_imp_spies [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
  1170
paulson@18886
  1171
lemma servK_notin_authKeysD:
paulson@18886
  1172
     "\<lbrakk> Crypt authK \<lbrace>Key servK, Agent B, Ts,
paulson@18886
  1173
                      Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Ts\<rbrace>\<rbrace>
paulson@18886
  1174
           \<in> parts (spies evs);
paulson@18886
  1175
         Key servK \<notin> analz (spies evs);
paulson@18886
  1176
         B \<noteq> Tgs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1177
      \<Longrightarrow> servK \<notin> authKeys evs"
paulson@18886
  1178
apply (erule rev_mp)
paulson@18886
  1179
apply (erule rev_mp)
paulson@18886
  1180
apply (simp add: authKeys_def)
paulson@18886
  1181
apply (erule kerbIV_gets.induct, analz_mono_contra)
paulson@18886
  1182
apply (frule_tac [8] Gets_ticket_parts)
paulson@18886
  1183
apply (frule_tac [6] Gets_ticket_parts, simp_all)
paulson@18886
  1184
apply (blast+)
paulson@18886
  1185
done
paulson@18886
  1186
paulson@18886
  1187
paulson@18886
  1188
text{*If Spy sees the Authentication Key sent in msg K2, then
paulson@18886
  1189
    the Key has expired.*}
paulson@18886
  1190
lemma Confidentiality_Kas_lemma [rule_format]:
paulson@18886
  1191
     "\<lbrakk> authK \<in> symKeys; A \<notin> bad;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1192
      \<Longrightarrow> Says Kas A
paulson@18886
  1193
               (Crypt (shrK A)
paulson@18886
  1194
                  \<lbrace>Key authK, Agent Tgs, Number Ta,
paulson@18886
  1195
          Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
  1196
            \<in> set evs \<longrightarrow>
paulson@18886
  1197
          Key authK \<in> analz (spies evs) \<longrightarrow>
paulson@18886
  1198
          expiredAK Ta evs"
paulson@18886
  1199
apply (erule kerbIV_gets.induct)
paulson@18886
  1200
apply (frule_tac [11] Oops_range_spies2)
paulson@18886
  1201
apply (frule_tac [10] Oops_range_spies1)
paulson@18886
  1202
apply (frule_tac [8] Says_tgs_message_form)
paulson@18886
  1203
apply (frule_tac [6] Says_kas_message_form)
paulson@18886
  1204
apply (safe del: impI conjI impCE)
paulson@18886
  1205
apply (simp_all (no_asm_simp) add: Says_Kas_message_form less_SucI analz_insert_eq not_parts_not_analz analz_insert_freshK1 pushes)
paulson@18886
  1206
txt{*Fake*}
paulson@18886
  1207
apply spy_analz
paulson@18886
  1208
txt{*K2*}
paulson@18886
  1209
apply blast
paulson@18886
  1210
txt{*K4*}
paulson@18886
  1211
apply blast
paulson@18886
  1212
txt{*Level 8: K5*}
paulson@18886
  1213
apply (blast dest: servK_notin_authKeysD Says_Kas_message_form intro: less_SucI)
paulson@18886
  1214
txt{*Oops1*}
paulson@18886
  1215
apply (blast dest!: unique_authKeys intro: less_SucI)
paulson@18886
  1216
txt{*Oops2*}
paulson@18886
  1217
apply (blast dest: Says_Tgs_message_form Says_Kas_message_form)
paulson@18886
  1218
done
paulson@18886
  1219
paulson@18886
  1220
lemma Confidentiality_Kas:
paulson@18886
  1221
     "\<lbrakk> Says Kas A
paulson@18886
  1222
              (Crypt Ka \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>)
paulson@18886
  1223
           \<in> set evs;
paulson@18886
  1224
         \<not> expiredAK Ta evs;
paulson@18886
  1225
         A \<notin> bad;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1226
      \<Longrightarrow> Key authK \<notin> analz (spies evs)"
paulson@18886
  1227
by (blast dest: Says_Kas_message_form Confidentiality_Kas_lemma)
paulson@18886
  1228
paulson@18886
  1229
text{*If Spy sees the Service Key sent in msg K4, then
paulson@18886
  1230
    the Key has expired.*}
paulson@18886
  1231
paulson@18886
  1232
lemma Confidentiality_lemma [rule_format]:
paulson@18886
  1233
     "\<lbrakk> Says Tgs A
paulson@18886
  1234
	    (Crypt authK
paulson@18886
  1235
	       \<lbrace>Key servK, Agent B, Number Ts,
paulson@18886
  1236
		 Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>\<rbrace>)
paulson@18886
  1237
	   \<in> set evs;
paulson@18886
  1238
	Key authK \<notin> analz (spies evs);
paulson@18886
  1239
        servK \<in> symKeys;
paulson@18886
  1240
	A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1241
      \<Longrightarrow> Key servK \<in> analz (spies evs) \<longrightarrow>
paulson@18886
  1242
	  expiredSK Ts evs"
paulson@18886
  1243
apply (erule rev_mp)
paulson@18886
  1244
apply (erule rev_mp)
paulson@18886
  1245
apply (erule kerbIV_gets.induct)
paulson@18886
  1246
apply (rule_tac [10] impI)+;
paulson@18886
  1247
  --{*The Oops1 case is unusual: must simplify
paulson@18886
  1248
    @{term "Authkey \<notin> analz (spies (ev#evs))"}, not letting
paulson@18886
  1249
   @{text analz_mono_contra} weaken it to
paulson@18886
  1250
   @{term "Authkey \<notin> analz (spies evs)"},
paulson@18886
  1251
  for we then conclude @{term "authK \<noteq> authKa"}.*}
paulson@18886
  1252
apply analz_mono_contra
paulson@18886
  1253
apply (frule_tac [11] Oops_range_spies2)
paulson@18886
  1254
apply (frule_tac [10] Oops_range_spies1)
paulson@18886
  1255
apply (frule_tac [8] Says_tgs_message_form)
paulson@18886
  1256
apply (frule_tac [6] Says_kas_message_form)
paulson@18886
  1257
apply (safe del: impI conjI impCE)
paulson@18886
  1258
apply (simp_all add: less_SucI new_keys_not_analzd Says_Kas_message_form Says_Tgs_message_form analz_insert_eq not_parts_not_analz analz_insert_freshK1 analz_insert_freshK2 analz_insert_freshK3_bis pushes)
paulson@18886
  1259
txt{*Fake*}
paulson@18886
  1260
apply spy_analz
paulson@18886
  1261
txt{*K2*}
paulson@18886
  1262
apply (blast intro: parts_insertI less_SucI)
paulson@18886
  1263
txt{*K4*}
paulson@18886
  1264
apply (blast dest: authTicket_authentic Confidentiality_Kas)
paulson@18886
  1265
txt{*Oops2*}
paulson@18886
  1266
  prefer 3
paulson@18886
  1267
  apply (blast dest: Says_imp_spies [THEN parts.Inj] Key_unique_SesKey intro: less_SucI)
paulson@18886
  1268
txt{*Oops1*}
paulson@18886
  1269
 prefer 2
paulson@18886
  1270
apply (blast dest: Says_Kas_message_form Says_Tgs_message_form intro: less_SucI)
paulson@18886
  1271
txt{*K5. Not clear how this step could be integrated with the main
paulson@18886
  1272
       simplification step. Done in KerberosV.thy*}
paulson@18886
  1273
apply clarify
paulson@18886
  1274
apply (erule_tac V = "Says Aa Tgs ?X \<in> set ?evs" in thin_rl)
paulson@18886
  1275
apply (frule Gets_imp_knows_Spy [THEN parts.Inj, THEN servK_notin_authKeysD])
paulson@18886
  1276
apply (assumption, assumption, blast, assumption)
paulson@18886
  1277
apply (simp add: analz_insert_freshK2)
paulson@18886
  1278
apply (blast dest: Says_imp_spies [THEN parts.Inj] Key_unique_SesKey intro: less_SucI)
paulson@18886
  1279
done
paulson@18886
  1280
paulson@18886
  1281
paulson@18886
  1282
text{* In the real world Tgs can't check wheter authK is secure! *}
paulson@18886
  1283
lemma Confidentiality_Tgs:
paulson@18886
  1284
     "\<lbrakk> Says Tgs A
paulson@18886
  1285
              (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1286
           \<in> set evs;
paulson@18886
  1287
         Key authK \<notin> analz (spies evs);
paulson@18886
  1288
         \<not> expiredSK Ts evs;
paulson@18886
  1289
         A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1290
      \<Longrightarrow> Key servK \<notin> analz (spies evs)"
paulson@18886
  1291
apply (blast dest: Says_Tgs_message_form Confidentiality_lemma)
paulson@18886
  1292
done
paulson@18886
  1293
paulson@18886
  1294
text{* In the real world Tgs CAN check what Kas sends! *}
paulson@18886
  1295
lemma Confidentiality_Tgs_bis:
paulson@18886
  1296
     "\<lbrakk> Says Kas A
paulson@18886
  1297
               (Crypt Ka \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>)
paulson@18886
  1298
           \<in> set evs;
paulson@18886
  1299
         Says Tgs A
paulson@18886
  1300
              (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1301
           \<in> set evs;
paulson@18886
  1302
         \<not> expiredAK Ta evs; \<not> expiredSK Ts evs;
paulson@18886
  1303
         A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1304
      \<Longrightarrow> Key servK \<notin> analz (spies evs)"
paulson@18886
  1305
apply (blast dest!: Confidentiality_Kas Confidentiality_Tgs)
paulson@18886
  1306
done
paulson@18886
  1307
paulson@18886
  1308
text{*Most general form*}
paulson@18886
  1309
lemmas Confidentiality_Tgs_ter = authTicket_authentic [THEN Confidentiality_Tgs_bis]
paulson@18886
  1310
paulson@18886
  1311
lemmas Confidentiality_Auth_A = authK_authentic [THEN Confidentiality_Kas]
paulson@18886
  1312
paulson@18886
  1313
text{*Needs a confidentiality guarantee, hence moved here.
paulson@18886
  1314
      Authenticity of servK for A*}
paulson@18886
  1315
lemma servK_authentic_bis_r:
paulson@18886
  1316
     "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>
paulson@18886
  1317
           \<in> parts (spies evs);
paulson@18886
  1318
         Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
  1319
           \<in> parts (spies evs);
paulson@18886
  1320
         \<not> expiredAK Ta evs; A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1321
 \<Longrightarrow>Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1322
       \<in> set evs"
paulson@18886
  1323
apply (blast dest: authK_authentic Confidentiality_Auth_A servK_authentic_ter)
paulson@18886
  1324
done
paulson@18886
  1325
paulson@18886
  1326
lemma Confidentiality_Serv_A:
paulson@18886
  1327
     "\<lbrakk> Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>
paulson@18886
  1328
           \<in> parts (spies evs);
paulson@18886
  1329
         Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
  1330
           \<in> parts (spies evs);
paulson@18886
  1331
         \<not> expiredAK Ta evs; \<not> expiredSK Ts evs;
paulson@18886
  1332
         A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1333
      \<Longrightarrow> Key servK \<notin> analz (spies evs)"
paulson@18886
  1334
apply (drule authK_authentic, assumption, assumption)
paulson@18886
  1335
apply (blast dest: Confidentiality_Kas Says_Kas_message_form servK_authentic_ter Confidentiality_Tgs_bis)
paulson@18886
  1336
done
paulson@18886
  1337
paulson@18886
  1338
lemma Confidentiality_B:
paulson@18886
  1339
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
  1340
           \<in> parts (spies evs);
paulson@18886
  1341
         Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
  1342
           \<in> parts (spies evs);
paulson@18886
  1343
         Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>
paulson@18886
  1344
           \<in> parts (spies evs);
paulson@18886
  1345
         \<not> expiredSK Ts evs; \<not> expiredAK Ta evs;
paulson@18886
  1346
         A \<notin> bad;  B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1347
      \<Longrightarrow> Key servK \<notin> analz (spies evs)"
paulson@18886
  1348
apply (frule authK_authentic)
paulson@18886
  1349
apply (frule_tac [3] Confidentiality_Kas)
paulson@18886
  1350
apply (frule_tac [6] servTicket_authentic, auto)
paulson@18886
  1351
apply (blast dest!: Confidentiality_Tgs_bis dest: Says_Kas_message_form servK_authentic unique_servKeys unique_authKeys)
paulson@18886
  1352
done
paulson@18886
  1353
paulson@18886
  1354
lemma u_Confidentiality_B:
paulson@18886
  1355
     "\<lbrakk> Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>
paulson@18886
  1356
           \<in> parts (spies evs);
paulson@18886
  1357
         \<not> expiredSK Ts evs;
paulson@18886
  1358
         A \<notin> bad;  B \<notin> bad;  B \<noteq> Tgs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1359
      \<Longrightarrow> Key servK \<notin> analz (spies evs)"
paulson@18886
  1360
apply (blast dest: u_servTicket_authentic u_NotexpiredSK_NotexpiredAK Confidentiality_Tgs_bis)
paulson@18886
  1361
done
paulson@18886
  1362
paulson@18886
  1363
paulson@18886
  1364
paulson@18886
  1365
subsection{*2. Parties' strong authentication: 
paulson@18886
  1366
       non-injective agreement on the session key. The same guarantees also
paulson@18886
  1367
       express key distribution, hence their names*}
paulson@18886
  1368
paulson@18886
  1369
text{*Authentication here still is weak agreement - of B with A*}
paulson@18886
  1370
lemma A_authenticates_B:
paulson@18886
  1371
     "\<lbrakk> Crypt servK (Number T3) \<in> parts (spies evs);
paulson@18886
  1372
         Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>
paulson@18886
  1373
           \<in> parts (spies evs);
paulson@18886
  1374
         Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>
paulson@18886
  1375
           \<in> parts (spies evs);
paulson@18886
  1376
         Key authK \<notin> analz (spies evs); Key servK \<notin> analz (spies evs);
paulson@18886
  1377
         A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1378
      \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs"
paulson@18886
  1379
apply (frule authK_authentic)
paulson@18886
  1380
apply assumption+
paulson@18886
  1381
apply (frule servK_authentic)
paulson@18886
  1382
prefer 2 apply (blast dest: authK_authentic Says_Kas_message_form)
paulson@18886
  1383
apply assumption+
paulson@18886
  1384
apply (blast dest: K4_imp_K2 Key_unique_SesKey intro!: Says_K6)
paulson@18886
  1385
(*Single command proof: slower!
paulson@18886
  1386
apply (blast dest: authK_authentic servK_authentic Says_Kas_message_form Key_unique_SesKey K4_imp_K2 intro!: Says_K6)
paulson@18886
  1387
*)
paulson@18886
  1388
done
paulson@18886
  1389
paulson@18886
  1390
(*These two have never been proved, because never were they needed before!*)
paulson@18886
  1391
lemma shrK_in_initState_Server[iff]:  "Key (shrK A) \<in> initState Kas"
paulson@18886
  1392
by (induct_tac "A", auto)
paulson@18886
  1393
lemma shrK_in_knows_Server [iff]: "Key (shrK A) \<in> knows Kas evs"
paulson@18886
  1394
by (simp add: initState_subset_knows [THEN subsetD])
paulson@18886
  1395
(*Because of our simple model of Tgs, the equivalent for it required an axiom*)
paulson@18886
  1396
paulson@18886
  1397
paulson@18886
  1398
lemma A_authenticates_and_keydist_to_Kas:
paulson@18886
  1399
   "\<lbrakk> Gets A (Crypt (shrK A) \<lbrace>Key authK, Peer, Ta, authTicket\<rbrace>) \<in> set evs;
paulson@18886
  1400
      A \<notin> bad;  evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1401
  \<Longrightarrow> Says Kas A (Crypt (shrK A) \<lbrace>Key authK, Peer, Ta, authTicket\<rbrace>) \<in> set evs
paulson@18886
  1402
  \<and> Key authK \<in> analz(knows Kas evs)"
paulson@18886
  1403
apply (force dest!: authK_authentic Says_imp_knows [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
  1404
done
paulson@18886
  1405
paulson@18886
  1406
wenzelm@26301
  1407
lemma K3_imp_Gets_evs:
paulson@18886
  1408
  "\<lbrakk> Says A Tgs \<lbrace>Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>,
paulson@18886
  1409
                 Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace> 
paulson@18886
  1410
      \<in> set evs;  A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1411
 \<Longrightarrow>  Gets A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, 
paulson@18886
  1412
                 Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>\<rbrace>)
paulson@18886
  1413
       \<in> set evs"
paulson@18886
  1414
apply (erule rev_mp)
paulson@18886
  1415
apply (erule kerbIV_gets.induct)
paulson@18886
  1416
apply auto
paulson@18886
  1417
apply (blast dest: authTicket_form)
paulson@18886
  1418
done
paulson@18886
  1419
paulson@18886
  1420
lemma Tgs_authenticates_and_keydist_to_A:
paulson@18886
  1421
  "\<lbrakk>  Gets Tgs \<lbrace>
paulson@18886
  1422
          Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>,
paulson@18886
  1423
          Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B \<rbrace> \<in> set evs;
paulson@18886
  1424
      Key authK \<notin> analz (spies evs); A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1425
 \<Longrightarrow> \<exists> B. Says A Tgs \<lbrace>
paulson@18886
  1426
          Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>,
paulson@18886
  1427
          Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B \<rbrace> \<in> set evs
paulson@18886
  1428
 \<and>  Key authK \<in> analz (knows A evs)"  
paulson@18886
  1429
apply (frule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst], assumption)
paulson@18886
  1430
apply (drule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd, THEN parts.Fst], assumption)
paulson@18886
  1431
apply (drule Tgs_authenticates_A, assumption+, simp)
wenzelm@26301
  1432
apply (force dest!: K3_imp_Gets_evs Gets_imp_knows [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
  1433
done
paulson@18886
  1434
paulson@18886
  1435
lemma K4_imp_Gets:
paulson@18886
  1436
  "\<lbrakk> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1437
       \<in> set evs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1438
 \<Longrightarrow> \<exists> Ta X. 
paulson@18886
  1439
     Gets Tgs \<lbrace>Crypt (shrK Tgs) \<lbrace>Agent A, Agent Tgs, Key authK, Number Ta\<rbrace>, X\<rbrace>
paulson@18886
  1440
       \<in> set evs"
paulson@18886
  1441
apply (erule rev_mp)
paulson@18886
  1442
apply (erule kerbIV_gets.induct)
paulson@18886
  1443
apply auto
paulson@18886
  1444
done
paulson@18886
  1445
paulson@18886
  1446
lemma A_authenticates_and_keydist_to_Tgs:
paulson@18886
  1447
 "\<lbrakk>  Gets A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>)
paulson@18886
  1448
       \<in> set evs;
paulson@18886
  1449
     Gets A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1450
       \<in> set evs;
paulson@18886
  1451
     Key authK \<notin> analz (spies evs); A \<notin> bad;
paulson@18886
  1452
     evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1453
 \<Longrightarrow> Says Tgs A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>)
paulson@18886
  1454
       \<in> set evs
paulson@18886
  1455
  \<and> Key authK \<in> analz (knows Tgs evs)
paulson@18886
  1456
  \<and> Key servK \<in> analz (knows Tgs evs)"
paulson@18886
  1457
apply (drule Gets_imp_knows_Spy [THEN parts.Inj], assumption)
paulson@18886
  1458
apply (drule Gets_imp_knows_Spy [THEN parts.Inj], assumption)
paulson@18886
  1459
apply (frule authK_authentic, assumption+)
paulson@18886
  1460
apply (drule servK_authentic_ter, assumption+)
paulson@18886
  1461
apply (frule K4_imp_Gets, assumption, erule exE, erule exE)
paulson@18886
  1462
apply (drule Gets_imp_knows [THEN analz.Inj, THEN analz.Fst, THEN analz.Decrypt, THEN analz.Snd, THEN analz.Snd, THEN analz.Fst], assumption, force)
paulson@18886
  1463
apply (frule Says_imp_knows [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
  1464
apply (force dest!: authK_authentic Says_Kas_message_form)
paulson@18886
  1465
apply simp
paulson@18886
  1466
done
paulson@18886
  1467
paulson@18886
  1468
lemma K5_imp_Gets:
paulson@18886
  1469
  "\<lbrakk> Says A B \<lbrace>servTicket, Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs;
paulson@18886
  1470
    A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1471
 \<Longrightarrow> \<exists> authK Ts authTicket T2.
paulson@18886
  1472
    Gets A (Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>) \<in> set evs
paulson@18886
  1473
 \<and> Says A Tgs \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace>  \<in> set evs"
paulson@18886
  1474
apply (erule rev_mp)
paulson@18886
  1475
apply (erule kerbIV_gets.induct)
paulson@18886
  1476
apply auto
paulson@18886
  1477
done 
paulson@18886
  1478
paulson@18886
  1479
lemma K3_imp_Gets:
paulson@18886
  1480
  "\<lbrakk> Says A Tgs \<lbrace>authTicket, Crypt authK \<lbrace>Agent A, Number T2\<rbrace>, Agent B\<rbrace>
paulson@18886
  1481
       \<in> set evs;
paulson@18886
  1482
    A \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1483
 \<Longrightarrow> \<exists> Ta. Gets A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>) \<in> set evs";
paulson@18886
  1484
apply (erule rev_mp)
paulson@18886
  1485
apply (erule kerbIV_gets.induct)
paulson@18886
  1486
apply auto
paulson@18886
  1487
done 
paulson@18886
  1488
paulson@18886
  1489
lemma B_authenticates_and_keydist_to_A:
paulson@18886
  1490
     "\<lbrakk> Gets B \<lbrace>Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>,
paulson@18886
  1491
                Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs;
paulson@18886
  1492
        Key servK \<notin> analz (spies evs);
paulson@18886
  1493
        A \<notin> bad; B \<notin> bad; B \<noteq> Tgs; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1494
 \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>,
paulson@18886
  1495
               Crypt servK \<lbrace>Agent A, Number T3\<rbrace>\<rbrace> \<in> set evs
paulson@18886
  1496
  \<and> Key servK \<in> analz (knows A evs)"
paulson@18886
  1497
apply (frule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst, THEN servTicket_authentic_Tgs], assumption+)  
paulson@18886
  1498
apply (drule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd], assumption)
paulson@18886
  1499
apply (erule exE, drule Says_K5, assumption+)
paulson@18886
  1500
apply (frule K5_imp_Gets, assumption+)
paulson@18886
  1501
apply clarify
paulson@18886
  1502
apply (drule K3_imp_Gets, assumption+)
paulson@18886
  1503
apply (erule exE)
paulson@18886
  1504
apply (frule Gets_imp_knows_Spy [THEN parts.Inj, THEN authK_authentic, THEN Says_Kas_message_form], assumption+, clarify)
paulson@18886
  1505
apply (force dest!: Gets_imp_knows [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Fst])
paulson@18886
  1506
done
paulson@18886
  1507
paulson@18886
  1508
paulson@18886
  1509
lemma K6_imp_Gets:
paulson@18886
  1510
  "\<lbrakk> Says B A (Crypt servK (Number T3)) \<in> set evs;
paulson@18886
  1511
     B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1512
\<Longrightarrow> \<exists> Ts X. Gets B \<lbrace>Crypt (shrK B) \<lbrace>Agent A, Agent B, Key servK, Number Ts\<rbrace>,X\<rbrace>
paulson@18886
  1513
       \<in> set evs"
paulson@18886
  1514
apply (erule rev_mp)
paulson@18886
  1515
apply (erule kerbIV_gets.induct)
paulson@18886
  1516
apply auto
paulson@18886
  1517
done
paulson@18886
  1518
paulson@18886
  1519
paulson@18886
  1520
lemma A_authenticates_and_keydist_to_B:
paulson@18886
  1521
  "\<lbrakk> Gets A \<lbrace>Crypt authK \<lbrace>Key servK, Agent B, Number Ts, servTicket\<rbrace>,
paulson@18886
  1522
             Crypt servK (Number T3)\<rbrace> \<in> set evs;
paulson@18886
  1523
     Gets A (Crypt (shrK A) \<lbrace>Key authK, Agent Tgs, Number Ta, authTicket\<rbrace>)
paulson@18886
  1524
           \<in> set evs;
paulson@18886
  1525
     Key authK \<notin> analz (spies evs); Key servK \<notin> analz (spies evs);
paulson@18886
  1526
     A \<notin> bad;  B \<notin> bad; evs \<in> kerbIV_gets \<rbrakk>
paulson@18886
  1527
 \<Longrightarrow> Says B A (Crypt servK (Number T3)) \<in> set evs 
paulson@18886
  1528
   \<and> Key servK \<in> analz (knows B evs)"
paulson@18886
  1529
apply (frule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Fst], assumption)
paulson@18886
  1530
apply (drule Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Snd], assumption)
paulson@18886
  1531
apply (drule Gets_imp_knows_Spy [THEN parts.Inj], assumption)
paulson@18886
  1532
apply (drule A_authenticates_B, assumption+)
paulson@18886
  1533
apply (force dest!: K6_imp_Gets Gets_imp_knows [THEN analz.Inj, THEN analz.Fst, THEN analz.Decrypt, THEN analz.Snd, THEN analz.Snd, THEN analz.Fst])
paulson@18886
  1534
done
paulson@18886
  1535
paulson@18886
  1536
 
paulson@18886
  1537
paulson@18886
  1538
end
paulson@18886
  1539