src/HOL/Auth/Kerberos_BAN_Gets.thy
author wenzelm
Mon Aug 31 21:28:08 2015 +0200 (2015-08-31)
changeset 61070 b72a990adfe2
parent 58889 5b7a9633cfa8
child 61830 4f5ab843cf5b
permissions -rw-r--r--
prefer symbols;
wenzelm@37936
     1
(*  Title:      HOL/Auth/Kerberos_BAN_Gets.thy
paulson@18886
     2
    Author:     Giampaolo Bella, Catania University
paulson@18886
     3
*)
paulson@18886
     4
wenzelm@58889
     5
section{*The Kerberos Protocol, BAN Version, with Gets event*}
paulson@18886
     6
paulson@18886
     7
theory Kerberos_BAN_Gets imports Public begin
paulson@18886
     8
paulson@18886
     9
text{*From page 251 of
paulson@18886
    10
  Burrows, Abadi and Needham (1989).  A Logic of Authentication.
paulson@18886
    11
  Proc. Royal Soc. 426
paulson@18886
    12
paulson@18886
    13
  Confidentiality (secrecy) and authentication properties rely on
paulson@18886
    14
  temporal checks: strong guarantees in a little abstracted - but
paulson@18886
    15
  very realistic - model.
paulson@18886
    16
*}
paulson@18886
    17
paulson@18886
    18
(* Temporal modelization: session keys can be leaked
paulson@18886
    19
                          ONLY when they have expired *)
paulson@18886
    20
paulson@18886
    21
consts
paulson@18886
    22
paulson@18886
    23
    (*Duration of the session key*)
paulson@18886
    24
    sesKlife   :: nat
paulson@18886
    25
paulson@18886
    26
    (*Duration of the authenticator*)
paulson@18886
    27
    authlife :: nat
paulson@18886
    28
paulson@18886
    29
text{*The ticket should remain fresh for two journeys on the network at least*}
paulson@18886
    30
text{*The Gets event causes longer traces for the protocol to reach its end*}
paulson@18886
    31
specification (sesKlife)
paulson@18886
    32
  sesKlife_LB [iff]: "4 \<le> sesKlife"
paulson@18886
    33
    by blast
paulson@18886
    34
paulson@18886
    35
text{*The authenticator only for one journey*}
paulson@18886
    36
text{*The Gets event causes longer traces for the protocol to reach its end*}
paulson@18886
    37
specification (authlife)
paulson@18886
    38
  authlife_LB [iff]:    "2 \<le> authlife"
paulson@18886
    39
    by blast
paulson@18886
    40
paulson@18886
    41
wenzelm@20768
    42
abbreviation
wenzelm@21404
    43
  CT :: "event list=>nat" where
wenzelm@20768
    44
  "CT == length"
paulson@18886
    45
wenzelm@21404
    46
abbreviation
wenzelm@21404
    47
  expiredK :: "[nat, event list] => bool" where
wenzelm@20768
    48
  "expiredK T evs == sesKlife + T < CT evs"
paulson@18886
    49
wenzelm@21404
    50
abbreviation
wenzelm@21404
    51
  expiredA :: "[nat, event list] => bool" where
wenzelm@20768
    52
  "expiredA T evs == authlife + T < CT evs"
paulson@18886
    53
paulson@18886
    54
wenzelm@36866
    55
definition
paulson@18886
    56
 (* Yields the subtrace of a given trace from its beginning to a given event *)
paulson@18886
    57
  before :: "[event, event list] => event list" ("before _ on _")
wenzelm@36866
    58
  where "before ev on evs = takeWhile (% z. z ~= ev) (rev evs)"
paulson@18886
    59
wenzelm@36866
    60
definition
paulson@18886
    61
 (* States than an event really appears only once on a trace *)
paulson@18886
    62
  Unique :: "[event, event list] => bool" ("Unique _ on _")
wenzelm@36866
    63
  where "Unique ev on evs = (ev \<notin> set (tl (dropWhile (% z. z \<noteq> ev) evs)))"
paulson@18886
    64
paulson@18886
    65
berghofe@23746
    66
inductive_set bankerb_gets :: "event list set"
berghofe@23746
    67
 where
paulson@18886
    68
paulson@18886
    69
   Nil:  "[] \<in> bankerb_gets"
paulson@18886
    70
berghofe@23746
    71
 | Fake: "\<lbrakk> evsf \<in> bankerb_gets;  X \<in> synth (analz (knows Spy evsf)) \<rbrakk>
wenzelm@32960
    72
          \<Longrightarrow> Says Spy B X # evsf \<in> bankerb_gets"
paulson@18886
    73
berghofe@23746
    74
 | Reception: "\<lbrakk> evsr\<in> bankerb_gets; Says A B X \<in> set evsr \<rbrakk>
paulson@18886
    75
                \<Longrightarrow> Gets B X # evsr \<in> bankerb_gets"
paulson@18886
    76
berghofe@23746
    77
 | BK1:  "\<lbrakk> evs1 \<in> bankerb_gets \<rbrakk>
wenzelm@32960
    78
          \<Longrightarrow> Says A Server \<lbrace>Agent A, Agent B\<rbrace> # evs1
wenzelm@32960
    79
                \<in>  bankerb_gets"
paulson@18886
    80
paulson@18886
    81
berghofe@23746
    82
 | BK2:  "\<lbrakk> evs2 \<in> bankerb_gets;  Key K \<notin> used evs2; K \<in> symKeys;
