src/HOL/Auth/OtwayRees_AN.ML
author paulson
Thu, 29 Mar 2001 10:44:37 +0200
changeset 11230 756c5034f08b
parent 11204 bb01189f0565
permissions -rw-r--r--
misc tidying; changing the predicate isSymKey to the set symKeys
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
     1
(*  Title:      HOL/Auth/OtwayRees_AN
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     2
    ID:         $Id$
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     5
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     6
Inductive relation "otway" for the Otway-Rees protocol.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     7
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
     8
Abadi-Needham version: minimal encryption, explicit messages
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     9
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    10
From page 11 of
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    11
  Abadi and Needham.  Prudent Engineering Practice for Cryptographic Protocols.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    12
  IEEE Trans. SE 22 (1), 1996
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    13
*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    14
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11104
diff changeset
    15
AddDs  [Says_imp_knows_Spy RS parts.Inj, parts.Body];
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11104
diff changeset
    16
AddDs  [impOfSubs analz_subset_parts, impOfSubs Fake_parts_insert];
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
    17
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    18
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
    19
(*A "possibility property": there are traces that reach the end*)
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
    20
Goal "B \\<noteq> Server   \
11230
756c5034f08b misc tidying; changing the predicate isSymKey to the set symKeys
paulson
parents: 11204
diff changeset
    21
\     ==> \\<exists>K. \\<exists>evs \\<in> otway.                                      \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    22
\          Says B A (Crypt (shrK A) {|Nonce NA, Agent A, Agent B, Key K|}) \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    23
\            \\<in> set evs";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    24
by (REPEAT (resolve_tac [exI,bexI] 1));
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    25
by (rtac (otway.Nil RS 
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    26
          otway.OR1 RS otway.Reception RS
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    27
          otway.OR2 RS otway.Reception RS 
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    28
          otway.OR3 RS otway.Reception RS otway.OR4) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
    29
by possibility_tac;
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    30
result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    31
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    32
Goal "[| Gets B X \\<in> set evs; evs \\<in> otway |] ==> \\<exists>A. Says A B X \\<in> set evs";
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    33
by (etac rev_mp 1);
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    34
by (etac otway.induct 1);
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    35
by Auto_tac;
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    36
qed"Gets_imp_Says";
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    37
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    38
(*Must be proved separately for each protocol*)
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    39
Goal "[| Gets B X \\<in> set evs; evs \\<in> otway |]  ==> X \\<in> knows Spy evs";
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    40
by (blast_tac (claset() addSDs [Gets_imp_Says, Says_imp_knows_Spy]) 1);
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    41
qed"Gets_imp_knows_Spy";
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    42
AddDs [Gets_imp_knows_Spy RS parts.Inj];
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    43
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    44
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    45
(**** Inductive proofs about otway ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    46
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    47
(** For reasoning about the encrypted portion of messages **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    48
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    49
Goal "[| Gets B {|X, Crypt(shrK B) X'|} \\<in> set evs;  evs \\<in> otway |]  \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    50
\     ==> X \\<in> analz (knows Spy evs)";
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    51
by (blast_tac (claset() addSDs [Gets_imp_knows_Spy RS analz.Inj]) 1);
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    52
qed "OR4_analz_knows_Spy";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    53
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    54
Goal "Says Server B {|X, Crypt K' {|NB, a, Agent B, K|}|} \\<in> set evs \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    55
\     ==> K \\<in> parts (knows Spy evs)";
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
    56
by (Blast_tac 1);
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    57
qed "Oops_parts_knows_Spy";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    58
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    59
bind_thm ("OR4_parts_knows_Spy",
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
    60
          OR4_analz_knows_Spy RS (impOfSubs analz_subset_parts));
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    61
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    62
(*For proving the easier theorems about X \\<notin> parts (knows Spy evs).*)
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    63
fun parts_induct_tac i = 
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    64
    etac otway.induct i			THEN 
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6915
diff changeset
    65
    ftac Oops_parts_knows_Spy (i+7) THEN
23e090051cb8 isatool expandshort;
wenzelm
parents: 6915
diff changeset
    66
    ftac OR4_parts_knows_Spy (i+6) THEN
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    67
    prove_simple_subgoals_tac  i;
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    68
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    69
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    70
(** Theorems of the form X \\<notin> parts (knows Spy evs) imply that NOBODY
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    71
    sends messages containing X! **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    72
4537
4e835bd9fada Expressed most Oops rules using Notes instead of Says, and other tidying
paulson
parents: 4509
diff changeset
    73
(*Spy never sees a good agent's shared key!*)
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    74
Goal "evs \\<in> otway ==> (Key (shrK A) \\<in> parts (knows Spy evs)) = (A \\<in> bad)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
    75
by (parts_induct_tac 1);
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
    76
by (ALLGOALS Blast_tac);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    77
qed "Spy_see_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    78
Addsimps [Spy_see_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    79
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    80
Goal "evs \\<in> otway ==> (Key (shrK A) \\<in> analz (knows Spy evs)) = (A \\<in> bad)";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    81
by (auto_tac(claset() addDs [impOfSubs analz_subset_parts], simpset()));
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    82
qed "Spy_analz_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    83
Addsimps [Spy_analz_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    84
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
    85
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
    86
	Spy_analz_shrK RSN (2, rev_iffD1)];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    87
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    88
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    89
(*** Proofs involving analz ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    90
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    91
(*Describes the form of K and NA when the Server sends this message.*)
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    92
Goal "[| Says Server B                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    93
\           {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
    94
\             Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}   \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    95
\          \\<in> set evs;                                            \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    96
\        evs \\<in> otway |]                                          \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
    97
\     ==> K \\<notin> range shrK & (\\<exists>i. NA = Nonce i) & (\\<exists>j. NB = Nonce j)";
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    98
by (etac rev_mp 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    99
by (etac otway.induct 1);
3102
4d01cdc119d2 Some blast_tac calls; more needed
paulson
parents: 2891
diff changeset
   100
by (ALLGOALS Asm_simp_tac);
4d01cdc119d2 Some blast_tac calls; more needed
paulson
parents: 2891
diff changeset
   101
by (Blast_tac 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   102
qed "Says_Server_message_form";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   103
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   104
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   105
(*For proofs involving analz.*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   106
val analz_knows_Spy_tac = 
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   107
    dtac OR4_analz_knows_Spy 7 THEN assume_tac 7 THEN
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6915
diff changeset
   108
    ftac Says_Server_message_form 8 THEN assume_tac 8 THEN
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   109
    REPEAT ((eresolve_tac [exE, conjE] ORELSE' hyp_subst_tac) 8);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   110
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   111
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   112
(****
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   113
 The following is to prove theorems of the form
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   114
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   115
  Key K \\<in> analz (insert (Key KAB) (knows Spy evs)) ==>
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   116
  Key K \\<in> analz (knows Spy evs)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   117
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   118
 A more general formula must be proved inductively.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   119
****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   120
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   121
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   122
(** Session keys are not used to encrypt other session keys **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   123
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   124
(*The equality makes the induction hypothesis easier to apply*)
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   125
Goal "evs \\<in> otway ==>                                 \
5492
d9fc3457554e From Compl(A) to -A
paulson
parents: 5434
diff changeset
   126
\  ALL K KK. KK <= -(range shrK) -->                  \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   127
\         (Key K \\<in> analz (Key`KK Un (knows Spy evs))) =  \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   128
\         (K \\<in> KK | Key K \\<in> analz (knows Spy evs))";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   129
by (etac otway.induct 1);
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   130
by analz_knows_Spy_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   131
by (REPEAT_FIRST (resolve_tac [allI, impI]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   132
by (REPEAT_FIRST (rtac analz_image_freshK_lemma ));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   133
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   134
(*Fake*) 
4422
21238c9d363e Simplified proofs using rewrites for f``A where f is injective
paulson
parents: 4155
diff changeset
   135
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   136
qed_spec_mp "analz_image_freshK";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   137
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   138
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   139
Goal "[| evs \\<in> otway;  KAB \\<notin> range shrK |] ==>       \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   140
\     Key K \\<in> analz (insert (Key KAB) (knows Spy evs)) =  \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   141
\     (K = KAB | Key K \\<in> analz (knows Spy evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   142
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: 2454
diff changeset
   143
qed "analz_insert_freshK";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   144
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   145
4155
53f60f51333c fixed comment
paulson
parents: 4091
diff changeset
   146
(*** The Key K uniquely identifies the Server's message. **)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   147
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   148
Goal "[| Says Server B                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   149
\         {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   150
\           Crypt (shrK B) {|NB, Agent A, Agent B, K|}|}        \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   151
\        \\<in> set evs;                                             \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   152
\       Says Server B'                                          \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   153
\         {|Crypt (shrK A') {|NA', Agent A', Agent B', K|},     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   154
\           Crypt (shrK B') {|NB', Agent A', Agent B', K|}|}    \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   155
\        \\<in> set evs;                                             \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   156
\       evs \\<in> otway |]                                          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   157
\    ==> A=A' & B=B' & NA=NA' & NB=NB'";
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   158
by (etac rev_mp 1);
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   159
by (etac rev_mp 1);
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   160
by (etac otway.induct 1);
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   161
by (ALLGOALS Asm_simp_tac);
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   162
(*Remaining cases: OR3 and OR4*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   163
by (REPEAT (Blast_tac 1)); 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   164
qed "unique_session_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   165
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   166
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   167
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   168
(**** Authenticity properties relating to NA ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   169
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   170
(*If the encrypted message appears then it originated with the Server!*)
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   171
Goal "[| A \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]                 \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   172
\     ==> Crypt (shrK A) {|NA, Agent A, Agent B, Key K|} \\<in> parts (knows Spy evs) \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   173
\      --> (\\<exists>NB. Says Server B                                          \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   174
\                   {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   175
\                     Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   176
\                   \\<in> set evs)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   177
by (parts_induct_tac 1);
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
   178
by (Blast_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   179
by (ALLGOALS (asm_simp_tac (simpset() addsimps [ex_disj_distrib])));
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   180
(*OR3*)
3102
4d01cdc119d2 Some blast_tac calls; more needed
paulson
parents: 2891
diff changeset
   181
by (Blast_tac 1);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   182
qed_spec_mp "NA_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   183
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   184
2454
92f43ed48935 Corrected comments
paulson
parents: 2451
diff changeset
   185
(*Corollary: if A receives B's OR4 message then it originated with the Server.
92f43ed48935 Corrected comments
paulson
parents: 2451
diff changeset
   186
  Freshness may be inferred from nonce NA.*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   187
Goal "[| Gets A (Crypt (shrK A) {|NA, Agent A, Agent B, Key K|})  \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   188
\         \\<in> set evs;                                                 \
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   189
\        A \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]                          \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   190
\     ==> \\<exists>NB. Says Server B                                       \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   191
\                 {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},  \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   192
\                   Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|} \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   193
\                \\<in> set evs";
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
   194
by (blast_tac (claset() addSIs [NA_Crypt_imp_Server_msg]) 1);
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   195
qed "A_trusts_OR4";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   196
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   197
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   198
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   199
    Does not in itself guarantee security: an attack could violate 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   200
    the premises, e.g. by having A=Spy **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   201
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   202
Goal "[| A \\<notin> bad;  B \\<notin> bad;  evs \\<in> otway |]                   \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   203
\     ==> Says Server B                                         \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   204
\          {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   205
\            Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}   \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   206
\         \\<in> set evs -->                                         \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   207
\         Notes Spy {|NA, NB, Key K|} \\<notin> set evs -->            \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   208
\         Key K \\<notin> analz (knows Spy evs)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   209
by (etac otway.induct 1);
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   210
by analz_knows_Spy_tac;
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   211
by (ALLGOALS
6915
4ab8e31a8421 Now if_weak_cong is a standard congruence rule
paulson
parents: 6308
diff changeset
   212
    (asm_simp_tac (simpset() addcongs [conj_cong] 
4509
828148415197 Making proofs faster, especially using keysFor_parts_insert
paulson
parents: 4477
diff changeset
   213
                             addsimps [analz_insert_eq, analz_insert_freshK]
5535
678999604ee9 deleted needless parentheses
paulson
parents: 5492
diff changeset
   214
                                      @ pushes @ split_ifs)));
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   215
(*Oops*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   216
by (blast_tac (claset() addSDs [unique_session_keys]) 4);
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   217
(*OR4*) 
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   218
by (Blast_tac 3);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   219
(*OR3*)
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
   220
by (Blast_tac 2);
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   221
(*Fake*) 
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   222
by (spy_analz_tac 1);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   223
val lemma = result() RS mp RS mp RSN(2,rev_notE);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   224
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   225
Goal "[| Says Server B                                           \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   226
\           {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},    \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   227
\             Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}   \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   228
\          \\<in> set evs;                                            \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   229
\        Notes Spy {|NA, NB, Key K|} \\<notin> set evs;                 \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   230
\        A \\<notin> bad;  B \\<notin> bad;  evs \\<in> otway |]                    \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   231
\     ==> Key K \\<notin> analz (knows Spy evs)";
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 6915
diff changeset
   232
by (ftac Says_Server_message_form 1 THEN assume_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   233
by (blast_tac (claset() addSEs [lemma]) 1);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   234
qed "Spy_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   235
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   236
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   237
(*A's guarantee.  The Oops premise quantifies over NB because A cannot know
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   238
  what it is.*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   239
Goal "[| Gets A (Crypt (shrK A) {|NA, Agent A, Agent B, Key K|})  \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   240
\         \\<in> set evs;                                                 \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   241
\        ALL NB. Notes Spy {|NA, NB, Key K|} \\<notin> set evs;             \
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   242
\        A \\<notin> bad;  B \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]               \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   243
\     ==> Key K \\<notin> analz (knows Spy evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   244
by (blast_tac (claset() addSDs [A_trusts_OR4, Spy_not_see_encrypted_key]) 1);
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   245
qed "A_gets_good_key";
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   246
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   247
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   248
(**** Authenticity properties relating to NB ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   249
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   250
(*If the encrypted message appears then it originated with the Server!*)
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   251
Goal "[| B \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]                              \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   252
\ ==> Crypt (shrK B) {|NB, Agent A, Agent B, Key K|} \\<in> parts (knows Spy evs) \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   253
\     --> (\\<exists>NA. Says Server B                                          \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   254
\                  {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   255
\                    Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   256
\                  \\<in> set evs)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   257
by (parts_induct_tac 1);
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
   258
by (Blast_tac 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   259
by (ALLGOALS (asm_simp_tac (simpset() addsimps [ex_disj_distrib])));
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   260
(*OR3*)
3102
4d01cdc119d2 Some blast_tac calls; more needed
paulson
parents: 2891
diff changeset
   261
by (Blast_tac 1);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   262
qed_spec_mp "NB_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   263
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   264
2454
92f43ed48935 Corrected comments
paulson
parents: 2451
diff changeset
   265
(*Guarantee for B: if it gets a well-formed certificate then the Server
92f43ed48935 Corrected comments
paulson
parents: 2451
diff changeset
   266
  has sent the correct message in round 3.*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   267
Goal "[| Gets B {|X, Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|} \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   268
\          \\<in> set evs;                                                    \
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   269
\        B \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]                              \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   270
\     ==> \\<exists>NA. Says Server B                                           \
5114
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   271
\                  {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
c729d4c299c1 Deleted leading parameters thanks to new Goal command
paulson
parents: 5076
diff changeset
   272
\                    Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   273
\                  \\<in> set evs";
4470
af3239def3d4 Tidied using more default rules
paulson
parents: 4449
diff changeset
   274
by (blast_tac (claset() addSIs [NB_Crypt_imp_Server_msg]) 1);
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   275
qed "B_trusts_OR3";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   276
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   277
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   278
(*The obvious combination of B_trusts_OR3 with Spy_not_see_encrypted_key*)
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5535
diff changeset
   279
Goal "[| Gets B {|X, Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|} \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   280
\         \\<in> set evs;                                                     \
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   281
\        ALL NA. Notes Spy {|NA, NB, Key K|} \\<notin> set evs;                 \
11204
bb01189f0565 minor tuning
paulson
parents: 11185
diff changeset
   282
\        A \\<notin> bad;  B \\<notin> bad;  A \\<noteq> B;  evs \\<in> otway |]                   \
11185
1b737b4c2108 Some X-symbols for <notin>, <noteq>, <forall>, <exists>
paulson
parents: 11150
diff changeset
   283
\     ==> Key K \\<notin> analz (knows Spy evs)";
4598
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   284
by (blast_tac (claset() addDs [B_trusts_OR3, Spy_not_see_encrypted_key]) 1);
649bf14debe7 Added some more explicit guarantees of key secrecy for agents
paulson
parents: 4537
diff changeset
   285
qed "B_gets_good_key";