src/HOL/Auth/CertifiedEmail.thy
author paulson
Tue, 29 Apr 2003 12:36:40 +0200
changeset 13934 8c23dea4648e
parent 13926 6e62e5357a10
child 13956 8fe7e12290e1
permissions -rw-r--r--
better guarantees
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, 
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   108
                     THEN certified_mail.CM3], possibility, possibility, auto) 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   109
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   110
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
lemma Gets_imp_Says:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   113
 "[| 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
   114
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   115
apply (erule certified_mail.induct, auto)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   116
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   117
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
lemma Gets_imp_parts_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   120
     "[|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
   121
apply (drule Gets_imp_Says, simp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   122
apply (blast dest: Says_imp_knows_Spy parts.Inj) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   123
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   124
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   125
lemma CM2_S2TTP_analz_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   126
 "[|Gets R {|Agent A, Agent B, em, Number AO, Number cleartext, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   127
              Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   128
    evs \<in> certified_mail|] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   129
  ==> S2TTP \<in> analz(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   130
apply (drule Gets_imp_Says, simp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   131
apply (blast dest: Says_imp_knows_Spy analz.Inj) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   132
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   133
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   134
lemmas CM2_S2TTP_parts_knows_Spy = 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   135
    CM2_S2TTP_analz_knows_Spy [THEN analz_subset_parts [THEN subsetD]]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   136
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   137
lemma hr_form_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   138
 "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   139
  ==> hr \<notin> synth (analz (knows Spy evs)) --> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   140
      (\<forall>S2TTP. Notes TTP {|Agent R, Agent TTP, S2TTP, pwd, hr|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   141
          \<in> set evs --> 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   142
      (\<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
   143
apply (erule certified_mail.induct)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   144
apply (synth_analz_mono_contra, simp_all, blast+)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   145
done 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   146
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   147
text{*Cannot strengthen the first disjunct to @{term "R\<noteq>Spy"} because
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   148
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
   149
strengthen the second disjunct with @{term "R\<noteq>Spy"}.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   150
lemma hr_form:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   151
 "[|Notes TTP {|Agent R, Agent TTP, S2TTP, pwd, hr|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   152
    evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   153
  ==> hr \<in> synth (analz (knows Spy evs)) | 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   154
      (\<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
   155
by (blast intro: hr_form_lemma) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   156
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   157
lemma Spy_dont_know_private_keys [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   158
    "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   159
     ==> Key (privateKey b A) \<in> parts (spies evs) --> A \<in> bad"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   160
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   161
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   162
apply (blast dest: Fake_parts_insert[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   163
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   164
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   165
apply blast  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   166
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   167
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   168
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   169
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   170
 apply (force dest!: parts_insert_subset_Un[THEN [2] rev_subsetD] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   171
                     analz_subset_parts[THEN subsetD], blast) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   172
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   173
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   174
lemma Spy_know_private_keys_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   175
    "evs \<in> certified_mail
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   176
     ==> (Key (privateKey b A) \<in> parts (spies evs)) = (A \<in> bad)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   177
by (blast intro: Spy_dont_know_private_keys parts.Inj)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   178
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   179
lemma Spy_dont_know_TTPDecKey [simp]:
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   180
     "evs \<in> certified_mail ==> Key TTPDecKey \<notin> parts(knows Spy evs)"
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   181
by auto
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   182
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   183
lemma Spy_dont_know_TTPDecKey_analz [simp]:
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   184
     "evs \<in> certified_mail ==> Key TTPDecKey \<notin> analz(knows Spy evs)" 
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   185
by (force dest!: analz_subset_parts[THEN subsetD])
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   186
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   187
lemma Spy_dont_know_TTPSigKey [simp]:
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   188
     "evs \<in> certified_mail ==> Key TTPSigKey \<notin> parts(knows Spy evs)"
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   189
by auto
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   190
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   191
lemma Spy_dont_know_TTPSigKey_analz [simp]:
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   192
     "evs \<in> certified_mail ==> Key TTPSigKey \<notin> analz(knows Spy evs)" 
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   193
by (force dest!: analz_subset_parts[THEN subsetD])
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   194
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   195
text{*Thus, prove any goal that assumes that @{term Spy} knows a private key
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   196
belonging to @{term TTP}*}
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   197
declare Spy_dont_know_TTPDecKey [THEN [2] rev_notE, elim!]
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   198
declare Spy_dont_know_TTPSigKey [THEN [2] rev_notE, elim!]
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   199
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   200
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   201
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   202
lemma CM3_k_parts_knows_Spy:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   203
 "[| evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   204
     Notes TTP {|Agent A, Agent TTP,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   205
                 Crypt TTPEncKey {|Agent S, Number AO, Key K, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   206
                 Agent R, hs|}, Key (RPwd R), hs|} \<in> set evs|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   207
  ==> Key K \<in> parts(spies evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   208
apply (rotate_tac 1)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   209
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   210
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   211
   apply (blast  intro:parts_insertI)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   212
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   213
apply (blast dest: analz_subset_parts[THEN subsetD] parts.Body) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   214
txt{*Message 2*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   215
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
   216
             elim!: knows_Spy_partsEs)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   217
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   218
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   219
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   220
apply (simp_all add: parts_insert2)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   221
apply (blast intro: subsetD [OF parts_mono [OF Set.subset_insertI]])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   222
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   223
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   224
lemma Spy_dont_know_RPwd [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   225
    "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
   226
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   227
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   228
apply (blast dest: Fake_parts_insert[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   229
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   230
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   231
apply blast  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   232
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   233
apply (frule CM3_k_parts_knows_Spy, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   234
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   235
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   236
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   237
apply (force dest!: parts_insert_subset_Un[THEN [2] rev_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
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   240
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   241
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   242
lemma Spy_know_RPwd_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   243
    "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
   244
by (auto simp add: Spy_dont_know_RPwd) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   245
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   246
lemma Spy_analz_RPwd_iff [simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   247
    "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
   248
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
   249
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   250
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   251
text{*Unused, but a guarantee of sorts*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   252
theorem CertAutenticity:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   253
     "[|Crypt TTPSigKey X \<in> parts (spies evs); evs \<in> certified_mail|] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   254
      ==> \<exists>A. Says TTP A (Crypt TTPSigKey X) \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   255
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   256
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   257
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   258
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
   259
                   analz_subset_parts[THEN subsetD])
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   260
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   261
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   262
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   263
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   264
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   265
apply (simp_all add: parts_insert2) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   266
apply (force dest!: parts_insert_subset_Un[THEN [2] rev_subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   267
                    analz_subset_parts[THEN subsetD], blast) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   268
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   269
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   270
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   271
subsection{*Proving Confidentiality Results*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   272
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   273
lemma analz_image_freshK [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   274
 "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   275
   \<forall>K KK. invKey TTPEncKey \<notin> KK -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   276
          (Key K \<in> analz (Key`KK Un (knows Spy evs))) =
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   277
          (K \<in> KK | Key K \<in> analz (knows Spy evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   278
apply (erule certified_mail.induct)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   279
apply (drule_tac [6] A=TTP in symKey_neq_priEK) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   280
apply (erule_tac [6] disjE [OF hr_form]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   281
apply (drule_tac [5] CM2_S2TTP_analz_knows_Spy) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   282
prefer 9
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   283
apply (elim exE)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   284
apply (simp_all add: synth_analz_insert_eq
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   285
                     subset_trans [OF _ subset_insertI]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   286
                     subset_trans [OF _ Un_upper2] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   287
                del: image_insert image_Un add: analz_image_freshK_simps)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   288
done
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
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   291
lemma analz_insert_freshK:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   292
  "[| evs \<in> certified_mail;  KAB \<noteq> invKey TTPEncKey |] ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   293
      (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) =
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   294
      (K = KAB | Key K \<in> analz (knows Spy evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   295
by (simp only: analz_image_freshK analz_image_freshK_simps)
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
text{*@{term S2TTP} must have originated from a valid sender
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   298
    provided @{term K} is secure.  Proof is surprisingly hard.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   299
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   300
lemma Notes_SSL_imp_used:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   301
     "[|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
   302
by (blast dest!: Notes_imp_used)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   303
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   304
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   305
(*The weaker version, replacing "used evs" by "parts (knows Spy evs)", 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   306
   isn't inductive: message 3 case can't be proved *)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   307
lemma S2TTP_sender_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   308
 "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   309
    Key K \<notin> analz (knows Spy evs) -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   310
    (\<forall>AO. 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> used evs -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   312
    (\<exists>m ctxt q. 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   313
        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
   314
	Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   315
	   {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   316
	     Number ctxt, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   317
	     Crypt TTPEncKey
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   318
	      {|Agent S, Number AO, Key K, Agent R, hs |}|} \<in> set evs))" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   319
apply (erule certified_mail.induct, analz_mono_contra)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   320
apply (drule_tac [5] CM2_S2TTP_parts_knows_Spy, simp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   321
apply (simp add: used_Nil Crypt_notin_initState, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   322
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   323
apply (blast dest: Fake_parts_sing[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   324
             dest!: analz_subset_parts[THEN subsetD])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   325
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   326
apply (blast dest: Fake_parts_sing[THEN subsetD]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   327
            dest: analz_subset_parts[THEN subsetD])  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   328
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   329
apply clarsimp
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   330
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   331
txt{*Message 2*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   332
apply (simp add: parts_insert2, clarify) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   333
apply (drule parts_cut, assumption, simp) 
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   334
apply (blast intro: usedI) 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   335
txt{*Message 3*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   336
apply (blast dest: Notes_SSL_imp_used used_parts_subset_parts) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   337
done 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   338
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   339
lemma S2TTP_sender:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   340
 "[|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
   341
    Key K \<notin> analz (knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   342
    evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   343
  ==> \<exists>m ctxt q. 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   344
        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
   345
	Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   346
	   {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   347
	     Number ctxt, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   348
	     Crypt TTPEncKey
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   349
	      {|Agent S, Number AO, Key K, Agent R, hs |}|} \<in> set evs" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   350
by (blast intro: S2TTP_sender_lemma) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   351
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   352
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   353
text{*Nobody can have used non-existent keys!*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   354
lemma new_keys_not_used [rule_format, simp]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   355
    "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   356
     ==> K \<notin> keysFor (parts (spies evs))"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   357
apply (erule rev_mp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   358
apply (erule certified_mail.induct, simp_all) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   359
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   360
apply (force dest!: keysFor_parts_insert) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   361
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   362
apply blast 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   363
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   364
apply (frule CM3_k_parts_knows_Spy, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   365
apply (frule_tac hr_form, assumption) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   366
apply (force dest!: keysFor_parts_insert)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   367
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   368
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   369
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   370
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
   371
theorem for ciphertexts of the form @{term "Crypt K (Number m)"}, 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   372
where @{term K} is secure.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   373
lemma Key_unique_lemma [rule_format]:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   374
     "evs \<in> certified_mail ==>
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   375
       Key K \<notin> analz (knows Spy evs) -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   376
       (\<forall>m cleartext q hs.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   377
        Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   378
           {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   379
             Number cleartext, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   380
             Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   381
          \<in> set evs -->
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   382
       (\<forall>m' cleartext' q' hs'.
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   383
       Says S' R'
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   384
           {|Agent S', Agent TTP, Crypt K (Number m'), Number AO',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   385
             Number cleartext', Nonce q',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   386
             Crypt TTPEncKey {|Agent S', Number AO', Key K, Agent R', hs'|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   387
          \<in> set evs --> R' = R & S' = S & AO' = AO & hs' = hs))" 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   388
apply (erule certified_mail.induct, analz_mono_contra, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   389
txt{*Fake*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   390
apply (blast dest!: usedI S2TTP_sender analz_subset_parts[THEN subsetD]) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   391
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   392
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
   393
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   394
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   395
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
   396
lemma Key_unique:
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   397
      "[|Says S R
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   398
           {|Agent S, Agent TTP, Crypt K (Number m), Number AO,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   399
             Number cleartext, Nonce q,
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   400
             Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   401
          \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   402
         Says S' R'
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   403
           {|Agent S', Agent TTP, Crypt K (Number m'), Number AO',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   404
             Number cleartext', Nonce q',
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   405
             Crypt TTPEncKey {|Agent S', Number AO', Key K, Agent R', hs'|}|}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   406
          \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   407
         Key K \<notin> analz (knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   408
         evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   409
       ==> R' = R & S' = S & AO' = AO & hs' = hs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   410
by (rule Key_unique_lemma, assumption+)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   411
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   412
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   413
subsection{*The Guarantees for Sender and Recipient*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13922
diff changeset
   414
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   415
text{*A Sender's guarantee:
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   416
      If Spy gets the key then @{term R} is bad and @{term S} moreover
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   417
      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
   418
theorem Spy_see_encrypted_key_imp:
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   419
      "[|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
   420
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   421
         Key K \<in> analz(knows Spy evs);
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   422
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   423
	 evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   424
         S\<noteq>Spy|]
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   425
      ==> R \<in> bad & Gets S (Crypt TTPSigKey S2TTP) \<in> set evs"
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   426
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   427
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   428
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   429
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   430
txt{*Fake*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   431
apply spy_analz
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   432
txt{*Fake SSL*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   433
apply spy_analz
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   434
txt{*Message 3*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   435
apply (frule_tac hr_form, assumption)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   436
apply (elim disjE exE) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   437
apply (simp_all add: synth_analz_insert_eq  
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   438
                     subset_trans [OF _ subset_insertI]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   439
                     subset_trans [OF _ Un_upper2] 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   440
                del: image_insert image_Un add: analz_image_freshK_simps) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   441
apply (simp_all add: symKey_neq_priEK analz_insert_freshK)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   442
apply (blast dest: Notes_SSL_imp_used S2TTP_sender Key_unique)+
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   443
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   444
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   445
text{*Confidentially for the symmetric key*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   446
theorem Spy_not_see_encrypted_key:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   447
      "[|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
   448
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   449
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   450
	 evs \<in> certified_mail;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   451
         S\<noteq>Spy; R \<notin> bad|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   452
      ==> Key K \<notin> analz(knows Spy evs)"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   453
by (blast dest: Spy_see_encrypted_key_imp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   454
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   455
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   456
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
   457
 until @{term S} has access to the return receipt.*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   458
theorem S_guarantee:
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   459
      "[|Notes R {|Agent TTP, Agent R, Key K, hs|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   460
         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
   461
                     Number cleartext, Nonce q, S2TTP|} \<in> set evs;
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   462
         S2TTP = Crypt TTPEncKey {|Agent S, Number AO, Key K, Agent R, hs|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   463
         hs = Hash {|Number cleartext, Nonce q, response S R q, 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   464
                     Crypt K (Number m)|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   465
         S\<noteq>Spy;  evs \<in> certified_mail|]
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   466
      ==> Gets S (Crypt TTPSigKey S2TTP) \<in> set evs"
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   467
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   468
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   469
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   470
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   471
apply (erule certified_mail.induct, simp_all)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   472
txt{*Message 1*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   473
apply (blast dest: Notes_imp_used) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   474
txt{*Message 3*} 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   475
apply (blast dest: Notes_SSL_imp_used S2TTP_sender Key_unique 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   476
                   Spy_see_encrypted_key_imp) 
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   477
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   478
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   479
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   480
text{*Recipient's guarantee: if @{term R} sends message 2, and
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   481
     a delivery certificate exists, then @{term R}
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   482
     receives the necessary key.*}
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   483
theorem R_guarantee:
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   484
  "[|Crypt TTPSigKey S2TTP \<in> used evs;
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   485
     S2TTP = Crypt TTPEncKey
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   486
               {|Agent S, Number AO, Key K, Agent R, 
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   487
                 Hash {|Number cleartext, Nonce q, r, em|}|};
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   488
     hr = Hash {|Number cleartext, Nonce q, r, em|};
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   489
     R\<noteq>Spy;  evs \<in> certified_mail|]
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   490
  ==> Notes R {|Agent TTP, Agent R, Key K, hr|} \<in> set evs"
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   491
apply (erule rev_mp)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   492
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   493
apply (erule ssubst)
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   494
apply (erule certified_mail.induct, simp_all)
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   495
txt{*Fake*} 
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   496
apply (blast dest: Fake_parts_sing[THEN subsetD]
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   497
             dest!: analz_subset_parts[THEN subsetD])  
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   498
txt{*Fake SSL*}
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   499
apply (blast dest: Fake_parts_sing[THEN subsetD]
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   500
            dest!: analz_subset_parts[THEN subsetD])  
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   501
txt{*Message 2*}
13934
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   502
apply (drule CM2_S2TTP_parts_knows_Spy, assumption)
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   503
apply (force dest: parts_cut)
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   504
txt{*Message 3*}
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   505
apply (frule_tac hr_form, assumption)
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   506
apply (elim disjE exE, simp_all) 
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   507
apply (blast dest: Fake_parts_sing[THEN subsetD]
8c23dea4648e better guarantees
paulson
parents: 13926
diff changeset
   508
             dest!: analz_subset_parts[THEN subsetD]) 
13922
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   509
done
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   510
75ae4244a596 Changes required by the certified email protocol
paulson
parents:
diff changeset
   511
end