src/HOL/Auth/CertifiedEmail.thy
author paulson
Sat, 26 Apr 2003 12:38:42 +0200
changeset 13926 6e62e5357a10
parent 13922 75ae4244a596
child 13934 8c23dea4648e
permissions -rw-r--r--
converting more HOL-Auth to new-style theories
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/CertifiedEmail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     3
    Author:     Giampaolo Bella, Christiano Longo and Lawrence C Paulson
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     4
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     5
The certified electronic mail protocol by Abadi et al.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     6
*)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     7
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     8
theory CertifiedEmail = Public:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
     9
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    10
syntax
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    11
  TTP        :: agent
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    12
  RPwd       :: "agent => key"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    13
  TTPDecKey  :: key
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    14
  TTPEncKey  :: key
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    15
  TTPSigKey  :: key
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    16
  TTPVerKey  :: key
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    17
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    18
translations
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    19
  "TTP"   == "Server "
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    20
  "RPwd"  == "shrK "
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    21
  "TTPDecKey" == "priEK Server"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    22
  "TTPEncKey" == "pubEK Server" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    23
  "TTPSigKey" == "priSK Server"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    24
  "TTPVerKey" == "pubSK Server" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    25
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    26
 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    27
(*FIXME: the four options should be represented by pairs of 0 or 1.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    28
  Right now only BothAuth is modelled.*)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    29