wenzelm@32960
    83
             Gets Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs2 \<rbrakk>
wenzelm@32960
    84
          \<Longrightarrow> Says Server A
wenzelm@32960
    85
                (Crypt (shrK A)
wenzelm@32960
    86
                   \<lbrace>Number (CT evs2), Agent B, Key K,
wenzelm@32960
    87
                    (Crypt (shrK B) \<lbrace>Number (CT evs2), Agent A, Key K\<rbrace>)\<rbrace>)
wenzelm@32960
    88
                # evs2 \<in> bankerb_gets"
paulson@18886
    89
paulson@18886
    90
berghofe@23746
    91
 | BK3:  "\<lbrakk> evs3 \<in> bankerb_gets;
wenzelm@32960
    92
             Gets A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
wenzelm@32960
    93
               \<in> set evs3;
wenzelm@32960
    94
             Says A Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs3;
wenzelm@32960
    95
             \<not> expiredK Tk evs3 \<rbrakk>
wenzelm@32960
    96
          \<Longrightarrow> Says A B \<lbrace>Ticket, Crypt K \<lbrace>Agent A, Number (CT evs3)\<rbrace> \<rbrace>
wenzelm@32960
    97
               # evs3 \<in> bankerb_gets"
paulson@18886
    98
paulson@18886
    99
berghofe@23746
   100
 | BK4:  "\<lbrakk> evs4 \<in> bankerb_gets;
wenzelm@32960
   101
             Gets B \<lbrace>(Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>),
wenzelm@32960
   102
                         (Crypt K \<lbrace>Agent A, Number Ta\<rbrace>) \<rbrace>: set evs4;
wenzelm@32960
   103
             \<not> expiredK Tk evs4;  \<not> expiredA Ta evs4 \<rbrakk>
wenzelm@32960
   104
          \<Longrightarrow> Says B A (Crypt K (Number Ta)) # evs4
wenzelm@32960
   105
                \<in> bankerb_gets"
paulson@18886
   106
wenzelm@32960
   107
        (*Old session keys may become compromised*)
berghofe@23746
   108
 | Oops: "\<lbrakk> evso \<in> bankerb_gets;
paulson@18886
   109
         Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
wenzelm@32960
   110
               \<in> set evso;
wenzelm@32960
   111
             expiredK Tk evso \<rbrakk>
wenzelm@32960
   112
          \<Longrightarrow> Notes Spy \<lbrace>Number Tk, Key K\<rbrace> # evso \<in> bankerb_gets"
paulson@18886
   113
paulson@18886
   114
paulson@18886
   115
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
paulson@18886
   116
declare parts.Body [dest]
paulson@18886
   117
declare analz_into_parts [dest]
paulson@18886
   118
declare Fake_parts_insert_in_Un [dest]
paulson@18886
   119
declare knows_Spy_partsEs [elim]
paulson@18886
   120
paulson@18886
   121
paulson@18886
   122
text{*A "possibility property": there are traces that reach the end.*}
paulson@18886
   123
lemma "\<lbrakk>Key K \<notin> used []; K \<in> symKeys\<rbrakk>
paulson@18886
   124
       \<Longrightarrow> \<exists>Timestamp. \<exists>evs \<in> bankerb_gets.
paulson@18886
   125
             Says B A (Crypt K (Number Timestamp))
paulson@18886
   126
                  \<in> set evs"
paulson@18886
   127
apply (cut_tac sesKlife_LB)
paulson@18886
   128
apply (cut_tac authlife_LB)
paulson@18886
   129
apply (intro exI bexI)
paulson@18886
   130
apply (rule_tac [2]
paulson@18886
   131
           bankerb_gets.Nil [THEN bankerb_gets.BK1, THEN bankerb_gets.Reception,
paulson@18886
   132
                            THEN bankerb_gets.BK2, THEN bankerb_gets.Reception,
paulson@18886
   133
                            THEN bankerb_gets.BK3, THEN bankerb_gets.Reception,
paulson@18886
   134
                            THEN bankerb_gets.BK4])
paulson@18886
   135
apply (possibility, simp_all (no_asm_simp) add: used_Cons)
paulson@18886
   136
done
paulson@18886
   137
paulson@18886
   138
paulson@18886
   139
text{*Lemmas about reception invariant: if a message is received it certainly
paulson@18886
   140
was sent*}
paulson@18886
   141
lemma Gets_imp_Says :
paulson@18886
   142
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> bankerb_gets \<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs"
paulson@18886
   143
apply (erule rev_mp)
paulson@18886
   144
apply (erule bankerb_gets.induct)
paulson@18886
   145
apply auto
paulson@18886
   146
done
paulson@18886
   147
paulson@18886
   148
lemma Gets_imp_knows_Spy: 
paulson@18886
   149
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> bankerb_gets \<rbrakk>  \<Longrightarrow> X \<in> knows Spy evs"
paulson@18886
   150
