src/HOL/Auth/OtwayRees.thy
author wenzelm
Sat, 04 Nov 2017 12:39:25 +0100
changeset 67001 b34fbf33a7ea
parent 63975 6728b5007ad0
child 67443 3abf6a722518
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37936
1e4c5015a72e updated some headers;
wenzelm
parents: 32960
diff changeset
     1
(*  Title:      HOL/Auth/OtwayRees.thy
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
     2
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
     3
    Copyright   1996  University of Cambridge
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     4
*)
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
     5
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
     6
section\<open>The Original Otway-Rees Protocol\<close>
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 14238
diff changeset
     8
theory OtwayRees imports Public begin
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
     9
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
    10
text\<open>From page 244 of
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    11
  Burrows, Abadi and Needham (1989).  A Logic of Authentication.
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    12
  Proc. Royal Soc. 426
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    13
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
    14
This is the original version, which encrypts Nonce NB.\<close>
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5434
diff changeset
    15
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 18570
diff changeset
    16
inductive_set otway :: "event list set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 18570
diff changeset
    17
  where
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    18
         (*Initial trace is empty*)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    19
   Nil:  "[] \<in> otway"
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    20
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2014
diff changeset
    21
         (*The spy MAY say anything he CAN say.  We do not expect him to
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    22
           invent new nonces here, but he can also use NS1.  Common to
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    23
           all similar protocols.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    24
 | Fake: "\<lbrakk>evsf \<in> otway;  X \<in> synth (analz (knows Spy evsf)) \<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    25
          \<Longrightarrow> Says Spy B X  # evsf \<in> otway"
6308
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5434
diff changeset
    26
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5434
diff changeset
    27
         (*A message that has been sent can be received by the
76f3865a2b1d Added Bella's "Gets" model for Otway_Rees. Also affects some other theories.
paulson
parents: 5434
diff changeset
    28
           intended recipient.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    29
 | Reception: "\<lbrakk>evsr \<in> otway;  Says A B X \<in>set evsr\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    30
               \<Longrightarrow> Gets B X # evsr \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    31
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    32
         (*Alice initiates a protocol run*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    33
 | OR1:  "\<lbrakk>evs1 \<in> otway;  Nonce NA \<notin> used evs1\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    34
          \<Longrightarrow> Says A B \<lbrace>Nonce NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    35
                         Crypt (shrK A) \<lbrace>Nonce NA, Agent A, Agent B\<rbrace> \<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    36
                 # evs1 \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    37
6333
b1dec44d0018 deleted obsolete comments
paulson
parents: 6308
diff changeset
    38
         (*Bob's response to Alice's message.  Note that NB is encrypted.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    39
 | OR2:  "\<lbrakk>evs2 \<in> otway;  Nonce NB \<notin> used evs2;
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    40
             Gets B \<lbrace>Nonce NA, Agent A, Agent B, X\<rbrace> : set evs2\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    41
          \<Longrightarrow> Says B Server
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    42
                  \<lbrace>Nonce NA, Agent A, Agent B, X,
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2378
diff changeset
    43
                    Crypt (shrK B)
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    44
                      \<lbrace>Nonce NA, Nonce NB, Agent A, Agent B\<rbrace>\<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    45
                 # evs2 \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    46
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    47
         (*The Server receives Bob's message and checks that the three NAs
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    48
           match.  Then he sends a new session key to Bob with a packet for
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    49
           forwarding to Alice.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    50
 | OR3:  "\<lbrakk>evs3 \<in> otway;  Key KAB \<notin> used evs3;
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    51
             Gets Server
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    52
                  \<lbrace>Nonce NA, Agent A, Agent B,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    53
                    Crypt (shrK A) \<lbrace>Nonce NA, Agent A, Agent B\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    54
                    Crypt (shrK B) \<lbrace>Nonce NA, Nonce NB, Agent A, Agent B\<rbrace>\<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    55
               : set evs3\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    56
          \<Longrightarrow> Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    57
                  \<lbrace>Nonce NA,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    58
                    Crypt (shrK A) \<lbrace>Nonce NA, Key KAB\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    59
                    Crypt (shrK B) \<lbrace>Nonce NB, Key KAB\<rbrace>\<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    60
                 # evs3 \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    61
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    62
         (*Bob receives the Server's (?) message and compares the Nonces with
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 23746
diff changeset
    63
           those in the message he previously sent the Server.
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    64
           Need B \<noteq> Server because we allow messages to self.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    65
 | OR4:  "\<lbrakk>evs4 \<in> otway;  B \<noteq> Server;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    66
             Says B Server \<lbrace>Nonce NA, Agent A, Agent B, X',
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2135
diff changeset
    67
                             Crypt (shrK B)
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    68
                                   \<lbrace>Nonce NA, Nonce NB, Agent A, Agent B\<rbrace>\<rbrace>
3659
eddedfe2f3f8 Renamed "evs" to "evs1", "evs2", etc. in protocol inductive definition
paulson
parents: 3519
diff changeset
    69
               : set evs4;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    70
             Gets B \<lbrace>Nonce NA, X, Crypt (shrK B) \<lbrace>Nonce NB, Key K\<rbrace>\<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    71
               : set evs4\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    72
          \<Longrightarrow> Says B A \<lbrace>Nonce NA, X\<rbrace> # evs4 \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    73
2135
80477862ab33 Minor corrections
paulson
parents: 2105
diff changeset
    74
         (*This message models possible leaks of session keys.  The nonces
80477862ab33 Minor corrections
paulson
parents: 2105
diff changeset
    75
           identify the protocol run.*)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    76
 | Oops: "\<lbrakk>evso \<in> otway;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    77
             Says Server B \<lbrace>Nonce NA, X, Crypt (shrK B) \<lbrace>Nonce NB, Key K\<rbrace>\<rbrace>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    78
               : set evso\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    79
          \<Longrightarrow> Notes Spy \<lbrace>Nonce NA, Nonce NB, Key K\<rbrace> # evso \<in> otway"
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
    80
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    81
18570
ffce25f9aa7f a few more named lemmas
paulson
parents: 17778
diff changeset
    82
declare Says_imp_analz_Spy [dest]
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    83
declare parts.Body  [dest]
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    84
declare analz_into_parts [dest]
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    85
declare Fake_parts_insert_in_Un  [dest]
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    86
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    87
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
    88
text\<open>A "possibility property": there are traces that reach the end\<close>
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    89
lemma "\<lbrakk>B \<noteq> Server; Key K \<notin> used []\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
    90
      \<Longrightarrow> \<exists>evs \<in> otway.
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
    91
             Says B A \<lbrace>Nonce NA, Crypt (shrK A) \<lbrace>Nonce NA, Key K\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    92
               \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    93
apply (intro exI bexI)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    94
apply (rule_tac [2] otway.Nil
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    95
                    [THEN otway.OR1, THEN otway.Reception,
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    96
                     THEN otway.OR2, THEN otway.Reception,
14200
d8598e24f8fa Removal of the Key_supply axiom (affects many possbility proofs) and minor
paulson
parents: 13907
diff changeset
    97
                     THEN otway.OR3, THEN otway.Reception, THEN otway.OR4]) 
d8598e24f8fa Removal of the Key_supply axiom (affects many possbility proofs) and minor
paulson
parents: 13907
diff changeset
    98
apply (possibility, simp add: used_Cons) 
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
    99
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   100
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   101
lemma Gets_imp_Says [dest!]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   102
     "\<lbrakk>Gets B X \<in> set evs; evs \<in> otway\<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   103
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   104
apply (erule otway.induct, auto)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   105
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   106
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   107
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   108
(** For reasoning about the encrypted portion of messages **)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   109
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   110
lemma OR2_analz_knows_Spy:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   111
     "\<lbrakk>Gets B \<lbrace>N, Agent A, Agent B, X\<rbrace> \<in> set evs;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   112
      \<Longrightarrow> X \<in> analz (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   113
by blast
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   114
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   115
lemma OR4_analz_knows_Spy:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   116
     "\<lbrakk>Gets B \<lbrace>N, X, Crypt (shrK B) X'\<rbrace> \<in> set evs;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   117
      \<Longrightarrow> X \<in> analz (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   118
by blast
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   119
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   120
(*These lemmas assist simplification by removing forwarded X-variables.
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   121
  We can replace them by rewriting with parts_insert2 and proving using
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   122
  dest: parts_cut, but the proofs become more difficult.*)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   123
lemmas OR2_parts_knows_Spy =
45605
a89b4bc311a5 eliminated obsolete "standard";
wenzelm
parents: 37936
diff changeset
   124
    OR2_analz_knows_Spy [THEN analz_into_parts]
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   125
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   126
(*There could be OR4_parts_knows_Spy and Oops_parts_knows_Spy, but for
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   127
  some reason proofs work without them!*)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   128
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   129
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   130
text\<open>Theorems of the form @{term "X \<notin> parts (spies evs)"} imply that
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   131
NOBODY sends messages containing X!\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   132
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   133
text\<open>Spy never sees a good agent's shared key!\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   134
lemma Spy_see_shrK [simp]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   135
     "evs \<in> otway \<Longrightarrow> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)"
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   136
by (erule otway.induct, force,
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   137
    drule_tac [4] OR2_parts_knows_Spy, simp_all, blast+)
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   138
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   139
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   140
lemma Spy_analz_shrK [simp]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   141
     "evs \<in> otway \<Longrightarrow> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   142
by auto
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   143
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   144
lemma Spy_see_shrK_D [dest!]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   145
     "\<lbrakk>Key (shrK A) \<in> parts (knows Spy evs);  evs \<in> otway\<rbrakk> \<Longrightarrow> A \<in> bad"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   146
by (blast dest: Spy_see_shrK)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   147
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   148
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   149
subsection\<open>Towards Secrecy: Proofs Involving @{term analz}\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   150
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   151
(*Describes the form of K and NA when the Server sends this message.  Also
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   152
  for Oops case.*)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   153
lemma Says_Server_message_form:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   154
     "\<lbrakk>Says Server B \<lbrace>NA, X, Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   155
         evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   156
      \<Longrightarrow> K \<notin> range shrK & (\<exists>i. NA = Nonce i) & (\<exists>j. NB = Nonce j)"
17778
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 17411
diff changeset
   157
by (erule rev_mp, erule otway.induct, simp_all)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   158
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   159
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   160
(****
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   161
 The following is to prove theorems of the form
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   162
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   163
  Key K \<in> analz (insert (Key KAB) (knows Spy evs)) \<Longrightarrow>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   164
  Key K \<in> analz (knows Spy evs)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   165
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   166
 A more general formula must be proved inductively.
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   167
****)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   168
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   169
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   170
text\<open>Session keys are not used to encrypt other session keys\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   171
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   172
text\<open>The equality makes the induction hypothesis easier to apply\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   173
lemma analz_image_freshK [rule_format]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   174
 "evs \<in> otway \<Longrightarrow>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   175
   \<forall>K KK. KK <= -(range shrK) -->
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   176
          (Key K \<in> analz (Key`KK Un (knows Spy evs))) =
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   177
          (K \<in> KK | Key K \<in> analz (knows Spy evs))"
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   178
apply (erule otway.induct)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   179
apply (frule_tac [8] Says_Server_message_form)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   180
apply (drule_tac [7] OR4_analz_knows_Spy)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   181
apply (drule_tac [5] OR2_analz_knows_Spy, analz_freshK, spy_analz, auto) 
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   182
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   183
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   184
lemma analz_insert_freshK:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   185
  "\<lbrakk>evs \<in> otway;  KAB \<notin> range shrK\<rbrakk> \<Longrightarrow>
11655
923e4d0d36d5 tuned parentheses in relational expressions;
wenzelm
parents: 11251
diff changeset
   186
      (Key K \<in> analz (insert (Key KAB) (knows Spy evs))) =
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   187
      (K = KAB | Key K \<in> analz (knows Spy evs))"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   188
by (simp only: analz_image_freshK analz_image_freshK_simps)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   189
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   190
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   191
text\<open>The Key K uniquely identifies the Server's  message.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   192
lemma unique_session_keys:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   193
     "\<lbrakk>Says Server B \<lbrace>NA, X, Crypt (shrK B) \<lbrace>NB, K\<rbrace>\<rbrace>   \<in> set evs;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   194
         Says Server B' \<lbrace>NA',X',Crypt (shrK B') \<lbrace>NB',K\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   195
         evs \<in> otway\<rbrakk> \<Longrightarrow> X=X' & B=B' & NA=NA' & NB=NB'"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   196
apply (erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   197
apply (erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   198
apply (erule otway.induct, simp_all)
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   199
apply blast+  \<comment>\<open>OR3 and OR4\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   200
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   201
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   202
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   203
subsection\<open>Authenticity properties relating to NA\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   204
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   205
text\<open>Only OR1 can have caused such a part of a message to appear.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   206
lemma Crypt_imp_OR1 [rule_format]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   207
 "\<lbrakk>A \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   208
  \<Longrightarrow> Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace> \<in> parts (knows Spy evs) -->
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   209
      Says A B \<lbrace>NA, Agent A, Agent B,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   210
                 Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   211
        \<in> set evs"
14225
6d1026266e2b better presentation
paulson
parents: 14207
diff changeset
   212
by (erule otway.induct, force,
6d1026266e2b better presentation
paulson
parents: 14207
diff changeset
   213
    drule_tac [4] OR2_parts_knows_Spy, simp_all, blast+)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   214
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   215
lemma Crypt_imp_OR1_Gets:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   216
     "\<lbrakk>Gets B \<lbrace>NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   217
                  Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   218
         A \<notin> bad; evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   219
       \<Longrightarrow> Says A B \<lbrace>NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   220
                      Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   221
             \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   222
by (blast dest: Crypt_imp_OR1)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   223
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   224
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   225
text\<open>The Nonce NA uniquely identifies A's message\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   226
lemma unique_NA:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   227
     "\<lbrakk>Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace> \<in> parts (knows Spy evs);
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   228
         Crypt (shrK A) \<lbrace>NA, Agent A, Agent C\<rbrace> \<in> parts (knows Spy evs);
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   229
         evs \<in> otway;  A \<notin> bad\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   230
      \<Longrightarrow> B = C"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   231
apply (erule rev_mp, erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   232
apply (erule otway.induct, force,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   233
       drule_tac [4] OR2_parts_knows_Spy, simp_all, blast+)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   234
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   235
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   236
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   237
text\<open>It is impossible to re-use a nonce in both OR1 and OR2.  This holds because
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   238
  OR2 encrypts Nonce NB.  It prevents the attack that can occur in the
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   239
  over-simplified version of this protocol: see \<open>OtwayRees_Bad\<close>.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   240
lemma no_nonce_OR1_OR2:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   241
   "\<lbrakk>Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace> \<in> parts (knows Spy evs);
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   242
       A \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   243
    \<Longrightarrow> Crypt (shrK A) \<lbrace>NA', NA, Agent A', Agent A\<rbrace> \<notin> parts (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   244
apply (erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   245
apply (erule otway.induct, force,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   246
       drule_tac [4] OR2_parts_knows_Spy, simp_all, blast+)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   247
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   248
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   249
text\<open>Crucial property: If the encrypted message appears, and A has used NA
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   250
  to start a run, then it originated with the Server!\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   251
lemma NA_Crypt_imp_Server_msg [rule_format]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   252
     "\<lbrakk>A \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   253
      \<Longrightarrow> Says A B \<lbrace>NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   254
                     Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs -->
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   255
          Crypt (shrK A) \<lbrace>NA, Key K\<rbrace> \<in> parts (knows Spy evs)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   256
          --> (\<exists>NB. Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   257
                         \<lbrace>NA,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   258
                           Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   259
                           Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   260
apply (erule otway.induct, force,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   261
       drule_tac [4] OR2_parts_knows_Spy, simp_all, blast)
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   262
  subgoal \<comment>\<open>OR1: by freshness\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   263
    by blast  
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   264
  subgoal \<comment>\<open>OR3\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   265
    by (blast dest!: no_nonce_OR1_OR2 intro: unique_NA)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   266
  subgoal \<comment>\<open>OR4\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   267
    by (blast intro!: Crypt_imp_OR1) 
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   268
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   269
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   270
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   271
text\<open>Corollary: if A receives B's OR4 message and the nonce NA agrees
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   272
  then the key really did come from the Server!  CANNOT prove this of the
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   273
  bad form of this protocol, even though we can prove
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   274
  \<open>Spy_not_see_encrypted_key\<close>\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   275
lemma A_trusts_OR4:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   276
     "\<lbrakk>Says A  B \<lbrace>NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   277
                     Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   278
         Says B' A \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   279
     A \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   280
  \<Longrightarrow> \<exists>NB. Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   281
               \<lbrace>NA,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   282
                 Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   283
                 Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   284
                 \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   285
by (blast intro!: NA_Crypt_imp_Server_msg)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   286
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   287
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   288
text\<open>Crucial secrecy property: Spy does not see the keys sent in msg OR3
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   289
    Does not in itself guarantee security: an attack could violate
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   290
    the premises, e.g. by having @{term "A=Spy"}\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   291
lemma secrecy_lemma:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   292
 "\<lbrakk>A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   293
  \<Longrightarrow> Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   294
        \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   295
          Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs -->
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   296
      Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs -->
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   297
      Key K \<notin> analz (knows Spy evs)"
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   298
  apply (erule otway.induct, force, simp_all)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   299
  subgoal \<comment>\<open>Fake\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   300
    by spy_analz
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   301
  subgoal \<comment>\<open>OR2\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   302
    by (drule OR2_analz_knows_Spy) (auto simp: analz_insert_eq)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   303
  subgoal \<comment>\<open>OR3\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   304
    by (auto simp add: analz_insert_freshK pushes)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   305
  subgoal \<comment>\<open>OR4\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   306
    by (drule OR4_analz_knows_Spy) (auto simp: analz_insert_eq)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   307
  subgoal \<comment>\<open>Oops\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   308
    by (auto simp add: Says_Server_message_form analz_insert_freshK unique_session_keys)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   309
  done
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   310
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   311
theorem Spy_not_see_encrypted_key:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   312
     "\<lbrakk>Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   313
          \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   314
                Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   315
         Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   316
         A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   317
      \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   318
by (blast dest: Says_Server_message_form secrecy_lemma)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   319
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   320
text\<open>This form is an immediate consequence of the previous result.  It is 
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   321
similar to the assertions established by other methods.  It is equivalent
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   322
to the previous result in that the Spy already has @{term analz} and
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   323
@{term synth} at his disposal.  However, the conclusion 
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   324
@{term "Key K \<notin> knows Spy evs"} appears not to be inductive: all the cases
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   325
other than Fake are trivial, while Fake requires 
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   326
@{term "Key K \<notin> analz (knows Spy evs)"}.\<close>
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   327
lemma Spy_not_know_encrypted_key:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   328
     "\<lbrakk>Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   329
          \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   330
                Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   331
         Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   332
         A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   333
      \<Longrightarrow> Key K \<notin> knows Spy evs"
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   334
by (blast dest: Spy_not_see_encrypted_key)
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   335
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   336
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   337
text\<open>A's guarantee.  The Oops premise quantifies over NB because A cannot know
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   338
  what it is.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   339
lemma A_gets_good_key:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   340
     "\<lbrakk>Says A  B \<lbrace>NA, Agent A, Agent B,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   341
                     Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   342
         Says B' A \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   343
         \<forall>NB. Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   344
         A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   345
      \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   346
by (blast dest!: A_trusts_OR4 Spy_not_see_encrypted_key)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   347
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   348
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   349
subsection\<open>Authenticity properties relating to NB\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   350
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   351
text\<open>Only OR2 can have caused such a part of a message to appear.  We do not
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   352
  know anything about X: it does NOT have to have the right form.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   353
lemma Crypt_imp_OR2:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   354
     "\<lbrakk>Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace> \<in> parts (knows Spy evs);
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   355
         B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   356
      \<Longrightarrow> \<exists>X. Says B Server
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   357
                 \<lbrace>NA, Agent A, Agent B, X,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   358
                   Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   359
                 \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   360
apply (erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   361
apply (erule otway.induct, force,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   362
       drule_tac [4] OR2_parts_knows_Spy, simp_all, blast+)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   363
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   364
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   365
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   366
text\<open>The Nonce NB uniquely identifies B's  message\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   367
lemma unique_NB:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   368
     "\<lbrakk>Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace> \<in> parts(knows Spy evs);
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   369
         Crypt (shrK B) \<lbrace>NC, NB, Agent C, Agent B\<rbrace> \<in> parts(knows Spy evs);
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   370
           evs \<in> otway;  B \<notin> bad\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   371
         \<Longrightarrow> NC = NA & C = A"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   372
apply (erule rev_mp, erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   373
apply (erule otway.induct, force,
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   374
       drule_tac [4] OR2_parts_knows_Spy, simp_all)
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   375
apply blast+  \<comment>\<open>Fake, OR2\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   376
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   377
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   378
text\<open>If the encrypted message appears, and B has used Nonce NB,
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   379
  then it originated with the Server!  Quite messy proof.\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   380
lemma NB_Crypt_imp_Server_msg [rule_format]:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   381
 "\<lbrakk>B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   382
  \<Longrightarrow> Crypt (shrK B) \<lbrace>NB, Key K\<rbrace> \<in> parts (knows Spy evs)
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   383
      --> (\<forall>X'. Says B Server
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   384
                     \<lbrace>NA, Agent A, Agent B, X',
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   385
                       Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   386
           \<in> set evs
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   387
           --> Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   388
                \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   389
                      Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   390
                    \<in> set evs)"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   391
apply simp
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   392
apply (erule otway.induct, force, simp_all)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   393
  subgoal \<comment>\<open>Fake\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   394
    by blast 
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   395
  subgoal \<comment>\<open>OR2\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   396
    by (force dest!: OR2_parts_knows_Spy)
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   397
  subgoal \<comment>\<open>OR3\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   398
    by (blast dest: unique_NB dest!: no_nonce_OR1_OR2)  \<comment>\<open>OR3\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   399
  subgoal \<comment>\<open>OR4\<close>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   400
    by (blast dest!: Crypt_imp_OR2) 
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   401
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   402
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   403
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   404
text\<open>Guarantee for B: if it gets a message with matching NB then the Server
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   405
  has sent the correct message.\<close>
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   406
theorem B_trusts_OR3:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   407
     "\<lbrakk>Says B Server \<lbrace>NA, Agent A, Agent B, X',
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   408
                         Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   409
           \<in> set evs;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   410
         Gets B \<lbrace>NA, X, Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   411
         B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   412
      \<Longrightarrow> Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   413
               \<lbrace>NA,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   414
                 Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   415
                 Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   416
                 \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   417
by (blast intro!: NB_Crypt_imp_Server_msg)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   418
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   419
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   420
text\<open>The obvious combination of \<open>B_trusts_OR3\<close> with 
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   421
      \<open>Spy_not_see_encrypted_key\<close>\<close>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   422
lemma B_gets_good_key:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   423
     "\<lbrakk>Says B Server \<lbrace>NA, Agent A, Agent B, X',
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   424
                         Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   425
           \<in> set evs;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   426
         Gets B \<lbrace>NA, X, Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   427
         Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   428
         A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   429
      \<Longrightarrow> Key K \<notin> analz (knows Spy evs)"
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   430
by (blast dest!: B_trusts_OR3 Spy_not_see_encrypted_key)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   431
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   432
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   433
lemma OR3_imp_OR2:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   434
     "\<lbrakk>Says Server B
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   435
              \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   436
                Crypt (shrK B) \<lbrace>NB, Key K\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   437
         B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   438
  \<Longrightarrow> \<exists>X. Says B Server \<lbrace>NA, Agent A, Agent B, X,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   439
                            Crypt (shrK B) \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   440
              \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   441
apply (erule rev_mp)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   442
apply (erule otway.induct, simp_all)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   443
apply (blast dest!: Crypt_imp_OR2)+
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   444
done
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   445
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   446
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   447
text\<open>After getting and checking OR4, agent A can trust that B has been active.
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   448
  We could probably prove that X has the expected form, but that is not
61830
4f5ab843cf5b isabelle update_cartouches -c -t;
wenzelm
parents: 58889
diff changeset
   449
  strictly necessary for authentication.\<close>
13907
2bc462b99e70 tidying
paulson
parents: 13507
diff changeset
   450
theorem A_auths_B:
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   451
     "\<lbrakk>Says B' A \<lbrace>NA, Crypt (shrK A) \<lbrace>NA, Key K\<rbrace>\<rbrace> \<in> set evs;
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   452
         Says A  B \<lbrace>NA, Agent A, Agent B,
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   453
                     Crypt (shrK A) \<lbrace>NA, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;
63975
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   454
         A \<notin> bad;  B \<notin> bad;  evs \<in> otway\<rbrakk>
6728b5007ad0 Trying out "subgoal", and no more [| |]
paulson <lp15@cam.ac.uk>
parents: 61956
diff changeset
   455
  \<Longrightarrow> \<exists>NB X. Says B Server \<lbrace>NA, Agent A, Agent B, X,
61956
38b73f7940af more symbols;
wenzelm
parents: 61830
diff changeset
   456
                               Crypt (shrK B)  \<lbrace>NA, NB, Agent A, Agent B\<rbrace>\<rbrace>
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   457
                 \<in> set evs"
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   458
by (blast dest!: A_trusts_OR4 OR3_imp_OR2)
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11230
diff changeset
   459
1941
f97a6e5b6375 Initial working proof of Otway-Rees protocol
paulson
parents:
diff changeset
   460
end