consts
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    30
  NoAuth   :: nat
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    31
  TTPAuth  :: nat
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    32
  SAuth    :: nat
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    33
  BothAuth :: nat
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    34
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    35
text{*We formalize a fixed way of computing responses.  Could be better.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    36
constdefs
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    37
  "response"    :: "agent => agent => nat => msg"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    38
   "response S R q == Hash {|Agent S, Key (shrK R), Nonce q|}"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    39
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    40
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    41
consts  certified_mail   :: "event list set"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    42
inductive "certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    43
  intros 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    44
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    45
Nil: --{*The empty trace*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    46
     "[] \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    47
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    48
Fake: --{*The Spy may say anything he can say.  The sender field is correct,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    49
          but agents don't use that information.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    50
      "[| evsf \<in> certified_mail; X \<in> synth(analz(knows Spy evsf))|] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    51
       ==> Says Spy B X #evsf \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    52
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    53
FakeSSL: --{*The Spy may open SSL sessions with TTP, who is the only agent
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    54
    equipped with the necessary credentials to serve as an SSL server.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    55
	 "[| evsfssl \<in> certified_mail; X \<in> synth(analz(knows Spy evsfssl))|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    56
          ==> Notes TTP {|Agent Spy, Agent TTP, X|} # evsfssl \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    57
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    58
CM1: --{*The sender approaches the recipient.  The message is a number.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    59
"[|evs1 \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    60
   Key K \<notin> used evs1;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    61
   K \<in> symKeys;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    62
   Nonce q \<notin> used evs1;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    63
   hs = Hash {|Number cleartext, Nonce q, response S R q, Crypt K (Number m)|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    64
   S2TTP = Crypt TTPEncKey {|Agent S, Number BothAuth, Key K, Agent R, hs|}|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    65
 ==> Says S R {|Agent S, Agent TTP, Crypt K (Number m), Number BothAuth, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    66
                Number cleartext, Nonce q, S2TTP|} # evs1 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    67
       \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    68
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    69
CM2: --{*The recipient records @{term S2TTP'} while transmitting it and her
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    70
     password to @{term TTP} over an SSL channel.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    71
"[|evs2 \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    72
   Gets R {|Agent S, Agent TTP, em', Number BothAuth, Number cleartext', 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    73
            Nonce q', S2TTP'|} \<in> set evs2;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    74
   TTP \<noteq> R;  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    75
   hr = Hash {|Number cleartext', Nonce q', response S R q', em'|} |]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    76
 ==> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    77
  Notes TTP {|Agent R, Agent TTP, S2TTP', Key(RPwd R), hr|} # evs2
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    78
     \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    79
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    80
CM3: --{*@{term TTP} simultaneously reveals the key to the recipient and gives
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    81
         a receipt to the sender.  The SSL channel does not authenticate 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    82
         the client (@{term R'}), but @{term TTP} accepts the message only 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    83
         if the given password is that of the claimed sender, @{term R'}.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    84
         He replies over the established SSL channel.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    85
 "[|evs3 \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    86
    Notes TTP {|Agent R', Agent TTP, S2TTP'', Key(RPwd R'), hr'|} \<in> set evs3;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    87
    S2TTP'' = Crypt TTPEncKey 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    88
                     {|Agent S, Number BothAuth, Key k', Agent R', hs'|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    89
    TTP \<noteq> R';  hs' = hr';  k' \<in> symKeys|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    90
 ==> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    91
  Notes R' {|Agent TTP, Agent R', Key k', hr'|} # 
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
    92
  Gets S (Crypt TTPSigKey S2TTP'') # 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    93
  Says TTP S (Crypt TTPSigKey S2TTP'') # evs3 \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    94
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    95
Reception:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    96
 "[|evsr \<in> certified_mail; Says A B X \<in> set evsr|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    97
  ==> Gets B X#evsr \<in> certified_mail"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    98
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
    99
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   100
(*A "possibility property": there are traces that reach the end*)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   101
lemma "\<exists>S2TTP. \<exists>evs \<in> certified_mail.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   102
           Says TTP S (Crypt TTPSigKey S2TTP) \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   103
apply (rule bexE [OF Key_supply1]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   104
apply (intro exI bexI)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   105
apply (rule_tac [2] certified_mail.Nil
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   106
                    [THEN certified_mail.CM1, THEN certified_mail.Reception,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   107
                     THEN certified_mail.CM2, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   108
                     THEN certified_mail.CM3], possibility, possibility) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   109
apply auto 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   110
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   111
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   112
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   113
lemma Gets_imp_Says:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   114
 "[| Gets B X \<in> set evs; evs \<in> certified_mail |] ==> \<exists>A. Says A B X \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   115
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   116
apply (erule certified_mail.induct, auto)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   117
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   118
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   119
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   120
lemma Gets_imp_parts_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   121
     "[|Gets A X \<in> set evs; evs \<in> certified_mail|] ==> X \<in> parts(spies evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   122
apply (drule Gets_imp_Says, simp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   123
apply (blast dest: Says_imp_knows_Spy parts.Inj) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   124
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   125
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   126
lemma CM2_S2TTP_analz_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   127
 "[|Gets R {|Agent A, Agent B, em, Number AO, Number cleartext, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   128
              Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   129
    evs \<in> certified_mail|] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   130
  ==> S2TTP \<in> analz(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   131
apply (drule Gets_imp_Says, simp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   132
apply (blast dest: Says_imp_knows_Spy analz.Inj) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   133
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   134
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   135
lemmas CM2_S2TTP_parts_knows_Spy = 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   136
    CM2_S2TTP_analz_knows_Spy [THEN analz_subset_parts [THEN subsetD]]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   137
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   138
lemma hr_form_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   139
 "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   140
  ==> hr \<notin> synth (analz (knows Spy evs)) --> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   141
      (\<forall>S2TTP. Notes TTP {|Agent R, Agent TTP, S2TTP, pwd, hr|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   142
          \<in> set evs --> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   143
      (\<exists>clt q S em. hr = Hash {|Number clt, Nonce q, response S R q, em|}))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   144
apply (erule certified_mail.induct)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   145
apply (synth_analz_mono_contra, simp_all, blast+)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   146
done 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   147
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   148
text{*Cannot strengthen the first disjunct to @{term "R\<noteq>Spy"} because
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   149
the fakessl rule allows Spy to spoof the sender's name.  Maybe can
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   150
strengthen the second disjunct with @{term "R\<noteq>Spy"}.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   151
lemma hr_form:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   152
 "[|Notes TTP {|Agent R, Agent TTP, S2TTP, pwd, hr|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   153
    evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   154
  ==> hr \<in> synth (analz (knows Spy evs)) | 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   155
      (\<exists>clt q S em. hr = Hash {|Number clt, Nonce q, response S R q, em|})"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   156
by (blast intro: hr_form_lemma) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   157
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   158
lemma Spy_dont_know_private_keys [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   159
    "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   160
     ==> Key (privateKey b A) \<in> parts (spies evs) --> A \<in> bad"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   161
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   162
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   163
apply (blast dest: Fake_parts_insert[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   164
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   165
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   166
apply blast  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   167
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   168
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   169
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   170
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   171
 apply (force dest!: parts_insert_subset_Un[THEN [2] rev_subsetD] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   172
                     analz_subset_parts[THEN subsetD], blast) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   173
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   174
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   175
lemma Spy_know_private_keys_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   176
    "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   177
     ==> (Key (privateKey b A) \<in> parts (spies evs)) = (A \<in> bad)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   178
by (blast intro: Spy_dont_know_private_keys parts.Inj)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   179
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   180
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   181
lemma CM3_k_parts_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   182
 "[| evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   183
     Notes TTP {|Agent A, Agent TTP,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   184
                 Crypt TTPEncKey {|Agent S, Number AO, Key K, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   185
                 Agent R, hs|}, Key (RPwd R), hs|} \<in> set evs|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   186
  ==> Key K \<in> parts(spies evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   187
apply (rotate_tac 1)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   188
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   189
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   190
   apply (blast  intro:parts_insertI)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   191
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   192
apply (blast dest: analz_subset_parts[THEN subsetD] parts.Body) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   193
txt{*Message 2*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   194
apply (blast dest!: Says_imp_knows_Spy [THEN parts.Inj] Gets_imp_Says
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   195
             elim!: knows_Spy_partsEs)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   196
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   197
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   198
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   199
apply (simp_all add: parts_insert2)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   200
apply (blast intro: subsetD [OF parts_mono [OF Set.subset_insertI]])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   201
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   202
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   203
lemma Spy_dont_know_RPwd [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   204
    "evs \<in> certified_mail ==> Key (RPwd A) \<in> parts(spies evs) --> A \<in> bad"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   205
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   206
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   207
apply (blast dest: Fake_parts_insert[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   208
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   209
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   210
apply blast  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   211
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   212
apply (frule CM3_k_parts_knows_Spy, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   213
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   214
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   215
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   216
apply (force dest!: parts_insert_subset_Un[THEN [2] rev_subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   217
                    analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   218
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   219
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   220
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   221
lemma Spy_know_RPwd_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   222
    "evs \<in> certified_mail ==> (Key (RPwd A) \<in> parts(knows Spy evs)) = (A\<in>bad)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   223
by (auto simp add: Spy_dont_know_RPwd) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   224
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   225
lemma Spy_analz_RPwd_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   226
    "evs \<in> certified_mail ==> (Key (RPwd A) \<in> analz(knows Spy evs)) = (A\<in>bad)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   227
by (auto simp add: Spy_dont_know_RPwd [OF _ analz_subset_parts[THEN subsetD]]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   228
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   229
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   230
text{*Unused, but a guarantee of sorts*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   231
theorem CertAutenticity:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   232
     "[|Crypt TTPSigKey X \<in> parts (spies evs); evs \<in> certified_mail|] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   233
      ==> \<exists>A. Says TTP A (Crypt TTPSigKey X) \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   234
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   235
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   236
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   237
apply (blast dest: Spy_dont_know_private_keys Fake_parts_insert[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   238
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   239
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   240
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   241
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   242
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   243
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   244
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   245
apply (force dest!: parts_insert_subset_Un[THEN [2] rev_subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   246
                    analz_subset_parts[THEN subsetD], blast) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   247
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   248
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   249
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   250
lemma Spy_dont_know_TTPDecKey [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   251
     "evs \<in> certified_mail ==> Key TTPDecKey \<notin> parts(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   252
by auto
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   253
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   254
lemma Spy_dont_know_TTPDecKey_analz [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   255
     "evs \<in> certified_mail ==> Key TTPDecKey \<notin> analz(knows Spy evs)" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   256
by (force dest!: analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   257
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   258
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   259
lemma Spy_knows_TTPVerKey [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   260
     "Key (invKey TTPSigKey) \<in> analz(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   261
by simp
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   262
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   263
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   264
subsection{*Proving Confidentiality Results*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   265
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   266
lemma analz_image_freshK [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   267
 "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   268
   \<forall>K KK. invKey TTPEncKey \<notin> KK -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   269
          (Key K \<in> analz (Key`KK Un (knows Spy evs))) =
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   270
          (K \<in> KK | Key K \<in> analz (knows Spy evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   271
apply (erule certified_mail.induct)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   272
apply (drule_tac [6] A=TTP in symKey_neq_priEK) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   273
apply (erule_tac [6] disjE [OF hr_form]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   274
apply (drule_tac [5] CM2_S2TTP_analz_knows_Spy) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   275
prefer 9
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   276
apply (elim exE)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   277
apply (simp_all add: synth_analz_insert_eq
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   278
                     subset_trans [OF _ subset_insertI]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   279
                     subset_trans [OF _ Un_upper2] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   280
                del: image_insert image_Un add: analz_image_freshK_simps)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   281
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   282
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   283
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   284
lemma analz_insert_freshK:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   285
  "[| evs \<in> certified_mail;  KAB \<noteq> invKey TTPEncKey |] ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   286
      (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) =
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   287
      (K = KAB | Key K \<in> analz (knows Spy evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   288
by (simp only: analz_image_freshK analz_image_freshK_simps)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   289
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   290
text{*@{term S2TTP} must have originated from a valid sender
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   291
    provided @{term K} is secure.  Proof is surprisingly hard.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   292
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   293
lemma Notes_SSL_imp_used:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   294
     "[|Notes B {|Agent A, Agent B, X|} \<in> set evs|] ==> X \<in> used evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   295
by (blast dest!: Notes_imp_used)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   296
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   297
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   298
(*The weaker version, replacing "used evs" by "parts (knows Spy evs)", 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   299
   isn't inductive: message 3 case can't be proved *)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   300
lemma S2TTP_sender_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   301
 "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   302
    Key K \<notin> analz (knows Spy evs) -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   303
    (\<forall>AO. Crypt TTPEncKey
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   304
	   {|Agent S, Number AO, Key K, Agent R, hs|} \<in> used evs -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   305
    (\<exists>m ctxt q. 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   306
        hs = Hash{|Number ctxt, Nonce q, response S R q, Crypt K (Number m)|} &
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   307
	Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   308
	   {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   309
	     Number ctxt, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   310
	     Crypt TTPEncKey
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   311
	      {|Agent S, Number AO, Key K, Agent R, hs |}|} \<in> set evs))" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   312
apply (erule certified_mail.induct, analz_mono_contra)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   313
apply (drule_tac [5] CM2_S2TTP_parts_knows_Spy, simp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   314
apply (simp add: used_Nil Crypt_notin_initState, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   315
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   316
apply (blast dest: Fake_parts_sing[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   317
             dest!: analz_subset_parts[THEN subsetD])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   318
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   319
apply (blast dest: Fake_parts_sing[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   320
            dest: analz_subset_parts[THEN subsetD])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   321
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   322
apply clarsimp
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   323
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   324
txt{*Message 2*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   325
apply (simp add: parts_insert2, clarify) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   326
apply (drule parts_cut, assumption, simp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   327
apply (blast dest: parts_knows_Spy_subset_used [THEN subsetD]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   328
txt{*Message 3*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   329
apply (blast dest: Notes_SSL_imp_used used_parts_subset_parts) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   330
done 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   331
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   332
lemma S2TTP_sender:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   333
 "[|Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|} \<in> used evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   334
    Key K \<notin> analz (knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   335
    evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   336
  ==> \<exists>m ctxt q. 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   337
        hs = Hash{|Number ctxt, Nonce q, response S R q, Crypt K (Number m)|} &
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   338
	Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   339
	   {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   340
	     Number ctxt, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   341
	     Crypt TTPEncKey
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   342
	      {|Agent S, Number AO, Key K, Agent R, hs |}|} \<in> set evs" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   343
by (blast intro: S2TTP_sender_lemma) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   344
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   345
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   346
text{*Nobody can have used non-existent keys!*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   347
lemma new_keys_not_used [rule_format, simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   348
    "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   349
     ==> K \<notin> keysFor (parts (spies evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   350
apply (erule rev_mp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   351
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   352
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   353
apply (force dest!: keysFor_parts_insert) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   354
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   355
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   356
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   357
apply (frule CM3_k_parts_knows_Spy, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   358
apply (frule_tac hr_form, assumption) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   359
apply (force dest!: keysFor_parts_insert)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   360
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   361
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   362
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   363
text{*Less easy to prove @{term "m'=m"}.  Maybe needs a separate unicity
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   364
theorem for ciphertexts of the form @{term "Crypt K (Number m)"}, 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   365
where @{term K} is secure.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   366
lemma Key_unique_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   367
     "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   368
       Key K \<notin> analz (knows Spy evs) -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   369
       (\<forall>m cleartext q hs.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   370
        Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   371
           {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   372
             Number cleartext, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   373
             Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   374
          \<in> set evs -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   375
       (\<forall>m' cleartext' q' hs'.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   376
       Says S' R'
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   377
           {|Agent S', Agent TTP, Crypt K (Number m'), Number AO',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   378
             Number cleartext', Nonce q',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   379
             Crypt TTPEncKey {|Agent S', Number AO', Key K, Agent R', hs'|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   380
          \<in> set evs --> R' = R & S' = S & AO' = AO & hs' = hs))" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   381
apply (erule certified_mail.induct, analz_mono_contra, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   382
txt{*Fake*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   383
apply (blast dest!: usedI S2TTP_sender analz_subset_parts[THEN subsetD]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   384
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   385
apply (blast dest!: Says_imp_knows_Spy [THEN parts.Inj] new_keys_not_used Crypt_imp_keysFor) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   386
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   387
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   388
text{*The key determines the sender, recipient and protocol options.*}
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   389
lemma Key_unique:
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   390
      "[|Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   391
           {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   392
             Number cleartext, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   393
             Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   394
          \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   395
         Says S' R'
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   396
           {|Agent S', Agent TTP, Crypt K (Number m'), Number AO',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   397
             Number cleartext', Nonce q',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   398
             Crypt TTPEncKey {|Agent S', Number AO', Key K, Agent R', hs'|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   399
          \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   400
         Key K \<notin> analz (knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   401
         evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   402
       ==> R' = R & S' = S & AO' = AO & hs' = hs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   403
by (rule Key_unique_lemma, assumption+)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   404
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   405
subsection{*The Guarantees for Sender and Recipient*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   406
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   407
text{*If Spy gets the key then @{term R} is bad and also @{term S} at least
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   408
      gets his return receipt (and therefore has no grounds for complaint).*}
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   409
theorem Spy_see_encrypted_key_imp:
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   410
      "[|Says S R {|Agent S, Agent TTP, Crypt K (Number m), Number AO, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   411
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   412
         Key K \<in> analz(knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   413
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   414
	 evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   415
         S\<noteq>Spy|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   416
      ==> R \<in> bad & Says TTP S (Crypt TTPSigKey S2TTP) \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   417
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   418
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   419
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   420
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   421
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   422
apply spy_analz
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   423
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   424
apply spy_analz
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   425
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   426
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   427
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   428
apply (simp_all add: synth_analz_insert_eq  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   429
                     subset_trans [OF _ subset_insertI]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   430
                     subset_trans [OF _ Un_upper2] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   431
                del: image_insert image_Un add: analz_image_freshK_simps) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   432
apply (simp_all add: symKey_neq_priEK analz_insert_freshK)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   433
apply (blast dest: Notes_SSL_imp_used S2TTP_sender Key_unique)+
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   434
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   435
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   436
text{*Confidentially for the symmetric key*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   437
theorem Spy_not_see_encrypted_key:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   438
      "[|Says S R {|Agent S, Agent TTP, Crypt K (Number m), Number AO, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   439
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   440
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   441
	 evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   442
         S\<noteq>Spy; R \<notin> bad|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   443
      ==> Key K \<notin> analz(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   444
by (blast dest: Spy_see_encrypted_key_imp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   445
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   446
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   447
text{*Agent @{term R}, who may be the Spy, doesn't receive the key
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   448
 until @{term S} has access to the return receipt.*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   449
theorem S_guarantee:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   450
      "[|Notes R {|Agent TTP, Agent R, Key K, hs|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   451
         Says S R {|Agent S, Agent TTP, Crypt K (Number m), Number AO, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   452
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   453
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   454
         hs = Hash {|Number cleartext, Nonce q, response S R q, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   455
                     Crypt K (Number m)|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   456
         S\<noteq>Spy;  evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   457
      ==> Says TTP S (Crypt TTPSigKey S2TTP) \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   458
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   459
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   460
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   461
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   462
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   463
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   464
apply (blast dest: Notes_imp_used) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   465
txt{*Message 3*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   466
apply (blast dest: Notes_SSL_imp_used S2TTP_sender Key_unique 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   467
                   Spy_see_encrypted_key_imp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   468
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   469
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   470
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   471
lemma Says_TTP_imp_Notes:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   472
  "[|Says TTP S (Crypt TTPSigKey S2TTP) \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   473
     S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   474
	         Hash {|Number cleartext, Nonce q, r, em|}|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   475
     evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   476
   ==> Notes TTP
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   477
	   {|Agent R, Agent TTP, S2TTP, Key (RPwd R),
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   478
	     Hash {|Number cleartext, Nonce q, r, em|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   479
	  \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   480
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   481
apply (erule ssubst) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   482
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   483
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   484
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   485
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   486
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   487
text{*Recipient's guarantee: if @{term R} sends message 2, and
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   488
     @{term S} gets a delivery certificate, then @{term R}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   489
     receives the necessary key.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   490
theorem R_guarantee:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   491
  "[|Notes TTP {|Agent R, Agent TTP, S2TTP, Key(RPwd R), hr|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   492
     Says TTP S (Crypt TTPSigKey S2TTP) \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   493
     S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   494
	         Hash {|Number cleartext, Nonce q, r, em|}|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   495
     hr = Hash {|Number cleartext, Nonce q, r, em|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   496
     R\<noteq>Spy;  evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   497
  ==> Notes R {|Agent TTP, Agent R, Key K, hr|} \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   498
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   499
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   500
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   501
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   502
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   503
txt{*Message 2*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   504
apply clarify
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   505
apply (drule Says_TTP_imp_Notes [OF _ refl], assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   506
apply simp  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   507
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   508
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   509
end