apply (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
paulson@18886
   151
done
paulson@18886
   152
paulson@18886
   153
lemma Gets_imp_knows_Spy_parts[dest]:
paulson@18886
   154
    "\<lbrakk> Gets B X \<in> set evs; evs \<in> bankerb_gets \<rbrakk>  \<Longrightarrow> X \<in> parts (knows Spy evs)"
paulson@18886
   155
apply (blast dest: Gets_imp_knows_Spy [THEN parts.Inj])
paulson@18886
   156
done
paulson@18886
   157
paulson@18886
   158
lemma Gets_imp_knows:
paulson@18886
   159
     "\<lbrakk> Gets B X \<in> set evs; evs \<in> bankerb_gets \<rbrakk>  \<Longrightarrow> X \<in> knows B evs"
paulson@39251
   160
by (metis Gets_imp_knows_Spy Gets_imp_knows_agents)
paulson@18886
   161
paulson@18886
   162
lemma Gets_imp_knows_analz:
paulson@18886
   163
    "\<lbrakk> Gets B X \<in> set evs; evs \<in> bankerb_gets \<rbrakk>  \<Longrightarrow> X \<in> analz (knows B evs)"
paulson@18886
   164
apply (blast dest: Gets_imp_knows [THEN analz.Inj])
paulson@18886
   165
done
paulson@18886
   166
paulson@18886
   167
text{*Lemmas for reasoning about predicate "before"*}
paulson@39251
   168
lemma used_Says_rev: "used (evs @ [Says A B X]) = parts {X} \<union> (used evs)"
paulson@18886
   169
apply (induct_tac "evs")
paulson@18886
   170
apply simp
blanchet@55417
   171
apply (rename_tac a b)
paulson@18886
   172
apply (induct_tac "a")
paulson@18886
   173
apply auto
paulson@18886
   174
done
paulson@18886
   175
paulson@39251
   176
lemma used_Notes_rev: "used (evs @ [Notes A X]) = parts {X} \<union> (used evs)"
paulson@18886
   177
apply (induct_tac "evs")
paulson@18886
   178
apply simp
blanchet@55417
   179
apply (rename_tac a b)
paulson@18886
   180
apply (induct_tac "a")
paulson@18886
   181
apply auto
paulson@18886
   182
done
paulson@18886
   183
paulson@39251
   184
lemma used_Gets_rev: "used (evs @ [Gets B X]) = used evs"
paulson@18886
   185
apply (induct_tac "evs")
paulson@18886
   186
apply simp
blanchet@55417
   187
apply (rename_tac a b)
paulson@18886
   188
apply (induct_tac "a")
paulson@18886
   189
apply auto
paulson@18886
   190
done
paulson@18886
   191
paulson@18886
   192
lemma used_evs_rev: "used evs = used (rev evs)"
paulson@18886
   193
apply (induct_tac "evs")
paulson@18886
   194
apply simp
blanchet@55417
   195
apply (rename_tac a b)
paulson@18886
   196
apply (induct_tac "a")
paulson@18886
   197
apply (simp add: used_Says_rev)
paulson@18886
   198
apply (simp add: used_Gets_rev)
paulson@18886
   199
apply (simp add: used_Notes_rev)
paulson@18886
   200
done
paulson@18886
   201
paulson@18886
   202
lemma used_takeWhile_used [rule_format]: 
paulson@18886
   203
      "x : used (takeWhile P X) --> x : used X"
paulson@18886
   204
apply (induct_tac "X")
paulson@18886
   205
apply simp
blanchet@55417
   206
apply (rename_tac a b)
paulson@18886
   207
apply (induct_tac "a")
paulson@18886
   208
apply (simp_all add: used_Nil)
paulson@18886
   209
apply (blast dest!: initState_into_used)+
paulson@18886
   210
done
paulson@18886
   211
paulson@18886
   212
lemma set_evs_rev: "set evs = set (rev evs)"
paulson@18886
   213
apply auto
paulson@18886
   214
done
paulson@18886
   215
paulson@18886
   216
lemma takeWhile_void [rule_format]:
paulson@18886
   217
      "x \<notin> set evs \<longrightarrow> takeWhile (\<lambda>z. z \<noteq> x) evs = evs"
paulson@18886
   218
apply auto
paulson@18886
   219
done
paulson@18886
   220
paulson@18886
   221
(**** Inductive proofs about bankerb_gets ****)
paulson@18886
   222
paulson@18886
   223
text{*Forwarding Lemma for reasoning about the encrypted portion of message BK3*}
paulson@18886
   224
lemma BK3_msg_in_parts_knows_Spy:
paulson@18886
   225
     "\<lbrakk>Gets A (Crypt KA \<lbrace>Timestamp, B, K, X\<rbrace>) \<in> set evs; evs \<in> bankerb_gets \<rbrakk> 
paulson@18886
   226
      \<Longrightarrow> X \<in> parts (knows Spy evs)"
paulson@18886
   227
apply blast
paulson@18886
   228
done
paulson@18886
   229
paulson@18886
   230
lemma Oops_parts_knows_Spy:
paulson@18886
   231
     "Says Server A (Crypt (shrK A) \<lbrace>Timestamp, B, K, X\<rbrace>) \<in> set evs
paulson@18886
   232
      \<Longrightarrow> K \<in> parts (knows Spy evs)"
paulson@18886
   233
apply blast
paulson@18886
   234
done
paulson@18886
   235
paulson@18886
   236
paulson@18886
   237
text{*Spy never sees another agent's shared key! (unless it's bad at start)*}
paulson@18886
   238
lemma Spy_see_shrK [simp]:
paulson@18886
   239
     "evs \<in> bankerb_gets \<Longrightarrow> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)"
paulson@18886
   240
apply (erule bankerb_gets.induct)
paulson@18886
   241
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   242
apply (frule_tac [6] BK3_msg_in_parts_knows_Spy, simp_all, blast+)
paulson@18886
   243
