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