src/HOL/Auth/Yahalom2.ML
author nipkow
Tue, 09 Jan 2001 15:29:17 +0100
changeset 10833 c0844a30ea4e
parent 7499 23e090051cb8
child 11104 f2024fed9f0c
permissions -rw-r--r--
`` -> ` and ``` -> ``
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
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    15
AddEs knows_Spy_partsEs;
5066
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));
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    24
by (rtac (yahalom.Nil RS 
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    25
          yahalom.YM1 RS yahalom.Reception RS
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    26
          yahalom.YM2 RS yahalom.Reception RS 
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    27
          yahalom.YM3 RS yahalom.Reception RS yahalom.YM4) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    28
by possibility_tac;
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    29
result();
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    30
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    31
Goal "[| Gets B X : set evs; evs : yahalom |] ==> EX A. Says A B X : set evs";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    32
by (etac rev_mp 1);
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    33
by (etac yahalom.induct 1);
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    34
by Auto_tac;
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    35
qed "Gets_imp_Says";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    36
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    37
(*Must be proved separately for each protocol*)
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    38
Goal "[| Gets B X : set evs; evs : yahalom |]  ==> X : knows Spy evs";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    39
by (blast_tac (claset() addSDs [Gets_imp_Says, Says_imp_knows_Spy]) 1);
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    40
qed"Gets_imp_knows_Spy";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    41
AddDs [Gets_imp_knows_Spy RS parts.Inj];
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    42
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    43
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    44
(**** Inductive proofs about yahalom ****)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    45
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    46
(** 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
    47
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    48
(*Lets us treat YM4 using a similar argument as for the Fake case.*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    49
Goal "[| Gets A {|NB, Crypt (shrK A) Y, X|} : set evs;  evs : yahalom |]  \
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    50
\     ==> X : analz (knows Spy evs)";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    51
by (blast_tac (claset() addSDs [Gets_imp_knows_Spy RS analz.Inj]) 1);
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    52
qed "YM4_analz_knows_Spy";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    53
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    54
bind_thm ("YM4_parts_knows_Spy",
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    55
          YM4_analz_knows_Spy RS (impOfSubs analz_subset_parts));
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    56
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    57
(*For Oops*)
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    58
Goal "Says Server A {|NB, Crypt (shrK A) {|B,K,NA|}, X|} : set evs \
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    59
\     ==> K : parts (knows Spy evs)";
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    60
by (blast_tac (claset() addSEs partsEs
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    61
                        addSDs [Says_imp_knows_Spy RS parts.Inj]) 1);
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    62
qed "YM4_Key_parts_knows_Spy";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    63
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    64
(*For proving the easier theorems about X ~: parts (knows Spy evs).*)
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    65
fun parts_knows_Spy_tac i = 
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    66
  EVERY
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6335
diff changeset
    67
   [ftac YM4_Key_parts_knows_Spy (i+7),
23e090051cb8 isatool expandshort;
wenzelm
parents: 6335
diff changeset
    68
    ftac YM4_parts_knows_Spy (i+6), assume_tac (i+6),
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    69
    prove_simple_subgoals_tac i];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    70
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    71
(*Induction for regularity theorems.  If induction formula has the form
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    72
   X ~: analz (knows Spy evs) --> ... then it shortens the proof by discarding
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    73
   needless information about analz (insert X (knows Spy evs))  *)
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    74
fun parts_induct_tac i = 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    75
    etac yahalom.induct i
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    76
    THEN 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    77
    REPEAT (FIRSTGOAL analz_mono_contra_tac)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    78
    THEN  parts_knows_Spy_tac i;
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
    79
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    80
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    81
(** Theorems of the form X ~: parts (knows Spy evs) imply that NOBODY
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    82
    sends messages containing X! **)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    83
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
    84
(*Spy never sees another agent's shared key! (unless it's bad at start)*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    85
Goal "evs : yahalom ==> (Key (shrK A) : parts (knows Spy evs)) = (A : bad)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    86
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
    87
by (ALLGOALS Blast_tac);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    88
qed "Spy_see_shrK";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    89
Addsimps [Spy_see_shrK];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    90
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
    91
Goal "evs : yahalom ==> (Key (shrK A) : analz (knows Spy 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
    92
by Auto_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    93
qed "Spy_analz_shrK";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    94
Addsimps [Spy_analz_shrK];
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    95
4471
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    96
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
    97
	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
    98
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    99
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   100
(*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
   101
Goal "evs : yahalom ==>          \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   102
\      Key K ~: used evs --> K ~: keysFor (parts (knows Spy evs))";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   103
by (parts_induct_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   104
(*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
   105
by (Blast_tac 3);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   106
(*YM3*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   107
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
   108
(*Fake*)
4509
828148415197 Making proofs faster, especially using keysFor_parts_insert
paulson
parents: 4477
diff changeset
   109
by (blast_tac (claset() addSDs [keysFor_parts_insert]) 1);
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2155
diff changeset
   110
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
   111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   112
bind_thm ("new_keys_not_analzd",
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   113
          [analz_subset_parts RS keysFor_mono,
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   114
           new_keys_not_used] MRS contra_subsetD);
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   115
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   116
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
   117
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   118
(*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
   119
  Oops as well as main secrecy property.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   120
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
   121
\         : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   122
\        evs : yahalom |]                                       \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   123
\     ==> K ~: range shrK";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   124
by (etac rev_mp 1);
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   125
by (etac yahalom.induct 1);
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   126
by (ALLGOALS Asm_simp_tac);
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   127
qed "Says_Server_message_form";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   128
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   129
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   130
(*For proofs involving analz.*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   131
val analz_knows_Spy_tac = 
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   132
    dtac YM4_analz_knows_Spy 7 THEN assume_tac 7 THEN
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6335
diff changeset
   133
    ftac Says_Server_message_form 8 THEN
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   134
    assume_tac 8 THEN
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   135
    REPEAT ((etac conjE ORELSE' hyp_subst_tac) 8);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   136
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   137
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   138
(****
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   139
 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
   140
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   141
          Key K : analz (insert (Key KAB) (knows Spy evs)) ==>
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   142
          Key K : analz (knows Spy evs)
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   143
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   144
 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
   145
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   146
****)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   147
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   148
(** 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
   149
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   150
Goal "evs : yahalom ==>                               \
5492
d9fc3457554e From Compl(A) to -A
paulson
parents: 5434
diff changeset
   151
\  ALL K KK. KK <= - (range shrK) -->                 \
10833
c0844a30ea4e `` -> ` and ``` -> ``
nipkow
parents: 7499
diff changeset
   152
\         (Key K : analz (Key`KK Un (knows Spy evs))) =  \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   153
\         (K : KK | Key K : analz (knows Spy evs))";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   154
by (etac yahalom.induct 1);
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   155
by analz_knows_Spy_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   156
by (REPEAT_FIRST (resolve_tac [allI, impI]));
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   157
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
   158
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
   159
(*Fake*) 
4422
21238c9d363e Simplified proofs using rewrites for f``A where f is injective
paulson
parents: 4238
diff changeset
   160
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   161
qed_spec_mp "analz_image_freshK";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   162
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   163
Goal "[| evs : yahalom;  KAB ~: range shrK |] ==>     \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   164
\     Key K : analz (insert (Key KAB) (knows Spy evs)) =  \
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   165
\     (K = KAB | Key K : analz (knows Spy evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   166
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
   167
qed "analz_insert_freshK";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   168
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   169
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   170
(*** 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
   171
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   172
Goal "evs : yahalom ==>                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   173
\   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
   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|}   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   176
\       : 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
   177
by (etac yahalom.induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   178
by (ALLGOALS (asm_simp_tac (simpset() addsimps [all_conj_distrib])));
3730
6933d20f335f Step_tac -> Safe_tac
paulson
parents: 3683
diff changeset
   179
by (Clarify_tac 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   180
(*Remaining case: YM3*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   181
by (expand_case_tac "K = ?y" 1);
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   182
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
   183
(*...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
   184
by (blast_tac (claset() delrules [conjI]    (*prevent splitup into 4 subgoals*)
4199
2b9fc1f08886 Fixed indentation
paulson
parents: 4153
diff changeset
   185
                        addss (simpset() addsimps [parts_insertI])) 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   186
val lemma = result();
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   187
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   188
Goal "[| Says Server A                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   189
\         {|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
   190
\       Says Server A'                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   191
\         {|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
   192
\       evs : yahalom |]                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   193
\    ==> A=A' & B=B' & na=na' & nb=nb'";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   194
by (prove_unique_tac lemma 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   195
qed "unique_session_keys";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   196
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   197
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   198
(** 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
   199
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   200
Goal "[| A ~: bad;  B ~: bad;  evs : yahalom |]              \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   201
\     ==> Says Server A                                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   202
\           {|nb, Crypt (shrK A) {|Agent B, Key K, na|},     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   203
\                 Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   204
\          : set evs -->                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   205
\         Notes Spy {|na, nb, Key K|} ~: set evs -->         \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   206
\         Key K ~: analz (knows Spy evs)";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   207
by (etac yahalom.induct 1);
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   208
by analz_knows_Spy_tac;
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   209
by (ALLGOALS
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   210
    (asm_simp_tac 
4831
dae4d63a1318 Renamed expand_const -> split_const.
nipkow
parents: 4686
diff changeset
   211
     (simpset() addsimps split_ifs
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4598
diff changeset
   212
	        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
   213
(*Oops*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   214
by (blast_tac (claset() addDs [unique_session_keys]) 3);
5932
paulson
parents: 5492
diff changeset
   215
(*YM3: delete a useless induction hypothesis*)
paulson
parents: 5492
diff changeset
   216
by (thin_tac "?P-->?Q" 2);
paulson
parents: 5492
diff changeset
   217
by (Blast_tac 2);
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   218
(*Fake*) 
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   219
by (spy_analz_tac 1);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   220
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
   221
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   222
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   223
(*Final version*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   224
Goal "[| Says Server A                                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   225
\           {|nb, Crypt (shrK A) {|Agent B, Key K, na|},  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   226
\                 Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|}    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   227
\        : set evs;                                       \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   228
\        Notes Spy {|na, nb, Key K|} ~: set evs;          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   229
\        A ~: bad;  B ~: bad;  evs : yahalom |]           \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   230
\     ==> Key K ~: analz (knows Spy evs)";
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6335
diff changeset
   231
by (ftac Says_Server_message_form 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   232
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
   233
qed "Spy_not_see_encrypted_key";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   234
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   235
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   236
(** Security Guarantee for A upon receiving YM3 **)
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   237
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   238
(*If the encrypted message appears then it originated with the Server.
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   239
  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
   240
Goal "[| Crypt (shrK A) {|Agent B, Key K, na|}                      \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   241
\         : parts (knows Spy evs);                                      \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   242
\        A ~: bad;  evs : yahalom |]                                \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   243
\      ==> EX nb. Says Server A                                     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   244
\                   {|nb, Crypt (shrK A) {|Agent B, Key K, na|},    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   245
\                         Crypt (shrK B) {|Agent A, Agent B, Key K, nb|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   246
\                 : set evs";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   247
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   248
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
   249
by (ALLGOALS Blast_tac);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   250
qed "A_trusts_YM3";
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   251
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   252
(*The obvious combination of A_trusts_YM3 with Spy_not_see_encrypted_key*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   253
Goal "[| Crypt (shrK A) {|Agent B, Key K, na|} : parts (knows Spy evs); \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   254
\        ALL nb. Notes Spy {|na, nb, Key K|} ~: set evs;            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   255
\        A ~: bad;  B ~: bad;  evs : yahalom |]                     \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   256
\     ==> Key K ~: analz (knows Spy evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   257
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
   258
qed "A_gets_good_key";
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   259
2111
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
(** 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
   262
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   263
(*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
   264
  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
   265
Goal "[| Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|} \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   266
\          : parts (knows Spy evs);                               \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   267
\        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
   268
\ ==> EX NA. Says Server A                                       \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   269
\            {|Nonce NB,                                      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   270
\              Crypt (shrK A) {|Agent B, Key K, Nonce NA|},   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   271
\              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
   272
\            : set evs";
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   273
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   274
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
   275
by (ALLGOALS Blast_tac);
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   276
qed "B_trusts_YM4_shrK";
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
   277
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   278
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   279
(*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
   280
  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
   281
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
   282
(*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
   283
  because we do not have to show that NB is secret. *)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   284
Goal "[| Gets B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   285
\                    X|}                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   286
\          : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   287
\        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
   288
\ ==> EX NA. Says Server A                                          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   289
\            {|Nonce NB,                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   290
\              Crypt (shrK A) {|Agent B, Key K, Nonce NA|},      \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   291
\              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
   292
\           : set evs";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   293
by (blast_tac (claset() addSDs [B_trusts_YM4_shrK]) 1);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   294
qed "B_trusts_YM4";
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   295
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   296
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   297
(*The obvious combination of B_trusts_YM4 with Spy_not_see_encrypted_key*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   298
Goal "[| Gets B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   299
\                    X|}                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   300
\          : set evs;                                            \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   301
\        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
   302
\        A ~: bad;  B ~: bad;  evs : yahalom |]                  \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   303
\     ==> Key K ~: analz (knows Spy evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   304
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
   305
qed "B_gets_good_key";
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   306
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   307
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   308
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   309
(*** Authenticating B to A ***)
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   310
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   311
(*The encryption in message YM2 tells us it cannot be faked.*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   312
Goal "[| Crypt (shrK B) {|Agent A, Nonce NA|} : parts (knows Spy evs);  \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   313
\        B ~: bad;  evs : yahalom                                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   314
\     |] ==> EX NB. Says B Server {|Agent B, Nonce NB,              \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   315
\                            Crypt (shrK B) {|Agent A, Nonce NA|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   316
\                     : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   317
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
   318
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   319
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
   320
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
   321
qed "B_Said_YM2";
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   322
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   323
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   324
(*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
   325
Goal "[| Says Server A                                              \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   326
\            {|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
\        B ~: bad;  evs : yahalom                                   \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   329
\     |] ==> EX nb'. Says B Server {|Agent B, nb',                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   330
\                            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 (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
   333
by (etac rev_mp 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   334
by (etac yahalom.induct 1);
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   335
by (ALLGOALS Asm_simp_tac);
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   336
(*YM3*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   337
by (blast_tac (claset() addSDs [B_Said_YM2]) 3);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   338
(*Fake, YM2*)
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   339
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
   340
val lemma = result();
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   341
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   342
(*If A receives YM3 then B has used nonce NA (and therefore is alive)*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   343
Goal "[| Gets A {|nb, Crypt (shrK A) {|Agent B, Key K, Nonce NA|}, X|}   \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   344
\          : set evs;                                                    \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   345
\        A ~: bad;  B ~: bad;  evs : yahalom |]                          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   346
\==> EX nb'. Says B Server                                               \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   347
\                 {|Agent B, nb', Crypt (shrK B) {|Agent A, Nonce NA|}|} \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   348
\              : set evs";
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   349
by (blast_tac (claset() addSDs [A_trusts_YM3, lemma]) 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   350
qed "YM3_auth_B_to_A";
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   351
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   352
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   353
(*** 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
   354
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   355
(*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
   356
  A has said NB.  We can't be sure about the rest of A's message, but only
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   357
  NB matters for freshness.  Note that  Key K ~: analz (knows Spy evs)  must be
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   358
  the FIRST antecedent of the induction formula.*)  
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   359
Goal "evs : yahalom                                     \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   360
\     ==> Key K ~: analz (knows Spy evs) -->                \
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   361
\         Crypt K (Nonce NB) : parts (knows Spy evs) -->    \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   362
\         Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}      \
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   363
\           : parts (knows Spy evs) -->                     \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   364
\         B ~: bad -->                                  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   365
\         (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
   366
by (parts_induct_tac 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   367
(*Fake*)
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   368
by (Blast_tac 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   369
(*YM3: by new_keys_not_used we note that Crypt K (Nonce NB) could not exist*)
5932
paulson
parents: 5492
diff changeset
   370
by (force_tac (claset() addSDs [Crypt_imp_keysFor], simpset()) 1); 
3450
cd73bc206d87 Proof tidying and variable renaming (NA->na, NB->nb when of type msg)
paulson
parents: 3432
diff changeset
   371
(*YM4: was Crypt K (Nonce NB) the very last message?  If not, use ind. hyp.*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   372
by (asm_simp_tac (simpset() addsimps [ex_disj_distrib]) 1);
5932
paulson
parents: 5492
diff changeset
   373
(*yes: delete a useless induction hypothesis; apply unicity of session keys*)
paulson
parents: 5492
diff changeset
   374
by (thin_tac "?P-->?Q" 1);
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6335
diff changeset
   375
by (ftac Gets_imp_Says 1 THEN assume_tac 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3682
diff changeset
   376
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
   377
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
   378
			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
   379
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
   380
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   381
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   382
(*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
   383
  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
   384
  Other premises guarantee secrecy of K.*)
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   385
Goal "[| Gets B {|Crypt (shrK B) {|Agent A, Agent B, Key K, Nonce NB|}, \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   386
\                    Crypt K (Nonce NB)|} : set evs;                 \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   387
\        (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
   388
\        A ~: bad;  B ~: bad;  evs : yahalom |]                    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   389
\     ==> EX X. Says A B {|X, Crypt K (Nonce NB)|} : set evs";
6335
7e4bffaa2a3e updating both Yahalom protocols to the Gets model
paulson
parents: 5932
diff changeset
   390
by (subgoal_tac "Key K ~: analz (knows Spy evs)" 1);
5066
30271d90644f Changed format of Bob's certificate from Nb,K,A to A,B,K,Nb.
paulson
parents: 4831
diff changeset
   391
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
   392
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
   393
				B_trusts_YM4_shrK]) 1);
3432
04412cfe6861 Strengthened and streamlined the Yahalom proofs
paulson
parents: 3121
diff changeset
   394
qed_spec_mp "YM4_imp_A_Said_YM3";