done
paulson@18886
   244
paulson@18886
   245
paulson@18886
   246
lemma Spy_analz_shrK [simp]:
paulson@18886
   247
     "evs \<in> bankerb_gets \<Longrightarrow> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)"
paulson@18886
   248
by auto
paulson@18886
   249
paulson@18886
   250
lemma Spy_see_shrK_D [dest!]:
paulson@18886
   251
     "\<lbrakk> Key (shrK A) \<in> parts (knows Spy evs);
paulson@18886
   252
                evs \<in> bankerb_gets \<rbrakk> \<Longrightarrow> A:bad"
paulson@18886
   253
by (blast dest: Spy_see_shrK)
paulson@18886
   254
paulson@18886
   255
lemmas Spy_analz_shrK_D = analz_subset_parts [THEN subsetD, THEN Spy_see_shrK_D,  dest!]
paulson@18886
   256
paulson@18886
   257
paulson@18886
   258
text{*Nobody can have used non-existent keys!*}
paulson@18886
   259
lemma new_keys_not_used [simp]:
paulson@18886
   260
    "\<lbrakk>Key K \<notin> used evs; K \<in> symKeys; evs \<in> bankerb_gets\<rbrakk>
paulson@18886
   261
     \<Longrightarrow> K \<notin> keysFor (parts (knows Spy evs))"
paulson@18886
   262
apply (erule rev_mp)
paulson@18886
   263
apply (erule bankerb_gets.induct)
paulson@18886
   264
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   265
apply (frule_tac [6] BK3_msg_in_parts_knows_Spy, simp_all)
paulson@18886
   266
txt{*Fake*}
paulson@18886
   267
apply (force dest!: keysFor_parts_insert)
paulson@18886
   268
txt{*BK2, BK3, BK4*}
paulson@18886
   269
apply (force dest!: analz_shrK_Decrypt)+
paulson@18886
   270
done
paulson@18886
   271
paulson@18886
   272
subsection{* Lemmas concerning the form of items passed in messages *}
paulson@18886
   273
paulson@18886
   274
