src/HOL/Auth/Yahalom2.ML
author paulson
Tue, 08 Sep 1998 15:17:11 +0200
changeset 5434 9b4bed3f394c
parent 5421 01fc8d6a40f2
child 5492 d9fc3457554e
permissions -rw-r--r--
Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Yahalom2
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     2
    ID:         $Id$
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     5
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     6
Inductive relation "yahalom" for the Yahalom protocol, Variant 2.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     7
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     8
This version trades encryption of NB for additional explicitness in YM3.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     9
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    10
From page 259 of
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    11
  Burrows, Abadi and Needham.  A Logic of Authentication.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    12
  Proc. Royal Soc. 426 (1989)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    13
*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    14
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    15
AddEs spies_partsEs;
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    16
AddDs [impOfSubs analz_subset_parts];
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    17
AddDs [impOfSubs Fake_parts_insert];
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    18
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    19
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
    20
(*A "possibility property": there are traces that reach the end*)
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    21
Goal "EX X NB K. EX evs: yahalom.          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    22
\            Says A B {|X, Crypt K (Nonce NB)|} : set evs";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    23
by (REPEAT (resolve_tac [exI,bexI] 1));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    24
by (rtac (yahalom.Nil RS yahalom.YM1 RS yahalom.YM2 RS yahalom.YM3 RS 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    25
          yahalom.YM4) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    26
by possibility_tac;
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    27
result();
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    28
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    29
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    30
(**** Inductive proofs about yahalom ****)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    31
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    32
(** For reasoning about the encrypted portion of messages **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    33
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    34
(*Lets us treat YM4 using a similar argument as for the Fake case.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    35
Goal "Says S A {|NB, Crypt (shrK A) Y, X|} : set evs ==> \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    36
\             X : analz (spies evs)";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    37
by (blast_tac (claset() addSDs [Says_imp_spies RS analz.Inj]) 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    38
qed "YM4_analz_spies";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    39
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    40
bind_thm ("YM4_parts_spies",
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    41
          YM4_analz_spies RS (impOfSubs analz_subset_parts));
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    42
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    43
(*Relates to both YM4 and Oops*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    44
Goal "Says S A {|NB, Crypt (shrK A) {|B,K,NA|}, X|} : set evs ==> \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    45
\             K : parts (spies evs)";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    46
by (Blast_tac 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    47
qed "YM4_Key_parts_spies";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    48
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    49
(*For proving the easier theorems about X ~: parts (spies evs).*)
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    50
fun parts_spies_tac i = 
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    51
    forward_tac [YM4_Key_parts_spies] (i+6) THEN
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    52
    forward_tac [YM4_parts_spies] (i+5)     THEN
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    53
    prove_simple_subgoals_tac  i;
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    54
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    55
(*Induction for regularity theorems.  If induction formula has the form
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    56
   X ~: analz (spies evs) --> ... then it shortens the proof by discarding
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    57
   needless information about analz (insert X (spies evs))  *)
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    58
fun parts_induct_tac i = 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    59
    etac yahalom.induct i
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    60
    THEN 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    61
    REPEAT (FIRSTGOAL analz_mono_contra_tac)
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    62
    THEN  parts_spies_tac i;
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
    63
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    64
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    65
(** Theorems of the form X ~: parts (spies evs) imply that NOBODY
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    66
    sends messages containing X! **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    67
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    68
(*Spy never sees another agent's shared key! (unless it's bad at start)*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    69
Goal "evs : yahalom ==> (Key (shrK A) : parts (spies evs)) = (A : bad)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    70
by (parts_induct_tac 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    71
by (ALLGOALS Blast_tac);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    72
qed "Spy_see_shrK";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    73
Addsimps [Spy_see_shrK];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    74
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    75
Goal "evs : yahalom ==> (Key (shrK A) : analz (spies evs)) = (A : bad)";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    76
by Auto_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    77
qed "Spy_analz_shrK";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    78
Addsimps [Spy_analz_shrK];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    79
4471
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    80
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    81
	Spy_analz_shrK RSN (2, rev_iffD1)];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    82
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    83
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
    84
(*Nobody can have used non-existent keys!  Needed to apply analz_insert_Key*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    85
Goal "evs : yahalom ==>          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    86
\      Key K ~: used evs --> K ~: keysFor (parts (spies evs))";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    87
by (parts_induct_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    88
(*YM4: Key K is not fresh!*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
    89
by (Blast_tac 3);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    90
(*YM3*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    91
by (blast_tac (claset() addss (simpset())) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    92
(*Fake*)
4509
828148415197 Making proofs faster, especially using keysFor_parts_insert
paulson
parents: 4477
diff changeset
    93
by (blast_tac (claset() addSDs [keysFor_parts_insert]) 1);
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2155
diff changeset
    94
qed_spec_mp "new_keys_not_used";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    95
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    96
bind_thm ("new_keys_not_analzd",
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    97
          [analz_subset_parts RS keysFor_mono,
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    98
           new_keys_not_used] MRS contra_subsetD);
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    99
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   100
Addsimps [new_keys_not_used, new_keys_not_analzd];
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   101
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   102
(*Describes the form of K when the Server sends this message.  Useful for
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   103
  Oops as well as main secrecy property.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   104
Goal "[| Says Server A {|nb', Crypt (shrK A) {|Agent B, Key K, na|}, X|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   105
\         : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   106
\        evs : yahalom |]                                       \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   107
\     ==> K ~: range shrK";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   108
by (etac rev_mp 1);
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   109
by (etac yahalom.induct 1);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   110
by (ALLGOALS Asm_simp_tac);
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   111
qed "Says_Server_message_form";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   112
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   113
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   114
(*For proofs involving analz.*)
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   115
val analz_spies_tac = 
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   116
    dtac YM4_analz_spies 6 THEN
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   117
    forward_tac [Says_Server_message_form] 7 THEN
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   118
    assume_tac 7 THEN
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   119
    REPEAT ((etac conjE ORELSE' hyp_subst_tac) 7);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   120
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   121
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   122
(****
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   123
 The following is to prove theorems of the form
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   124
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   125
          Key K : analz (insert (Key KAB) (spies evs)) ==>
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   126
          Key K : analz (spies evs)
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   127
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   128
 A more general formula must be proved inductively.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   129
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   130
****)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   131
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   132
(** Session keys are not used to encrypt other session keys **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   133
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   134
Goal "evs : yahalom ==>                               \
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   135
\  ALL K KK. KK <= Compl (range shrK) -->                \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   136
\         (Key K : analz (Key``KK Un (spies evs))) =  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   137
\         (K : KK | Key K : analz (spies evs))";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   138
by (etac yahalom.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   139
by analz_spies_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   140
by (REPEAT_FIRST (resolve_tac [allI, impI]));
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   141
by (REPEAT_FIRST (rtac analz_image_freshK_lemma));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   142
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   143
(*Fake*) 
4422
21238c9d363e Simplified proofs using rewrites for f``A where f is injective
paulson
parents: 4238
diff changeset
   144
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   145
qed_spec_mp "analz_image_freshK";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   146
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   147
Goal "[| evs : yahalom;  KAB ~: range shrK |] ==>     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   148
\     Key K : analz (insert (Key KAB) (spies evs)) =  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   149
\     (K = KAB | Key K : analz (spies evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   150
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   151
qed "analz_insert_freshK";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   152
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   153
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   154
(*** The Key K uniquely identifies the Server's  message. **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   155
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   156
Goal "evs : yahalom ==>                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   157
\   EX A' B' na' nb' X'. ALL A B na nb X.                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   158
\       Says Server A                                       \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   159
\        {|nb, Crypt (shrK A) {|Agent B, Key K, na|}, X|}   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   160
\       : set evs --> A=A' & B=B' & na=na' & nb=nb' & X=X'";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   161
by (etac yahalom.induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   162
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib])));
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   163
by (Clarify_tac 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   164
(*Remaining case: YM3*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   165
by (expand_case_tac "K = ?y" 1);
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   166
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   167
(*...we assume X is a recent message and handle this case by contradiction*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   168
by (blast_tac (claset() delrules [conjI]    (*prevent splitup into 4 subgoals*)
4199
2b9fc1f08886 Fixed indentation
paulson
parents: 4153
diff changeset
   169
                        addss (simpset() addsimps [parts_insertI])) 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   170
val lemma = result();
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   171
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   172
Goal "[| Says Server A                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   173
\         {|nb, Crypt (shrK A) {|Agent B, Key K, na|}, X|} : set evs; \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   174
\       Says Server A'                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   175
\         {|nb', Crypt (shrK A') {|Agent B', Key K, na'|}, X'|} : set evs; \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   176
\       evs : yahalom |]                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   177
\    ==> A=A' & B=B' & na=na' & nb=nb'";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   178
by (prove_unique_tac lemma 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   179
qed "unique_session_keys";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   180
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   181
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   182
(** Crucial secrecy property: Spy does not see the keys sent in msg YM3 **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   183
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   184
Goal "[| A ~: bad;  B ~: bad;  evs : yahalom |]              \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   185
\     ==> Says Server A                                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   186
\           {|nb, Crypt (shrK A) {|Agent B, Key K, na|},     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   187
\                 Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   188
\          : set evs -->                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   189
\         Notes Spy {|na, nb, Key K|} ~: set evs -->         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   190
\         Key K ~: analz (spies evs)";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   191
by (etac yahalom.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   192
by analz_spies_tac;
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   193
by (ALLGOALS
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   194
    (asm_simp_tac 
4831
dae4d63a1318 Renamed expand_const -> split_const.
nipkow
parents: 4686
diff changeset
   195
     (simpset() addsimps split_ifs
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4598
diff changeset
   196
	        addsimps [analz_insert_eq, analz_insert_freshK])));
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   197
(*Oops*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   198
by (blast_tac (claset() addDs [unique_session_keys]) 3);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   199
(*YM3*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   200
by (blast_tac (claset() delrules [impCE]) 2);
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   201
(*Fake*) 
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   202
by (spy_analz_tac 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   203
val lemma = result() RS mp RS mp RSN(2,rev_notE);
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   204
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   205
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   206
(*Final version*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   207
Goal "[| Says Server A                                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   208
\           {|nb, Crypt (shrK A) {|Agent B, Key K, na|},  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   209
\                 Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|}    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   210
\        : set evs;                                       \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   211
\        Notes Spy {|na, nb, Key K|} ~: set evs;          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   212
\        A ~: bad;  B ~: bad;  evs : yahalom |]           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   213
\     ==> Key K ~: analz (spies evs)";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   214
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   215
by (blast_tac (claset() addSEs [lemma]) 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   216
qed "Spy_not_see_encrypted_key";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   217
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   218
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   219
(** Security Guarantee for A upon receiving YM3 **)
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   220
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   221
(*If the encrypted message appears then it originated with the Server.
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   222
  May now apply Spy_not_see_encrypted_key, subject to its conditions.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   223
Goal "[| Crypt (shrK A) {|Agent B, Key K, na|}                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   224
\         : parts (spies evs);                                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   225
\        A ~: bad;  evs : yahalom |]                                \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   226
\      ==> EX nb. Says Server A                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   227
\                   {|nb, Crypt (shrK A) {|Agent B, Key K, na|},    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   228
\                         Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   229
\                 : set evs";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   230
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   231
by (parts_induct_tac 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   232
by (ALLGOALS Blast_tac);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   233
qed "A_trusts_YM3";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   234
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   235
(*The obvious combination of A_trusts_YM3 with Spy_not_see_encrypted_key*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   236
Goal "[| Crypt (shrK A) {|Agent B, Key K, na|} : parts (spies evs); \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   237
\        ALL nb. Notes Spy {|na, nb, Key K|} ~: set evs;            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   238
\        A ~: bad;  B ~: bad;  evs : yahalom |]                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   239
\     ==> Key K ~: analz (spies evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   240
by (blast_tac (claset() addSDs [A_trusts_YM3, Spy_not_see_encrypted_key]) 1);
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   241
qed "A_gets_good_key";
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   242
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   243
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   244
(** Security Guarantee for B upon receiving YM4 **)
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   245
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   246
(*B knows, by the first part of A's message, that the Server distributed 
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   247
  the key for A and B, and has associated it with NB.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   248
Goal "[| Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   249
\          : parts (spies evs);                               \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   250
\        B ~: bad;  evs : yahalom |]                          \
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   251
\ ==> EX NA. Says Server A                                       \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   252
\            {|Nonce NB,                                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   253
\              Crypt (shrK A) {|Agent B, Key K, Nonce NA|},   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   254
\              Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   255
\            : set evs";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   256
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   257
by (parts_induct_tac 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   258
by (ALLGOALS Blast_tac);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   259
qed "B_trusts_YM4_shrK";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   260
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   261
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   262
(*With this protocol variant, we don't need the 2nd part of YM4 at all:
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   263
  Nonce NB is available in the first part.*)
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   264
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   265
(*What can B deduce from receipt of YM4?  Stronger and simpler than Yahalom
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   266
  because we do not have to show that NB is secret. *)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   267
Goal "[| Says A' B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   268
\                    X|}                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   269
\          : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   270
\        A ~: bad;  B ~: bad;  evs : yahalom |]                  \
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   271
\ ==> EX NA. Says Server A                                          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   272
\            {|Nonce NB,                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   273
\              Crypt (shrK A) {|Agent B, Key K, Nonce NA|},      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   274
\              Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   275
\           : set evs";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   276
by (blast_tac (claset() addSDs [B_trusts_YM4_shrK]) 1);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   277
qed "B_trusts_YM4";
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   278
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   279
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   280
(*The obvious combination of B_trusts_YM4 with Spy_not_see_encrypted_key*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   281
Goal "[| Says A' B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   282
\                    X|}                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   283
\          : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   284
\        ALL na. Notes Spy {|na, Nonce NB, Key K|} ~: set evs;   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   285
\        A ~: bad;  B ~: bad;  evs : yahalom |]                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   286
\     ==> Key K ~: analz (spies evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   287
by (blast_tac (claset() addSDs [B_trusts_YM4, Spy_not_see_encrypted_key]) 1);
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   288
qed "B_gets_good_key";
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   289
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   290
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   291
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   292
(*** Authenticating B to A ***)
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   293
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   294
(*The encryption in message YM2 tells us it cannot be faked.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   295
Goal "[| Crypt (shrK B) {|Agent A, Nonce NA|} : parts (spies evs);  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   296
\        B ~: bad;  evs : yahalom                                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   297
\     |] ==> EX NB. Says B Server {|Agent B, Nonce NB,              \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   298
\                            Crypt (shrK B) {|Agent A, Nonce NA|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   299
\                     : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   300
by (etac rev_mp 1);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   301
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   302
by (parts_induct_tac 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   303
by (ALLGOALS Blast_tac);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   304
qed "B_Said_YM2";
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   305
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   306
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   307
(*If the server sends YM3 then B sent YM2, perhaps with a different NB*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   308
Goal "[| Says Server A                                              \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   309
\            {|nb, Crypt (shrK A) {|Agent B, Key K, Nonce NA|}, X|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   310
\          : set evs;                                               \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   311
\        B ~: bad;  evs : yahalom                                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   312
\     |] ==> EX nb'. Says B Server {|Agent B, nb',                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   313
\                            Crypt (shrK B) {|Agent A, Nonce NA|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   314
\                      : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   315
by (etac rev_mp 1);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   316
by (etac rev_mp 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   317
by (etac yahalom.induct 1);
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   318
by (ALLGOALS Asm_simp_tac);
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   319
(*YM3*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   320
by (blast_tac (claset() addSDs [B_Said_YM2]) 3);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   321
(*Fake, YM2*)
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   322
by (ALLGOALS Blast_tac);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   323
val lemma = result();
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   324
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   325
(*If A receives YM3 then B has used nonce NA (and therefore is alive)*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   326
Goal "[| Says S A {|nb, Crypt (shrK A) {|Agent B, Key K, Nonce NA|}, X|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   327
\          : set evs;                                                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   328
\        A ~: bad;  B ~: bad;  evs : yahalom |]                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   329
\==> EX nb'. Says B Server                                               \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   330
\                 {|Agent B, nb', Crypt (shrK B) {|Agent A, Nonce NA|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   331
\              : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   332
by (blast_tac (claset() addSDs [A_trusts_YM3, lemma]) 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   333
qed "YM3_auth_B_to_A";
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   334
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   335
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   336
(*** Authenticating A to B using the certificate Crypt K (Nonce NB) ***)
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   337
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   338
(*Assuming the session key is secure, if both certificates are present then
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   339
  A has said NB.  We can't be sure about the rest of A's message, but only
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   340
  NB matters for freshness.  Note that  Key K ~: analz (spies evs)  must be
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   341
  the FIRST antecedent of the induction formula.*)  
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   342
Goal "evs : yahalom                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   343
\     ==> Key K ~: analz (spies evs) -->                \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   344
\         Crypt K (Nonce NB) : parts (spies evs) -->    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   345
\         Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   346
\           : parts (spies evs) -->                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   347
\         B ~: bad -->                                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   348
\         (EX X. Says A B {|X, Crypt K (Nonce NB)|} : set evs)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   349
by (parts_induct_tac 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   350
(*Fake*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   351
by (Blast_tac 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   352
(*YM3: by new_keys_not_used we note that Crypt K (Nonce NB) could not exist*)
4238
679a233fb206 Crypt_imp_keysFor: version of Crypt_imp_invKey_keysFor for shared keys
paulson
parents: 4199
diff changeset
   353
by (fast_tac (claset() addSDs [Crypt_imp_keysFor] addss (simpset())) 1); 
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   354
(*YM4: was Crypt K (Nonce NB) the very last message?  If not, use ind. hyp.*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   355
by (asm_simp_tac (simpset() addsimps [ex_disj_distrib]) 1);
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   356
(*yes: apply unicity of session keys*)
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   357
by (not_bad_tac "Aa" 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   358
by (blast_tac (claset() addSDs [A_trusts_YM3, B_trusts_YM4_shrK]
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   359
			addDs  [unique_session_keys]) 1);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   360
qed_spec_mp "Auth_A_to_B_lemma";
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   361
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   362
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   363
(*If B receives YM4 then A has used nonce NB (and therefore is alive).
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   364
  Moreover, A associates K with NB (thus is talking about the same run).
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   365
  Other premises guarantee secrecy of K.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   366
Goal "[| Says A' B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   367
\                    Crypt K (Nonce NB)|} : set evs;                 \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   368
\        (ALL NA. Notes Spy {|Nonce NA, Nonce NB, Key K|} ~: set evs); \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   369
\        A ~: bad;  B ~: bad;  evs : yahalom |]                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   370
\     ==> EX X. Says A B {|X, Crypt K (Nonce NB)|} : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   371
by (subgoal_tac "Key K ~: analz (spies evs)" 1);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   372
by (blast_tac (claset() addIs [Auth_A_to_B_lemma]) 1);
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   373
by (blast_tac (claset() addDs  [Spy_not_see_encrypted_key,
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   374
				B_trusts_YM4_shrK]) 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   375
qed_spec_mp "YM4_imp_A_Said_YM3";