text{*Describes the form of K, X and K' when the Server sends this message.*}
paulson@18886
   275
lemma Says_Server_message_form:
paulson@18886
   276
     "\<lbrakk> Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   277
         \<in> set evs; evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   278
      \<Longrightarrow> K' = shrK A & K \<notin> range shrK &
paulson@18886
   279
          Ticket = (Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>) &
paulson@18886
   280
          Key K \<notin> used(before
paulson@18886
   281
                  Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   282
                  on evs) &
paulson@18886
   283
          Tk = CT(before 
paulson@18886
   284
                  Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   285
                  on evs)"
paulson@18886
   286
apply (unfold before_def)
paulson@18886
   287
apply (erule rev_mp)
paulson@18886
   288
apply (erule bankerb_gets.induct, simp_all)
paulson@18886
   289
txt{*We need this simplification only for Message 2*}
paulson@18886
   290
apply (simp (no_asm) add: takeWhile_tail)
paulson@18886
   291
apply auto
paulson@18886
   292
txt{*Two subcases of Message 2. Subcase: used before*}
paulson@18886
   293
apply (blast dest: used_evs_rev [THEN equalityD2, THEN contra_subsetD] 
paulson@18886
   294
                   used_takeWhile_used)
paulson@18886
   295
txt{*subcase: CT before*}
nipkow@44890
   296
apply (fastforce dest!: set_evs_rev [THEN equalityD2, THEN contra_subsetD, THEN takeWhile_void])
paulson@18886
   297
done
paulson@18886
   298
paulson@18886
   299
paulson@18886
   300
text{*If the encrypted message appears then it originated with the Server
paulson@18886
   301
  PROVIDED that A is NOT compromised!
paulson@18886
   302
  This allows A to verify freshness of the session key.
paulson@18886
   303
*}
paulson@18886
   304
lemma Kab_authentic:
paulson@18886
   305
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>
paulson@18886
   306
           \<in> parts (knows Spy evs);
paulson@18886
   307
         A \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   308
       \<Longrightarrow> Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   309
             \<in> set evs"
paulson@18886
   310
apply (erule rev_mp)
paulson@18886
   311
apply (erule bankerb_gets.induct)
paulson@18886
   312
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   313
apply (frule_tac [6] BK3_msg_in_parts_knows_Spy, simp_all, blast)
paulson@18886
   314
done
paulson@18886
   315
paulson@18886
   316
paulson@18886
   317
text{*If the TICKET appears then it originated with the Server*}
paulson@18886
   318
text{*FRESHNESS OF THE SESSION KEY to B*}
paulson@18886
   319
lemma ticket_authentic:
paulson@18886
   320
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   321
         B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   322
       \<Longrightarrow> Says Server A
paulson@18886
   323
            (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   324
                          Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@18886
   325
           \<in> set evs"
paulson@18886
   326
apply (erule rev_mp)
paulson@18886
   327
apply (erule bankerb_gets.induct)
paulson@18886
   328
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   329
apply (frule_tac [6] BK3_msg_in_parts_knows_Spy, simp_all, blast)
paulson@18886
   330
done
paulson@18886
   331
paulson@18886
   332
paulson@18886
   333
text{*EITHER describes the form of X when the following message is sent,
paulson@18886
   334
  OR     reduces it to the Fake case.
paulson@18886
   335
  Use @{text Says_Server_message_form} if applicable.*}
paulson@18886
   336
lemma Gets_Server_message_form:
paulson@18886
   337
     "\<lbrakk> Gets A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   338
            \<in> set evs;
paulson@18886
   339
         evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   340
 \<Longrightarrow> (K \<notin> range shrK & X = (Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>))
paulson@18886
   341
          | X \<in> analz (knows Spy evs)"
paulson@18886
   342
apply (case_tac "A \<in> bad")
paulson@18886
   343
apply (force dest!: Gets_imp_knows_Spy [THEN analz.Inj])
paulson@18886
   344
apply (blast dest!: Kab_authentic Says_Server_message_form)
paulson@18886
   345
done
paulson@18886
   346
paulson@18886
   347
paulson@18886
   348
text{*Reliability guarantees: honest agents act as we expect*}
paulson@18886
   349
paulson@18886
   350
lemma BK3_imp_Gets:
paulson@18886
   351
   "\<lbrakk> Says A B \<lbrace>Ticket, Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs;
paulson@18886
   352
      A \<notin> bad; evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   353
    \<Longrightarrow> \<exists> Tk. Gets A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   354
      \<in> set evs"
paulson@18886
   355
apply (erule rev_mp)
paulson@18886
   356
apply (erule bankerb_gets.induct)
paulson@18886
   357
apply auto
paulson@18886
   358
done
paulson@18886
   359
paulson@18886
   360
lemma BK4_imp_Gets:
paulson@18886
   361
   "\<lbrakk> Says B A (Crypt K (Number Ta)) \<in> set evs;
paulson@18886
   362
      B \<notin> bad; evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   363
  \<Longrightarrow> \<exists> Tk. Gets B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
wenzelm@32960
   364
                    Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   365
apply (erule rev_mp)
paulson@18886
   366
apply (erule bankerb_gets.induct)
paulson@18886
   367
apply auto
paulson@18886
   368
done
paulson@18886
   369
paulson@18886
   370
lemma Gets_A_knows_K:
paulson@18886
   371
  "\<lbrakk> Gets A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   372
     evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   373
 \<Longrightarrow> Key K \<in> analz (knows A evs)"
paulson@18886
   374
apply (force dest: Gets_imp_knows_analz)
paulson@18886
   375
done
paulson@18886
   376
paulson@18886
   377
lemma Gets_B_knows_K:
paulson@18886
   378
  "\<lbrakk> Gets B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   379
             Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs;
paulson@18886
   380
     evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   381
 \<Longrightarrow> Key K \<in> analz (knows B evs)"
paulson@18886
   382
apply (force dest: Gets_imp_knows_analz)
paulson@18886
   383
done
paulson@18886
   384
paulson@18886
   385
paulson@18886
   386
(****
paulson@18886
   387
 The following is to prove theorems of the form
paulson@18886
   388
paulson@18886
   389
  Key K \<in> analz (insert (Key KAB) (knows Spy evs)) \<Longrightarrow>
paulson@18886
   390
  Key K \<in> analz (knows Spy evs)
paulson@18886
   391
paulson@18886
   392
 A more general formula must be proved inductively.
paulson@18886
   393
paulson@18886
   394
****)
paulson@18886
   395
paulson@18886
   396
paulson@18886
   397
text{* Session keys are not used to encrypt other session keys *}
paulson@18886
   398
lemma analz_image_freshK [rule_format (no_asm)]:
paulson@18886
   399
     "evs \<in> bankerb_gets \<Longrightarrow>
paulson@18886
   400
   \<forall>K KK. KK \<subseteq> - (range shrK) \<longrightarrow>
paulson@18886
   401
          (Key K \<in> analz (Key`KK Un (knows Spy evs))) =
paulson@18886
   402
          (K \<in> KK | Key K \<in> analz (knows Spy evs))"
paulson@18886
   403
apply (erule bankerb_gets.induct)
paulson@18886
   404
apply (drule_tac [8] Says_Server_message_form)
paulson@18886
   405
apply (erule_tac [6] Gets_Server_message_form [THEN disjE], analz_freshK, spy_analz, auto) 
paulson@18886
   406
done
paulson@18886
   407
paulson@18886
   408
paulson@18886
   409
lemma analz_insert_freshK:
paulson@18886
   410
     "\<lbrakk> evs \<in> bankerb_gets;  KAB \<notin> range shrK \<rbrakk> \<Longrightarrow>
paulson@18886
   411
      (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) =
paulson@18886
   412
      (K = KAB | Key K \<in> analz (knows Spy evs))"
paulson@18886
   413
by (simp only: analz_image_freshK analz_image_freshK_simps)
paulson@18886
   414
paulson@18886
   415
paulson@18886
   416
text{* The session key K uniquely identifies the message *}
paulson@18886
   417
lemma unique_session_keys:
paulson@18886
   418
     "\<lbrakk> Says Server A
paulson@18886
   419
           (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>) \<in> set evs;
paulson@18886
   420
         Says Server A'
paulson@18886
   421
          (Crypt (shrK A') \<lbrace>Number Tk', Agent B', Key K, X'\<rbrace>) \<in> set evs;
paulson@18886
   422
         evs \<in> bankerb_gets \<rbrakk> \<Longrightarrow> A=A' & Tk=Tk' & B=B' & X = X'"
paulson@18886
   423
apply (erule rev_mp)
paulson@18886
   424
apply (erule rev_mp)
paulson@18886
   425
apply (erule bankerb_gets.induct)
paulson@18886
   426
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   427
apply (frule_tac [6] BK3_msg_in_parts_knows_Spy, simp_all)
paulson@18886
   428
txt{*BK2: it can't be a new key*}
paulson@18886
   429
apply blast
paulson@18886
   430
done
paulson@18886
   431
paulson@18886
   432
lemma unique_session_keys_Gets:
paulson@18886
   433
     "\<lbrakk> Gets A
paulson@18886
   434
           (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>) \<in> set evs;
paulson@18886
   435
        Gets A
paulson@18886
   436
          (Crypt (shrK A) \<lbrace>Number Tk', Agent B', Key K, X'\<rbrace>) \<in> set evs;
paulson@18886
   437
        A \<notin> bad; evs \<in> bankerb_gets \<rbrakk> \<Longrightarrow> Tk=Tk' & B=B' & X = X'"
paulson@18886
   438
apply (blast dest!: Kab_authentic unique_session_keys)
paulson@18886
   439
done
paulson@18886
   440
paulson@18886
   441
paulson@18886
   442
lemma Server_Unique:
paulson@18886
   443
     "\<lbrakk> Says Server A
paulson@18886
   444
            (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   445
        evs \<in> bankerb_gets \<rbrakk> \<Longrightarrow> 
paulson@18886
   446
   Unique Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   447
   on evs"
paulson@18886
   448
apply (erule rev_mp, erule bankerb_gets.induct, simp_all add: Unique_def)
paulson@18886
   449
apply blast
paulson@18886
   450
done
paulson@18886
   451
paulson@18886
   452
paulson@18886
   453
paulson@18886
   454
subsection{*Non-temporal guarantees, explicitly relying on non-occurrence of
paulson@18886
   455
oops events - refined below by temporal guarantees*}
paulson@18886
   456
paulson@18886
   457
text{*Non temporal treatment of confidentiality*}
paulson@18886
   458
paulson@18886
   459
text{* Lemma: the session key sent in msg BK2 would be lost by oops
paulson@18886
   460
    if the spy could see it! *}
paulson@18886
   461
lemma lemma_conf [rule_format (no_asm)]:
paulson@18886
   462
     "\<lbrakk> A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   463
  \<Longrightarrow> Says Server A
paulson@18886
   464
          (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   465
                            Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@18886
   466
         \<in> set evs \<longrightarrow>
paulson@18886
   467
      Key K \<in> analz (knows Spy evs) \<longrightarrow> Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<in> set evs"
paulson@18886
   468
apply (erule bankerb_gets.induct)
paulson@18886
   469
apply (frule_tac [8] Says_Server_message_form)
paulson@18886
   470
apply (frule_tac [6] Gets_Server_message_form [THEN disjE])
paulson@18886
   471
apply (simp_all (no_asm_simp) add: analz_insert_eq analz_insert_freshK pushes)
paulson@18886
   472
txt{*Fake*}
paulson@18886
   473
apply spy_analz
paulson@18886
   474
txt{*BK2*}
paulson@18886
   475
apply (blast intro: parts_insertI)
paulson@18886
   476
txt{*BK3*}
paulson@18886
   477
apply (case_tac "Aa \<in> bad")
paulson@18886
   478
 prefer 2 apply (blast dest: Kab_authentic unique_session_keys)
paulson@18886
   479
apply (blast dest: Gets_imp_knows_Spy [THEN analz.Inj] Crypt_Spy_analz_bad elim!: MPair_analz)
paulson@18886
   480
txt{*Oops*}
paulson@18886
   481
apply (blast dest: unique_session_keys)
paulson@18886
   482
done
paulson@18886
   483
paulson@18886
   484
paulson@18886
   485
text{*Confidentiality for the Server: Spy does not see the keys sent in msg BK2
paulson@18886
   486
as long as they have not expired.*}
paulson@18886
   487
lemma Confidentiality_S:
paulson@18886
   488
     "\<lbrakk> Says Server A
paulson@18886
   489
          (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   490
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   491
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   492
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   493
apply (frule Says_Server_message_form, assumption)
paulson@18886
   494
apply (blast intro: lemma_conf)
paulson@18886
   495
done
paulson@18886
   496
paulson@18886
   497
text{*Confidentiality for Alice*}
paulson@18886
   498
lemma Confidentiality_A:
paulson@18886
   499
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   500
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   501
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   502
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   503
by (blast dest!: Kab_authentic Confidentiality_S)
paulson@18886
   504
paulson@18886
   505
text{*Confidentiality for Bob*}
paulson@18886
   506
lemma Confidentiality_B:
paulson@18886
   507
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@18886
   508
          \<in> parts (knows Spy evs);
paulson@18886
   509
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   510
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   511
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   512
by (blast dest!: ticket_authentic Confidentiality_S)
paulson@18886
   513
paulson@18886
   514
paulson@18886
   515
text{*Non temporal treatment of authentication*}
paulson@18886
   516
paulson@18886
   517
text{*Lemmas @{text lemma_A} and @{text lemma_B} in fact are common to both temporal and non-temporal treatments*}
paulson@18886
   518
lemma lemma_A [rule_format]:
paulson@18886
   519
     "\<lbrakk> A \<notin> bad; B \<notin> bad; evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   520
      \<Longrightarrow>
paulson@18886
   521
         Key K \<notin> analz (knows Spy evs) \<longrightarrow>
paulson@18886
   522
         Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   523
         \<in> set evs \<longrightarrow>
paulson@18886
   524
          Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (knows Spy evs) \<longrightarrow>
paulson@18886
   525
         Says A B \<lbrace>X, Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace>
paulson@18886
   526
             \<in> set evs"
paulson@18886
   527
apply (erule bankerb_gets.induct)
paulson@18886
   528
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   529
apply (frule_tac [6] Gets_Server_message_form)
paulson@18886
   530
apply (frule_tac [7] BK3_msg_in_parts_knows_Spy, analz_mono_contra)
paulson@18886
   531
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   532
txt{*Fake*}
paulson@18886
   533
apply blast
paulson@18886
   534
txt{*BK2*}
paulson@18886
   535
apply (force dest: Crypt_imp_invKey_keysFor)
paulson@18886
   536
txt{*BK3*}
paulson@18886
   537
apply (blast dest: Kab_authentic unique_session_keys)
paulson@18886
   538
done
paulson@18886
   539
lemma lemma_B [rule_format]:
paulson@18886
   540
     "\<lbrakk> B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   541
      \<Longrightarrow> Key K \<notin> analz (knows Spy evs) \<longrightarrow>
paulson@18886
   542
          Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   543
          \<in> set evs \<longrightarrow>
paulson@18886
   544
          Crypt K (Number Ta) \<in> parts (knows Spy evs) \<longrightarrow>
paulson@18886
   545
          Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   546
apply (erule bankerb_gets.induct)
paulson@18886
   547
apply (frule_tac [8] Oops_parts_knows_Spy)
paulson@18886
   548
apply (frule_tac [6] Gets_Server_message_form)
paulson@18886
   549
apply (drule_tac [7] BK3_msg_in_parts_knows_Spy, analz_mono_contra)
paulson@18886
   550
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   551
txt{*Fake*}
paulson@18886
   552
apply blast
paulson@18886
   553
txt{*BK2*} 
paulson@18886
   554
apply (force dest: Crypt_imp_invKey_keysFor)
paulson@18886
   555
txt{*BK4*}
paulson@18886
   556
apply (blast dest: ticket_authentic unique_session_keys
paulson@18886
   557
                   Gets_imp_knows_Spy [THEN analz.Inj] Crypt_Spy_analz_bad)
paulson@18886
   558
done
paulson@18886
   559
paulson@18886
   560
paulson@18886
   561
text{*The "r" suffix indicates theorems where the confidentiality assumptions are relaxed by the corresponding arguments.*}
paulson@18886
   562
paulson@18886
   563
text{*Authentication of A to B*}
paulson@18886
   564
lemma B_authenticates_A_r:
paulson@18886
   565
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   566
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>  \<in> parts (knows Spy evs);
paulson@18886
   567
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   568
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   569
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   570
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   571
by (blast dest!: ticket_authentic
paulson@18886
   572
          intro!: lemma_A
paulson@18886
   573
          elim!: Confidentiality_S [THEN [2] rev_notE])
paulson@18886
   574
paulson@18886
   575
text{*Authentication of B to A*}
paulson@18886
   576
lemma A_authenticates_B_r:
paulson@18886
   577
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (knows Spy evs);
paulson@18886
   578
        Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   579
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   580
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   581
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   582
by (blast dest!: Kab_authentic
paulson@18886
   583
          intro!: lemma_B elim!: Confidentiality_S [THEN [2] rev_notE])
paulson@18886
   584
paulson@18886
   585
lemma B_authenticates_A:
paulson@18886
   586
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs);
paulson@18886
   587
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>  \<in> parts (spies evs);
paulson@18886
   588
        Key K \<notin> analz (spies evs);
paulson@18886
   589
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   590
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   591
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   592
apply (blast dest!: ticket_authentic intro!: lemma_A)
paulson@18886
   593
done
paulson@18886
   594
paulson@18886
   595
lemma A_authenticates_B:
paulson@18886
   596
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (spies evs);
paulson@18886
   597
        Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   598
        Key K \<notin> analz (spies evs);
paulson@18886
   599
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   600
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   601
apply (blast dest!: Kab_authentic intro!: lemma_B)
paulson@18886
   602
done
paulson@18886
   603
paulson@18886
   604
paulson@18886
   605
subsection{*Temporal guarantees, relying on a temporal check that insures that
paulson@18886
   606
no oops event occurred. These are available in the sense of goal availability*}
paulson@18886
   607
paulson@18886
   608
paulson@18886
   609
text{*Temporal treatment of confidentiality*}
paulson@18886
   610
paulson@18886
   611
text{* Lemma: the session key sent in msg BK2 would be EXPIRED
paulson@18886
   612
    if the spy could see it! *}
paulson@18886
   613
lemma lemma_conf_temporal [rule_format (no_asm)]:
paulson@18886
   614
     "\<lbrakk> A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   615
  \<Longrightarrow> Says Server A
paulson@18886
   616
          (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   617
                            Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@18886
   618
         \<in> set evs \<longrightarrow>
paulson@18886
   619
      Key K \<in> analz (knows Spy evs) \<longrightarrow> expiredK Tk evs"
paulson@18886
   620
apply (erule bankerb_gets.induct)
paulson@18886
   621
apply (frule_tac [8] Says_Server_message_form)
paulson@18886
   622
apply (frule_tac [6] Gets_Server_message_form [THEN disjE])
paulson@18886
   623
apply (simp_all (no_asm_simp) add: less_SucI analz_insert_eq analz_insert_freshK pushes)
paulson@18886
   624
txt{*Fake*}
paulson@18886
   625
apply spy_analz
paulson@18886
   626
txt{*BK2*}
paulson@18886
   627
apply (blast intro: parts_insertI less_SucI)
paulson@18886
   628
txt{*BK3*}
paulson@18886
   629
apply (case_tac "Aa \<in> bad")
paulson@18886
   630
 prefer 2 apply (blast dest: Kab_authentic unique_session_keys)
paulson@18886
   631
apply (blast dest: Gets_imp_knows_Spy [THEN analz.Inj] Crypt_Spy_analz_bad elim!: MPair_analz intro: less_SucI)
paulson@18886
   632
txt{*Oops: PROOF FAILS if unsafe intro below*}
paulson@18886
   633
apply (blast dest: unique_session_keys intro!: less_SucI)
paulson@18886
   634
done
paulson@18886
   635
paulson@18886
   636
paulson@18886
   637
text{*Confidentiality for the Server: Spy does not see the keys sent in msg BK2
paulson@18886
   638
as long as they have not expired.*}
paulson@18886
   639
lemma Confidentiality_S_temporal:
paulson@18886
   640
     "\<lbrakk> Says Server A
paulson@18886
   641
          (Crypt K' \<lbrace>Number T, Agent B, Key K, X\<rbrace>) \<in> set evs;
paulson@18886
   642
         \<not> expiredK T evs;
paulson@18886
   643
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   644
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   645
apply (frule Says_Server_message_form, assumption)
paulson@18886
   646
apply (blast intro: lemma_conf_temporal)
paulson@18886
   647
done
paulson@18886
   648
paulson@18886
   649
text{*Confidentiality for Alice*}
paulson@18886
   650
lemma Confidentiality_A_temporal:
paulson@18886
   651
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number T, Agent B, Key K, X\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   652
         \<not> expiredK T evs;
paulson@18886
   653
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   654
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   655
by (blast dest!: Kab_authentic Confidentiality_S_temporal)
paulson@18886
   656
paulson@18886
   657
text{*Confidentiality for Bob*}
paulson@18886
   658
lemma Confidentiality_B_temporal:
paulson@18886
   659
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@18886
   660
          \<in> parts (knows Spy evs);
paulson@18886
   661
        \<not> expiredK Tk evs;
paulson@18886
   662
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets
paulson@18886
   663
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
paulson@18886
   664
by (blast dest!: ticket_authentic Confidentiality_S_temporal)
paulson@18886
   665
paulson@18886
   666
paulson@18886
   667
text{*Temporal treatment of authentication*}
paulson@18886
   668
paulson@18886
   669
text{*Authentication of A to B*}
paulson@18886
   670
lemma B_authenticates_A_temporal:
paulson@18886
   671
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (knows Spy evs);
paulson@18886
   672
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@18886
   673
         \<in> parts (knows Spy evs);
paulson@18886
   674
         \<not> expiredK Tk evs;
paulson@18886
   675
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   676
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   677
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   678
by (blast dest!: ticket_authentic
paulson@18886
   679
          intro!: lemma_A
paulson@18886
   680
          elim!: Confidentiality_S_temporal [THEN [2] rev_notE])
paulson@18886
   681
paulson@18886
   682
text{*Authentication of B to A*}
paulson@18886
   683
lemma A_authenticates_B_temporal:
paulson@18886
   684
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (knows Spy evs);
paulson@18886
   685
         Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>
paulson@18886
   686
         \<in> parts (knows Spy evs);
paulson@18886
   687
         \<not> expiredK Tk evs;
paulson@18886
   688
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   689
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   690
by (blast dest!: Kab_authentic
paulson@18886
   691
          intro!: lemma_B elim!: Confidentiality_S_temporal [THEN [2] rev_notE])
paulson@18886
   692
paulson@18886
   693
paulson@18886
   694
subsection{*Combined guarantees of key distribution and non-injective agreement on the session keys*}
paulson@18886
   695
paulson@18886
   696
lemma B_authenticates_and_keydist_to_A:
paulson@18886
   697
     "\<lbrakk> Gets B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   698
                Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs;
paulson@18886
   699
        Key K \<notin> analz (spies evs);
paulson@18886
   700
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   701
    \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   702
                  Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs 
paulson@18886
   703
     \<and>  Key K \<in> analz (knows A evs)"
paulson@18886
   704
apply (blast dest: B_authenticates_A BK3_imp_Gets Gets_A_knows_K)
paulson@18886
   705
done
paulson@18886
   706
paulson@18886
   707
lemma A_authenticates_and_keydist_to_B:
paulson@18886
   708
     "\<lbrakk> Gets A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   709
        Gets A (Crypt K (Number Ta)) \<in> set evs;
paulson@18886
   710
        Key K \<notin> analz (spies evs);
paulson@18886
   711
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerb_gets \<rbrakk>
paulson@18886
   712
    \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs
paulson@18886
   713
    \<and>   Key K \<in> analz (knows B evs)"
paulson@18886
   714
apply (blast dest: A_authenticates_B BK4_imp_Gets Gets_B_knows_K)
paulson@18886
   715
done
paulson@18886
   716
paulson@18886
   717
paulson@18886
   718
paulson@18886
   719
paulson@18886
   720
paulson@18886
   721
end